Skip to content

[Bug] vscode tsserver crashed when using typescript in a monorepo #1189

Closed
@missing1984

Description

@missing1984
  • [] I'd be willing to implement a fix

Describe the bug

vscode tsserver crashed when having tsconfig.json and typescript installed in a monorepo package (not project root)

error trace.

    Cannot destructure property 'name' of 'object null' as it is null.

    TypeError: Cannot destructure property 'name' of 'object null' as it is null.
        at getPackageInformation (/Users/mluo/workspace/gitlab/monorepo/projects/example/.pnp.js:30630:5)
        at Object.getPackageInformation (/Users/mluo/workspace/gitlab/monorepo/projects/example/.pnp.js:30973:20)
        at getPnpTypeRoots (/Users/mluo/workspace/gitlab/monorepo/projects/example/.yarn/cache/typescript-patch-50eb28f081-2.zip/node_modules/typescript/lib/tsserver.js:28763:42)

To Reproduce

I've created a minimal project that can reproduce this issue.

tsserver_crash.zip

switch to use workspace tsc will soon found it crashed.

Environment if relevant (please complete the following information):

  • OS: [e.g. OSX, Linux, Windows, ...]
    OSX
  • Node version [e.g. 8.15.0, 10.15.1, ...]
node -v
v10.16.2
  • Yarn version [e.g. 2.0.0-rc1, ...]
yarn -v
2.0.0-rc.31

Additional context

Looks like tsc assume tsconfig.json and typescript installed at repo root?

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