Skip to content

feat: import svelte types #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2021
Merged

feat: import svelte types #105

merged 2 commits into from
Jul 21, 2021

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jul 20, 2021

Fixes #10

I initially wanted to import the types from svelte directly for every other files, but eslint keeps complaining of node/no-missing-import, and the imports are ugly :D So I've only modified the option.ts file, which re-exports the types needed. Though, let me know if we do want to import from svelte directly, and we could try that path.

I also removed --dts-resolve from tsup. It was unable to resolve estree, likely from Svelte compiler's dependencies. Removing that doesn't change the final dts however, so it looks safe.

@bluwy
Copy link
Member Author

bluwy commented Jul 21, 2021

Forgot to mark the exported types with export type which caused these imports to be included in the JS bundle before. Fixed.

@dominikg
Copy link
Member

does this actually work? svelte does not export the types, hence the eslint warnings. I thought the first step for this was to make these types public in svelte.

@bluwy
Copy link
Member Author

bluwy commented Jul 21, 2021

Yeah it does work. I'm guessing eslint wasn't scanning ts files, hence the errors. They're deep imports though, but it's the only way to import the types, so they sort-off become public APIs (see also sveltejs/svelte#6100). I also did this in the past and it works well.

@dominikg dominikg merged commit 1792d7a into sveltejs:main Jul 21, 2021
@github-actions github-actions bot mentioned this pull request Jul 21, 2021
@bluwy bluwy deleted the gh-10 branch July 24, 2021 03:19
@github-actions github-actions bot mentioned this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import svelte types instead of duplicating them
2 participants