microsoft / microsoft/TypeScript

Type check TS file instead of index.d.ts in node_modules leads to build error that cannot be ignored

Open
#41,487 0 comments 0 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: 4.1 RC

Search Terms: node_module check

Code

Run tsc on this PR:

https://github.com/DimensionDev/Maskbook/pull/1879

Emitting this error (I have skipLibCheck on but tsc is going to read .tssource file not.d.ts` file):

node_modules/promievent/PromiEvent.ts:28:33 - error TS2345: Argument of type '(resolve: Resolve<T>, reject: Reject) => void' is not assignable to parameter of type '(resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void'.
  Types of parameters 'resolve' and 'resolve' are incompatible.
    Types of parameters 'value' and 'value' are incompatible.
      Type 'T | PromiseLike<T> | undefined' is not assignable to type 'T | PromiseLike<T>'.
        Type 'undefined' is not assignable to type 'T | PromiseLike<T>'.

28      this.promise = new Promise<T>(executor)
                                      ~~~~~~~~


Found 1 error.

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

Reproduce the report by running tsc on DimensionDev/Maskbook PR 1879 with TypeScript 4.1 RC and skipLibCheck enabled. Start with the node_modules/promievent/PromiEvent.ts diagnostic and compare why the .ts source is checked instead of the package's index.d.ts. Done means the reported build error is no longer produced under the stated configuration, with regression coverage added if an existing compiler test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
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.