Skip to content

Generic Ref typings errors #2005

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
noook opened this issue Aug 28, 2020 · 2 comments
Closed

Generic Ref typings errors #2005

noook opened this issue Aug 28, 2020 · 2 comments

Comments

@noook
Copy link

noook commented Aug 28, 2020

Version

3.0.0-rc.9

Reproduction link

https://codesandbox.io/s/bold-fermat-28wgn?file=/src/composition/paginate.ts

Steps to reproduce

Just check the typings errors in the editor, especially at line 28 and 41

What is expected?

my dataTransformer function that returns T[] should be able to assign its return value to data.value

What is actually happening?

Impossible, typings don't allow me to do that.


This code used to work in @vue/composition-api on version 0.6.

I probably don't understand how some typings work, or maybe I need to cast some values differently.

@pikax
Copy link
Member

pikax commented Aug 28, 2020

Generics and ref, you need to cast to T

Check #1129

And microsoft/TypeScript#33942

Also Vue 3 docs https://v3.vuejs.org/guide/typescript-support.html#typing-refs

@noook
Copy link
Author

noook commented Aug 29, 2020

Ohhh that helped a lot. Thank you very much.

@noook noook closed this as completed Aug 29, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 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

2 participants