carbon-design-system / sveld

Generate TypeScript definitions for your Svelte components
https://sveld.onrender.com
Apache License 2.0
408 stars 21 forks source link

feat: add svelte-4 typings #108

Closed theetrain closed 1 year ago

theetrain commented 1 year ago

Todo:

theetrain commented 1 year ago

@metonym overall this PR should help resolve test errors raised in https://github.com/carbon-design-system/carbon-components-svelte/pull/1755

My current issue is running yarn prepack yields numerous errors like these:

image

I'm not sure how it was able to build before, and there doesn't seem to be any major differences in svelte/compiler or estree-walker between Svelte 3 and 4. Do you have any insight?

metonym commented 1 year ago

@theetrain I've upgraded my Svelte Preprocessor template to v4, and experienced broken types.

I've found the easiest workaround is to override the svelte/compiler walk function and "augment" Element interface.

https://github.com/metonym/template/blob/svelte-preprocessor/src/global.d.ts