-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
breaking changep2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.types / typescript
Description
Describe the problem
Right now we have to do ambient module hacks to define a public API through hand-written d.ts files for deep imports like @svelte/kit/hooks .
Describe the proposed solution
TypeScript 4.5 will support the exports field of a package.json along with a special import for types: microsoft/TypeScript#33079 (comment)
This means we could do
"exports": {
"hooks": {
"import": "./hooks.index.js",
"types": "./types/hooks.d.ts"
}
}
If we do this we require people to use a compatible version of TypeScript which would be breaking change, so it would need to happen before 1.0 ideally.
Alternatives considered
- Keep the hack as-is for now and change it in v2
- Add a post-build-script which copies handwritten types to a location like
hooks/index.d.tswhere TS should pick it up
Importance
would make my life easier
Additional Information
No response
gyurielf, benmccann, dominikg, chanced, alexiglesias93 and 10 more
Metadata
Metadata
Assignees
Labels
breaking changep2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.types / typescript