Skip to content
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

(feat) make it possible to pass additional file paths to emitDts #1412

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dummdidumm
Copy link
Member

Needed when someone uses the svelte.JSX typings.
Closes #1405

Other possibilities:

Needed when someone uses the svelte.JSX typings.
Closes sveltejs#1405
@dummdidumm dummdidumm marked this pull request as draft March 14, 2022 15:45
@dummdidumm
Copy link
Member Author

Marking this as draft because different thought just occured to me:

  • What if we add the ambient typings to the @types namespace? Would this be something we should do in the long run anyway?
  • Is this solvable by adding another reference to the app.d.ts (/// <reference types="svelte2tsx/svelte-jsx" />, @rgossiaux does this work for you?) template in the case of SvelteKit?

cc @jasonlyu123

@rgossiaux
Copy link

  • Is this solvable by adding another reference to the app.d.ts (/// <reference types="svelte2tsx/svelte-jsx" />, @rgossiaux does this work for you?) template in the case of SvelteKit?

From what I see the app.d.ts is not passed to emitDts, since it lives outside the lib/ directory, so you'd still need a config change to solve that. But regardless, anything that solves the problem works for me, I'm not picky 😃

@dummdidumm
Copy link
Member Author

Oh right you're correct, that wouldn't work for you in this case. You could add a d.ts file to the lib folder with the mentioned content and exclude it from being exported, maybe that works.

@fallaciousreasoning
Copy link

Wondering if there was any movement on this, or did you end up solving this in a different way?

@fallaciousreasoning
Copy link

FWIW, I'm working on a Svelte component library, and we're compiling the Svelte components to web-components. We're using svelte2tsx to generate the type definitions which we use to get intellisense & typings in a React wrapper. This works really well for most cases, but when the component is something primitive (like a button or a link) and we want to expose the props on the underlying HTML element svelte2tsx breaks.

Currently, I have a fork of svelte2tsx with this change, which I'm vendoring into the repository and it works really nicely. Any chance we could land this? It solves this really nicely 😄

@jasonlyu123
Copy link
Member

The plan is to move the element typing to the svelte core. You can see the roadmap here #1552

@fallaciousreasoning
Copy link

Okay, got this working without the svelte2tsx fork by bumping Svelte to 3.55.0 and using SvelteHTMLElements['button'] instead of the svelte2tsx typings. Thanks @jasonlyu123!

@dummdidumm
Copy link
Member Author

Since Svelte 3.55 it's possible to enhance from HTML typings through the svelte/elements import. I think this PR might be obsolete because of this.

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.

4 participants