Skip to content

Typescript 5.0 support #2343

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

Closed
patroza opened this issue Jan 29, 2023 · 8 comments · Fixed by #2555
Closed

Typescript 5.0 support #2343

patroza opened this issue Jan 29, 2023 · 8 comments · Fixed by #2555
Labels
bug Something isn't working

Comments

@patroza
Copy link

patroza commented Jan 29, 2023

Typescript 5.0 beta was released https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/
But typing inside template attributes doesn't work with it:

components/TextArea.vue:5:26 - error TS7006: Parameter 'value' implicitly has an 'any' type.

@update:model-value="value => convertOut(value, updateValue)"
components/Some.vue:62:28 - error TS7006: Parameter '_' implicitly has an 'any' type.

v-if="items.some(_ => _.state._tag === 'Open')"

tested in latest vue-tsc.

@johnsoncodehk
Copy link
Member

I can't reproduce the problem, please provide minimal reproduction, and make sure you have update vue-tsc to latest.

@patroza
Copy link
Author

patroza commented Feb 20, 2023

@johnsoncodehk the error seems to come especially with vue-tsc -w, and not with just vue-tsc

5.0.0-beta

@patroza
Copy link
Author

patroza commented Feb 20, 2023

@johnsoncodehk here's a repro
https://github.com/patroza/vue-tsc-repro

npm i
npm run vue-tsc -- -w

Observed

components/some-component.vue:3:11 - error TS7006: Parameter '_' implicitly has an 'any' type.

3     .then(_ => 'test')" />
            ~

Expected

No error. Like in the editor, it seems fine (even with Volar TS version set to node_modules/typescript).
Screenshot 2023-02-20 at 07 59 09

@patroza
Copy link
Author

patroza commented Feb 22, 2023

@johnsoncodehk do you have some pointers, maybe I could help

@patroza
Copy link
Author

patroza commented Mar 16, 2023

@johnsoncodehk in the meantime 5.0 final was released

@patroza patroza changed the title Typescript 5.0 (beta) support Typescript 5.0 support Mar 16, 2023
@segevfiner
Copy link
Contributor

Enabling "verbatimModuleSyntax": true also causes the following error in a plain create-vue@3 project with TS upgraded to TS 5.0.2:

❯ pnpm type-check

> [email protected] type-check /Users/segevfiner/junk/vue-ts5
> vue-tsc --noEmit -p tsconfig.vitest.json --composite false

/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected][email protected]/node_modules/vue-tsc/bin/vue-tsc.js:43
                        throw err;
                        ^

Error: Debug Failure. False expression.
    at isReferencedAliasDeclaration (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:82757:13)
    at canConvertImportDeclarationToTypeOnly (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81296:177)
    at checkImportsForTypeOnlyConversion (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81311:13)
    at checkSourceFileWorker (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81874:11)
    at checkSourceFile (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81822:7)
    at checkSourceFileWithEagerDiagnostics (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81916:7)
    at getDiagnosticsWorker (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81924:9)
    at Object.getDiagnostics2 [as getDiagnostics] (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:81901:16)
    at /Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:116837:78
    at runWithCancellationToken (/Users/segevfiner/junk/vue-ts5/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:116807:16)
 ELIFECYCLE  Command failed with exit code 1.

@segevfiner
Copy link
Contributor

It also seems that vue-tsc --build will randomly fail resolving .vue imports unless ran multiple times.

@blake-newman
Copy link
Member

#2555

This should resolve this issue

@johnsoncodehk johnsoncodehk modified the milestone: 2555 Mar 30, 2023
@johnsoncodehk johnsoncodehk linked a pull request Mar 30, 2023 that will close this issue
@johnsoncodehk johnsoncodehk added bug Something isn't working and removed pending triage labels Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants