Skip to content

Typescript and noEmitOnError regressions/issues #2023

Description

@dhouck

Expected Behavior

When noEmitOnError is set, running npm run build (set to rollup -c rollup.config.js) should show all typecheck errors approximately as tsc does, and then fail. Similarly, npm run watch (set to rollup -c rollup.config.js -w) should keep watching even if there are typecheck errors.

Actual Behavior

When npm run build is run, it displays the first typecheck error and then crashes (with a stack trace that takes up several lines of console space, meaning you have to scroll up to see the one error, but I think thatʼs a different issue). It does not display other errors.

When npm run watch is run, it shows just one error (and long stacktrace) and then looks like itʼs going to continue watching, but when you change the file in a way that still fails to typecheck it crashes immediately. If you change the file in a way that does typecheck, then the watch process neither produces any output to the terminal nor actually builds the file.

Additional Information

I added a typecheck script so npm run typecheck can show you all the errors not just the first.

Several previous issues (#255, #258, #272, #492) recommend turning off noEmitOnError at least during a rollup --watch, and at least one PR (#544) claims to do that. I donʼt find that a good fix for a few reasons

  • The README says that used to be an issue but that itʼs now fine to turn on noEmitOnError
  • I do not want to ever emit javascript I know is bad; I do not want to accidentally run it if I fail to pay attention to the window where rollup --watch is running, and I do not want to accidentally build it and then not realize I have known-bad code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions