Skip to content

Types for "ref sugar (take 2)" not available #521

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
akaufmann opened this issue Sep 23, 2021 · 3 comments
Closed

Types for "ref sugar (take 2)" not available #521

akaufmann opened this issue Sep 23, 2021 · 3 comments
Labels
question Further information is requested

Comments

@akaufmann
Copy link

(Possibly) Since the change from script.refSugar to refTransform, TS complains that the ref sugar (take 2) is unknown. The complaint only occurs in VSC, the bundle runs without errors in the browser.

Bildschirmfoto 2021-09-23 um 16 32 21

PS: Not sure if the type export is missing in Volar or Vue itself.

"volar": "0.27.24"
"vue": "3.2.16"
"@vue/compiler-sfc": "3.2.16"
"typescript": "^4.4.3",
"vite": "2.6.0-beta.2",
@johnsoncodehk
Copy link
Member

You need to config tsconfig types. See https://github.com/vuejs/rfcs/blob/ref-sugar-2/active-rfcs/0000-ref-sugar.md#typescript--tooling-integration.

// tsconfig.json
{
  "compilerOptions": {
    // ...
    "types": ["vue/ref-macros"]
  },
}

@johnsoncodehk johnsoncodehk added the question Further information is requested label Sep 24, 2021
@akaufmann
Copy link
Author

I missed that. Thanks @johnsoncodehk for the hint!

@kfields
Copy link

kfields commented Sep 6, 2022

@johnsoncodehk solution worked until I just rebooted my machine and Visual Studio Code updated.
Now it's back to red squiggles and Cannot find name '$ref'.ts(2304)
I noticed they call it reactivityTransform instead of refTransform now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants