Skip to content

4.8 regression with tsc --build: error correctly reported, then another execution succeeds #50959

Closed
@glasser

Description

@glasser

Bug Report

Since upgrading to TS4.8, we've seen some surprising behavior around tsc --build where rebuilds don't always seem to happen where we expect them to.

Notably, we've now run into an easy to reproduce case where running tsc --build path/to/tsconfig.json correctly fails with an error, but running the same command again exits 0 with no output. Note that in this case, the project has noEmit and composite set to true (it's a Jest test project).

We have not yet had the opportunity to minimize our project (Apollo Server) but we at least have a commit which reproduces the issue consistently.

This appears to be a 4.8 regression: I can reproduce it with 4.8.2 and 4.8.3 but not 4.7.4.

I'm guessing it might be related to the huge amount of work done on improving these features by @sheetalkamat in #48784 ?

🔎 Search Terms

tsc noEmit error build twice second time

🕗 Version & Regression Information

  • This changed between versions 4.7.4 and 4.8.2

Reproduction

$ git clone -b glasser/ts4.8-errors-inconsistent https://github.com/apollographql/apollo-server
$ cd apollo-server
$ npm i
$ npx tsc --build packages/server/src/__tests__/tsconfig.json
$ npx tsc --build packages/server/src/__tests__/tsconfig.json

🙁 Actual behavior

The first execution of tsc displays this error and exits with status 1:

packages/server/src/__tests__/express/expressSpecific.test.ts:45:21 - error TS2345: Argument of type 'ApolloServer<{ x: number; }>' is not assignable to parameter of type 'ApolloServer<BaseContext>'.
  Property 'x' is missing in type 'BaseContext' but required in type '{ x: number; }'.

45   expressMiddleware(differentContextServer); // hi
                       ~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

But the second execution of tsc exits with status 0 without printing anything.

🙂 Expected behavior

Both executions of tsc should display an error and exit with non-zero status.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions