You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript types are not resolved property for several bits-ui (and shadcn svelte) components. For example, the shadcn-svelte DropdownMenuContent component props resolve as the "any" type:
This is caused by missing fully specified import specifiers in several places in bits-ui.
For example, bits/floating/types uses "../../internal" rather than "../../internal/index.js".
To prevent these types of issues, and support the widest range of uses, the authors of TypeScript and SvelteKit recommend that library authors not use moduleResolution "bundler". bits-ui is using moduleResolution "bundlers", so these issues are not detected at build.
To fix this issue, bits-ui should add "module": "NodeNext" to it's tsconfig.json and remove "moduleResolution": "bundler". ("module": "NodeNext" implies "moduleResolution": "NodeNext").
This will identify all the places in the library where import specifiers are invalid for modern node.
rsweeneydev
changed the title
Svelte component libraries should use "NodeNext" for moduleResolution, not bundler
Svelte component libraries should use "NodeNext" for moduleResolution, not "bundler"
Jan 13, 2024
Describe the bug
TypeScript types are not resolved property for several bits-ui (and shadcn svelte) components. For example, the shadcn-svelte DropdownMenuContent component props resolve as the "any" type:
This is caused by missing fully specified import specifiers in several places in bits-ui.
For example, bits/floating/types uses
"../../internal"
rather than"../../internal/index.js"
.To prevent these types of issues, and support the widest range of uses, the authors of TypeScript and SvelteKit recommend that library authors not use moduleResolution "bundler". bits-ui is using moduleResolution "bundlers", so these issues are not detected at build.
Here are the relevant links to the documentation:
To fix this issue, bits-ui should add
"module": "NodeNext"
to it's tsconfig.json and remove"moduleResolution": "bundler"
. ("module": "NodeNext" implies "moduleResolution": "NodeNext").This will identify all the places in the library where import specifiers are invalid for modern node.
Reproduction
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: