Skip to content

lib/index.d.ts file on npm contains a node_modules path for unist-util-is dependency #6

Closed
@jamesgeorgewilliams

Description

@jamesgeorgewilliams

Initial checklist

Affected package

[email protected]

Steps to reproduce

The following example is a vanilla TS project running the example from this repo's README.md. The error is encountered when trying to build the project with npm run build.

https://stackblitz.com/edit/vitejs-vite-a7aqha48?file=src%2Fmain.ts

  1. Open the stackblitz demo.
  2. ctrl + c in terminal to stop vite dev server.
  3. npm run build to view error.

Actual behavior

The following error is observed after running npm run build in the terminal on the Stackblitz link above.

node_modules/unist-util-find-before/lib/index.d.ts:14:86 - error TS2307: Cannot find module '../node_modules/unist-util-is/lib/index.js' or its corresponding type declarations.

14 export const findBefore: (<Kind extends import("unist").Parent, Check extends import("../node_modules/unist-util-is/lib/index.js").Test>(parent: Kind, index: number | Child<Kind>, test: Check) => Matches<Child<Kind>, Check> | undefined) & (<Kind_1 extends import("unist").Parent>(parent: Kind_1, index: number | Child<Kind_1>, test?: null | undefined) => Child<Kind_1> | undefined);
                                                              
Found 1 error in node_modules/unist-util-find-before/lib/index.d.ts:14

Expected behavior

Running npm run build in unist-util-find-before repository produces the following on line:14 of lib/index.d.ts.

export const findBefore: ((<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) & (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined));

The npm version of this file contains a path on line:14.
https://www.npmjs.com/package/unist-util-find-before?activeTab=code

Runtime

[email protected]

Package manager

[email protected]

Operating system

macOS Sequoia 15.1

Build and bundle tools

Vite

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions