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

Typescript error in package after using pnpm (which does not occur with yarn or npm) #2317

Closed
jeffrson opened this issue Feb 2, 2020 · 5 comments

Comments

@jeffrson
Copy link

jeffrson commented Feb 2, 2020

Hi,

here's a demo repo to show a bug related to typescript:
https://github.com/jeffrson/pnmp_vs_yarn_typescript

When I use yarn, tsc works without issues.

However, when I install modules with pnmp, tsc complains about missing type annotation.

Of course, I could add the type, but IMO it shouldn't matter, whether I use yarn or pnmp and work the same in both cases.

pnpm version:

4.9.0

Code to reproduce the issue:

https://github.com/jeffrson/pnmp_vs_yarn_typescript

node

12.14.1

OS

Windows 10

@jeffrson jeffrson changed the title Typescript error in package after using pnpm (which does not occur with yarn) Typescript error in package after using pnpm (which does not occur with yarn or npm) Feb 2, 2020
@zkochan
Copy link
Member

zkochan commented Feb 3, 2020

Might be a Typescript issue? (microsoft/TypeScript#29808)

It also happens with Yarn v2.

And even when using pnpm install --shamefully-hoist

@jeffrson
Copy link
Author

jeffrson commented Feb 4, 2020

Well, that's interesting. I had tried with NODE_OPTIONS="--preserve-symlinks" (just in case), but to no avail.

Although in yarnv2 there are no symlinks involved, in both cases the actually used modules are located outside of the working directory.

The error goes away, as soon as I set "declaration": false in tsconfig.json. So it is related to the creation of d.ts which wasn't obvious to me (and yes, I had searched for the error message).

Sorry, then. Closing here.

@jeffrson jeffrson closed this as completed Feb 4, 2020
@hemedani
Copy link

hemedani commented Feb 6, 2020

I have the same issue with Apollo react hooks

@jakerr
Copy link

jakerr commented May 8, 2022

I'm experiencing a similar issue in nodegui/react-nodegui where yarn && yarn build works but pnpm i && pnpm build gives me typescript errors such as:

node_modules/.pnpm/@types+react@18.0.9/node_modules/@types/react/index.d.ts:3226:13 - error TS2717: Subsequent property declarations must have the same type.  Property 'script' must be of type 'DetailedHTMLProps<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>', but here has type 'DetailedHTMLProps<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>'.

--shamefully-hoist did actually cut the errors down from 181 to 4 that are like:

src/demo.tsx:13:10 - error TS2559: Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes & ViewProps<QWidgetSignals>'.
13         <View>

I'm pretty lost on the how tsc produces different errors based on the node_modules layout. Are we somehow resolving a different tsc version in different cases?

Just thought I'd add the detail of another project where this is reproducible in case it might help in debugging.

@abubakir1997
Copy link

Error still existing...

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

5 participants