microsoft / microsoft/TypeScript

SkipLibCheck fails to work in multi-project set-up

Open
#36,503 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.8. Beta

Search Terms:
skiplibcheck

Steps to reproduce

  1. Extract the attached zip file to a folder and open repro.sln in Visual Studio (I'm using 2019)
  2. Expand the npm folder on project B and install the missing @azure/storage-blob package.
  3. Rebuild the solution.

Expected behavior:
No build errors.

Actual behavior:
2 errors:

error TS2740: Build:Type 'Buffer' is missing the following properties...
error TS2345: Build:Argument of type 'ErrnoException' is not assignable...

Explanation
We want have a custom definition for NodeJS. The npm package imported in Project B also has its own (incomplete) definition. So, we've added skiplibcheck to all the projects.

Project B builds fine by itself.

Project C references some NodeJS types. Project C also builds fine by itself.

Project A references types from both B and C.

When attempting to build A, we get the error above. But the error is for project C.

Basically, when building Project A, the skiplibcheck option is being ignored and the incomplete NodeJS definition from the imported package is being used.

Further Observations
Curiously, if file A/foo/bar.ts is moved to A/bar.ts (and the imports amended) the build compiles fine.

Attachment
Repro.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Extract Repro.zip and open repro.sln in Visual Studio, then rebuild the solution with projects A, B, and C. Compare the behavior when A/foo/bar.ts is moved to A/bar.ts and inspect the project settings around skiplibcheck. Done means the multi-project build completes without the reported TS2740 and TS2345 errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.