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

[Bug?]: TypeScript 5.6.2 can't find @types when using PnP. #6513

Closed
1 task done
headhunter45 opened this issue Sep 20, 2024 · 2 comments
Closed
1 task done

[Bug?]: TypeScript 5.6.2 can't find @types when using PnP. #6513

headhunter45 opened this issue Sep 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@headhunter45
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

The PnP compatibility patch for TypeScript doesn't apply to [email protected]. I tested versions 5.5.4 as well and it worked as expected. I'm not sure how to install the beta or rc versions of typescript so I can't check 5.6.0 and 5.6.1 myself.
I believe it to be the same issue this pr fixed, but for the new version #6349 and that a new patch needs to be generated.

Specifically yarn tsc no longer sees '@types/' references with this version of typescript.

I've never worked in this repo before, but I'm willing to try a pr this weekend if I can figure it out in a couple of hours. If not, then I probably won't have time myself.

To reproduce

package.json

{
  "name": "tmp_project",
  "packageManager": "[email protected]",
  "dependencies": {
    "@types/node": "^22.5.5",
    "typescript": "5.6.0"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es2016",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    "module": "commonjs",                                /* Specify what module code is generated. */
    "esModuleInterop": true,                             /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
    "forceConsistentCasingInFileNames": true,            /* Ensure that casing is correct in imports. */
    "strict": true,                                      /* Enable all strict type-checking options. */
    "skipLibCheck": true                                 /* Skip type checking all .d.ts files. */
  }
}

index.ts

/// <reference types="node" />

Run yarn install and then yarn tsc. You will get an error that the node types cannot be found. If you change the typescript version to 5.6.2 then it builds an index.js file without errors.

Environment

System:
    OS: Linux 5.15 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
  Binaries:
    Node: 20.17.0 - /tmp/xfs-68206414/node
    Yarn: 4.3.1 - /tmp/xfs-68206414/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm

Additional context

No response

@headhunter45 headhunter45 added the bug Something isn't working label Sep 20, 2024
@xanderim
Copy link

xanderim commented Oct 9, 2024

I had the same issue with yarn 4.4.0, but upgrading to 4.5.0 fixed it.

@retrixe
Copy link

retrixe commented Oct 10, 2024

Just tried this, can confirm Yarn 4.5.0 fixes the issue for me as well

@arcanis arcanis closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants