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

ref sugar type error when nullable type #4499

Closed
sxzz opened this issue Sep 2, 2021 · 0 comments
Closed

ref sugar type error when nullable type #4499

sxzz opened this issue Sep 2, 2021 · 0 comments

Comments

@sxzz
Copy link
Member

sxzz commented Sep 2, 2021

Version

Vue 3.2.8
TypeScript 4.4.2
vue-tsc 0.3.0

Reproduction link

SFC Playground

Steps to reproduce

Copy to VSCode and enable Volar (or regular TypeScript file)

What is expected?

the error is fixed

What is actually happening?

import { ref } from 'vue';

let msg = $(ref<string | null>(null));
msg = 'hello world';
msg = null;
//  error TS2322: Type 'null' is not assignable to type 'string & { [RefMarker]?: any; }'.
//   Type 'null' is not assignable to type 'string'.

Related issue:
#4433 (comment)
#4433 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant