Skip to content
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

vue-tsc CLI rest params runtime error in version 2.0.19 and beyond #4578

Open
pdhoopr opened this issue Jul 11, 2024 · 1 comment
Open

vue-tsc CLI rest params runtime error in version 2.0.19 and beyond #4578

pdhoopr opened this issue Jul 11, 2024 · 1 comment
Labels
bug Something isn't working upstream: typescript

Comments

@pdhoopr
Copy link

pdhoopr commented Jul 11, 2024

Vue - Official extension or vue-tsc version

[email protected]

VSCode version

1.91.1

Vue version

3.4.31

TypeScript version

5.4.5

System Info

System:
  OS: macOS 14.5
  CPU: (12) arm64 Apple M3 Pro
  Memory: 83.59 MB / 18.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 20.12.0 - ~/.asdf/installs/nodejs/20.12.0/bin/node
  Yarn: 3.6.3 - ~/.asdf/installs/nodejs/20.12.0/bin/yarn
  npm: 10.5.0 - ~/.asdf/plugins/nodejs/shims/npm
Browsers:
  Safari: 17.5

Steps to reproduce

Unfortunately, I'm not able to track down exactly what in our code is triggering the error, but I can provide some additional context/learnings I've come across. It seems like it might be related to rest parameters:

  • In [email protected], this type change was made to event handlers.
  • For some reason, that change started triggering an error from the tsc runtime, which has an open issue and potential fix, but hasn't been resolved yet.
  • However, vue-tsc was not surfacing runtime errors, so after upgrading to 2.0.19, the type checker was encountering the runtime error above and silently erroring out itself without reporting any type errors. This gave the appearance that it finished successfully, so we didn't catch it right away.
  • In [email protected], this change was made to surface runtime errors, and so now our type-checking errors out as it should.

What is expected?

vue-tsc successfully runs to completion, reporting errors along the way (if any).

What is actually happening?

vue-tsc encounters a runtime error from tsc and errors out. The stack trace logged to the console is:

TypeError: Cannot read properties of undefined (reading 'flags')
    at getCheckFlags (/app/node_modules/typescript/lib/tsc.js:15948:17)
    at getTypeOfSymbol (/app/node_modules/typescript/lib/tsc.js:53297:24)
    at getParameterCount (/app/node_modules/typescript/lib/tsc.js:73708:24)
    at getRestTypeAtPosition (/app/node_modules/typescript/lib/tsc.js:73679:28)
    at assignContextualParameterTypes (/app/node_modules/typescript/lib/tsc.js:73835:41)
    at contextuallyCheckFunctionExpressionOrObjectLiteralMethod (/app/node_modules/typescript/lib/tsc.js:74560:13)
    at checkFunctionExpressionOrObjectLiteralMethod (/app/node_modules/typescript/lib/tsc.js:74535:5)
    at checkExpressionWorker (/app/node_modules/typescript/lib/tsc.js:76319:16)
    at checkExpression (/app/node_modules/typescript/lib/tsc.js:76221:32)
    at checkExpressionForMutableLocation (/app/node_modules/typescript/lib/tsc.js:75979:18)

Link to minimal reproduction

No response

Any additional comments?

Based on the details provided in the steps to reproduce section, I can't tell if there's actually anything that can be done from a vue-tsc perspective, or if this needs to be solved on the tsc side.

Thank you!!

@johnsoncodehk
Copy link
Member

Thank you for your report and collection of relevant information! 86e38db#diff-93ac10dff6acb9af8511a96c6ef3bdabf647f4ed0a85a9fe1566a0cf320cf44aR157 is to fix the TS type of parameterless event. I have not yet come up with an alternative way of writing virtual code. Unfortunately, we may have to wait for microsoft/TypeScript#58440 to be merged.

@johnsoncodehk johnsoncodehk added bug Something isn't working upstream and removed pending triage labels Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream: typescript
Projects
None yet
Development

No branches or pull requests

3 participants