Skip to content

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

Closed
@headhunter45

Description

@headhunter45

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions