-
-
Notifications
You must be signed in to change notification settings - Fork 445
typescript-vue-plugin-forward causing: TS Server fatal error: Type assertions should never be parsed outside of TS; they should either be comparisons or JSX. #2434
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
Comments
I didn't find a repo case from the related links, but I will try to guess the virtual code that caused the problem from the call stack. |
@johnsoncodehk I agree crashing seems wrong and please do file an issue against TypeScript for this, but more immediately this plugin appears to be causing this crash by getting TS Server into a bad state. That's causing a lot of user pain and needs to be patched around on the plugin side first If you're not able to reproduce this, try pinging some of the effected users to see if they can share some steps. Here's all the issue reports we've had so far: https://github.com/microsoft/vscode/issues?q=is%3Aissue+Type+assertions+should+never+be+parsed+outside+of+TS |
I added this assert in microsoft/TypeScript#52667; if this is firing, then there's still a bug in the TS parser so I definitely want to know what JS code is causing this. |
To be clear, this isn't a user error; the old-style type assertions cannot appear in JSX/TSX at all because we're supposed to parse them as JSX elements. |
Hm, I guess this is because the plugin uses a custom script kind / extension and so on. I'll tweak the assert in TS to account for this. |
PR is merged, so the next nightly should make this go away; no change is required here. |
@jakebailey Great. 👍 I found that the problem is not due to virtual .js code, but Vue TS Plugin provides .vue files via Simply debug with: function parseTypeAssertion() {
console.log('!@#$', typeof sourceText, scriptKind);
console.log(JSON.stringify(sourceText));
Debug.assert(scriptKind === 3 /* TS */, "Type assertions should never be parsed outside of TS; they should either be comparisons or JSX.");
// ...
}
As you said at #2434 (comment). |
Hm, given that's not any language that TypeScript currently supports, I do wonder if there's a bunch of time being wasted parsing that whole thing... |
This is possible considering that tsserver is actually trying to parse .vue files. 😅 It is worth noting that this is only the case for TS Plugin, for Vue Language Server we only parse .vue to the .vue.ts and provide to TS LanguageServiceHost, the mapping of .vue.ts to .vue is done outside of TS. For Vue users who are concerned about performance, they are using takeover mode and avoiding the duplication cost of TS Plugin / tsserver, so I think not a big problem at the moment. |
Well, in any case, thanks for fuzz testing our parser 😉 |
Uh oh!
There was an error while loading. Please reload this page.
Hi, it looks like
typescript-vue-plugin-forward
may be causing VS Code's Typescript language server to throw the following exception:We're seeing multiple reports of this, all from users with this plugin enabled. Best I can tell, this plugin comes from this repository but let me know if there's somewhere else this belongs
Please take a look and follow up with any of the effected users in the linked issues below to figure out what may be going on.
The text was updated successfully, but these errors were encountered: