-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Optional props: Type is not assignable to type 'IntrinsicAttributes & ...'. #347
Comments
Don't worry you just encounter a ton of problems at once.
The event handler issue will be fixed once #303 is merged. It would have a different mechanism. |
For 1.: I think it's this line which produces the bug. No prop has a type annotation -> code returns there and the |
Also this one I think
|
What about this one declare function __sveltets_partial<T>(a: T): Partial<T>
declare function __sveltets_any(dummy: any): any;
function render() {
let b = false;
let c = false;
let d: 1 | 123 = 123;c = __sveltets_any(c);;
return { b, ...__sveltets_partial({ c: c }), ...__sveltets_partial({ d: d }) }
} |
About the event handler seems like every spread syntax on tag in |
Before this, `export let a = ''` would not be marked as optional because it had no type. sveltejs#347 Also fixes a bug where file type was incorrectly inferred as jsx which occurs when user uses the default languages feature of svelte-preprocess. Instead of computing the file type inside svelte2tsx, it is now passed as an option.
Before this, `export let a = ''` would not be marked as optional because it had no type. #347 Also fixes a bug where file type was incorrectly inferred as jsx which occurs when user uses the default languages feature of svelte-preprocess. Instead of computing the file type inside svelte2tsx, it is now passed as an option.
Quick update:
still exists, which can be worked around by doing |
Closing in favor of #588 |
Describe the bug
I have a component like this:
If I use this component from another component but do not define the width:
<Abc height="100%" responsive={true} />
, VSCode shows the following error:Therefore I tried explicitly defining width as string | undefined:
Now I get this error:
Type 'true' is not assignable to type 'false'
It complains because I am setting another value than the default value.
Most strangely, adding an event handler for an event which doesn't even exist fixes the errors:
<Abc height="100%" on:bla={e => {}} responsive={true} />
Expected behavior
It should be possible to skip properties with default value or use other values than the default value.
System (please complete the following information):
tsconfig:
Additional context
This is so strange, maybe something with my setup is wrong?
Related: #276
The text was updated successfully, but these errors were encountered: