Skip to content

[Bug?]: yarn isn't loading @types packages after upgrading TS to 4.8.3 #4872

@michaelfaith

Description

@michaelfaith

Self-service

  • I'd be willing to implement a fix

Describe the bug

This afternoon I upgraded several projects in a monorepo using yarn 3 with pnp, and after upgrading TypeScript from 4.7.4 to 4.8.3, the rollup builds were no longer able to find types for node's path module, the process global object, or types for glob. It's a tiny project, so those are the only types I'm really using. I'm sure if it was a larger project it'd be worse.

To reproduce

This is company repo. If you're unable to reproduce, I can try and create a small public repro. Basically just TypeScript 4.8 using node and glob types, and the latest yarn with pnp

Environment

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11500H @ 2.90GHz
  Binaries:
    Node: 16.14.2 - ~\AppData\Local\Temp\xfs-9b01a4e7\node.CMD
    Yarn: 3.2.3 - ~\AppData\Local\Temp\xfs-9b01a4e7\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD

Additional context

Error messages on build, after upgrade:

src/index.ts → build/cjs/index.js, build/esm/index.js...
[!] (plugin rpt2) Error: src/has-config-file.ts:7:25 - error TS2307: Cannot find module 'path' or its corresponding type declarations.

7 import { resolve } from 'path';
                          ~~~~~~
src/has-config-file.ts:9:18 - error TS2307: Cannot find module 'glob' or its corresponding type declarations.

9 import glob from 'glob';
                   ~~~~~~
src/has-config-file.ts:18:86 - error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

18   const { path: pkgPath } = readNearestPackage() || { packageJson: {}, path: resolve(process.cwd()) };

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaiting for feedbackWill autoclose in a while unless more data are provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions