Lyu, Wei-Da
Lyu, Wei-Da
Hi. `svelte2tsx` maintainer here. `svelte2tsx` uses TypeScript API to parse script tag content so I don't think it'll work if you don't have TypeScript. Also, we don't recommend using AST...
To type the prop you need to type the props object and not individual props. https://svelte-5-preview.vercel.app/docs/runes#$props The `unknown` part is generated by language-tools. But without that, it will still be...
The problem is that this is treated as implicit props so no virtual variable is generated for the snippet. Instead, it's directly passed to SomeCommponent as props. So yes. making...
Behind the scenes, a virtual ts is generated so TypeScript can understand the svelte file. What I meant is that because it is an implicit prop. The generated snippet is...
Note for self, one advantage of inlining the snippet as Component props is that the type is inferred. If we always transform this as a variable the parameter type won't...
This matches the actual runtime behavior. If you returned null or undefined the data props is an empty object.
The reason for the lang check is because of ``. So the solution is probably similar to https://github.com/sveltejs/language-tools/issues/694 and some regex need to be tweaked.
Still need to find a way to infer the type from the default value.
> What do you mean by "infer the type from the default value"? Because of the type annotation, the type for the parameter would be any instead of inferring from...
This is because the `include` config in tsconfig.app.json doesn't have svelte files. If I add svelte files to include, the error and restart the server, the error is gone.