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

Bad typing preventing typescript compilation without skipLibCheck #357

Closed
smiley-uriux opened this issue Sep 28, 2022 · 4 comments
Closed

Comments

@smiley-uriux
Copy link

Bringing in plop as a dependency to a typescript project that currently does not use "skipLibCheck" fails compilation with the following error:

../../node_modules/node-plop/types/index.d.ts(142,3): error TS2502: 'inquirer' is referenced directly or indirectly in its own type annotation.
../../node_modules/node-plop/types/index.d.ts(142,22): error TS2694: Namespace '"../node_modules/@types/inquirer/index"' has no exported member 'Inquirer'.

This forces users to use "skipLibCheck" or not be able to use this library.

@ju314ter
Copy link

ju314ter commented Oct 6, 2022

Since upgrading from typescript 4.7.4 to typescript 4.8.4, I have a different issue with similar root cause :

node_modules/@types/inquirer/index.d.ts(80,76): error TS2344: Type 'T' does not satisfy the constraint 'Answers'.
node_modules/@types/inquirer/index.d.ts(84,91): error TS2344: Type 'TChoiceMap' does not satisfy the constraint 'Answers'.
node_modules/@types/inquirer/index.d.ts(84,105): error TS2344: Type 'T' does not satisfy the constraint 'Answers'.
node_modules/@types/inquirer/index.d.ts(139,43): error TS2344: Type 'T' does not satisfy the constraint 'Answers'.
node_modules/@types/inquirer/lib/objects/choices.d.ts(11,39): error TS2344: Type 'T' does not satisfy the constraint 'Answers'.
node_modules/@types/inquirer/lib/objects/choices.d.ts(11,61): error TS2344: Type 'T' does not satisfy the constraint 'Answers'.

Even with skipLibCheck build fail because of this.

@amwmedia
Copy link
Member

amwmedia commented Oct 7, 2022

@crutchcorn @cspotcode Any ideas on this?

@smiley-uriux
Copy link
Author

@amwmedia I have a PR out for the original issue, just waiting on it to get merged...

The follow up issue appears to be bad typings in the inquirer DefinitelyTyped typings. My guess is the community will have a fix for that fairly soon. I know typescript 4.8 changed some behavior around {}, forbidding unconstrained generics from being assigned to it. If I had to guess, that's the culprit.

@ju314ter
Copy link

ju314ter commented Oct 7, 2022

I fixed my issue by installing @types/inquirer 9.0.2 tagged ts4.8 as a dev dependency

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

No branches or pull requests

3 participants