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

Low Typescript version constraint in peerDependencies #957

Closed
hubvue opened this issue Jan 13, 2022 · 4 comments
Closed

Low Typescript version constraint in peerDependencies #957

hubvue opened this issue Jan 13, 2022 · 4 comments

Comments

@hubvue
Copy link

hubvue commented Jan 13, 2022

Reproduction

Since Pinia uses the new feature Awaited with Typescript version 4.5, and peerDependencies in package.json constrains the Typescript version to >= 4.4.4, when the user Typescript version is 4.4.4 =< user version < 4.5 will report an error

Expected behavior

Everything works as it should

Actual behavior

ERROR in /Users/didi/Documents/code/didi/rainbow-ts-project/node_modules/pinia/dist/pinia.d.ts(701,80):
701:80 Cannot find name 'Awaited'.
    699 |      * value (other than `undefined`) to **override** the returned value.
    700 |      */
  > 701 |     after: (callback: A extends Record<ActionName, _Method> ? (resolvedReturn: Awaited<ReturnType<A[ActionName]>>) => void | ReturnType<A[ActionName]> | Awaited<ReturnType<A[ActionName]>> : () => void) => void;
        |                                                                                ^
    702 |     /**
    703 |      * Sets up a hook if the action fails. Return `false` to catch the error and
    704 |      * stop it fro propagating.
ERROR in /Users/didi/Documents/code/didi/rainbow-ts-project/node_modules/pinia/dist/pinia.d.ts(701,154):
701:154 Cannot find name 'Awaited'.
    699 |      * value (other than `undefined`) to **override** the returned value.
    700 |      */
  > 701 |     after: (callback: A extends Record<ActionName, _Method> ? (resolvedReturn: Awaited<ReturnType<A[ActionName]>>) => void | ReturnType<A[ActionName]> | Awaited<ReturnType<A[ActionName]>> : () => void) => void;
        |                                                                                                                                                          ^
    702 |     /**
    703 |      * Sets up a hook if the action fails. Return `false` to catch the error and
    704 |      * stop it fro propagating.
Version: typescript 4.4.4

Additional information

pinia version: 2.0.9
typescript version: 4.4.4

@posva
Copy link
Member

posva commented Jan 14, 2022

let's bump the peer dep

@hubvue
Copy link
Author

hubvue commented Jan 17, 2022

@posva I remember that in version 2.0.6 it was released to solve the typescript peer dep, relaxing the typescript peer version, the source of the problem was an issue #874 raised by sodatea, in version 2.0.9 is it necessary to release a minor version to solve the problem.

@posva
Copy link
Member

posva commented Jan 17, 2022

That's true. Let's polyfill the Awaited type then and I will release a patch version

@hubvue
Copy link
Author

hubvue commented Jan 18, 2022

@posva Thanks

@posva posva closed this as completed in 7c51126 Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants