You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever the compiler encounters such a cast-expression, it throws the error:
Not implemented TSTypeAssertion
This is not a critical bug, but is an annoyance as sometimes a type checker is unable to deduce the true types of some expressions, which can cause several false positives. Casting is what help "patch" these issues.
System and binaries are the same as https://svelte.dev/playground/ (console says it's running Svelte compiler version 5.23.2).Browsers: Brave Browser: 134.1.76.74
Severity
annoyance
The text was updated successfully, but these errors were encountered:
This isn't a direct bug in Svelte, rather it seems like a combination of bugs in both @sveltejs/acorn-typescript and esrap. I tried to make a fix, but there's some weird differences between acorn-typescript and @sveltejs/acorn-typescript that I can't resolve.
For now I'd recommend using TypeScript's as type assertion syntax, like so:
Describe the bug
The Svelte compiler is not handling what the parser calls, TSTypeAssertion AST nodes.
About Typescript type assertions: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions
Whenever the compiler encounters such a cast-expression, it throws the error:
This is not a critical bug, but is an annoyance as sometimes a type checker is unable to deduce the true types of some expressions, which can cause several false positives. Casting is what help "patch" these issues.
Reproduction
https://svelte.dev/playground/hello-world?version=5.23.2#H4sIAAAAAAAAA22OywrCMBBFfyXOJi2IxW1MC-78B-OitmMNxGlIxhel_25iXbq7HO6ZuRNQe0NQcEDnRvEcg-tFgb1l7EtYw8U6jKCOE_Db514Gif-svfeb-EDHmZ3biP94NxIjcToDOnbBehaupaGWHGVjyLBDFllUInKwNIha6CU1opDfTbLcGdLVomeJ9HXbLKOn7M4rXSViKD1kfDEoDnecT_MH1_OZN-IAAAA=
Logs
None provided, see reproduction.
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: