Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow isolatedModules: true with noEmitOnError: true #31012

Closed
4 tasks done
mheiber opened this issue Apr 18, 2019 · 2 comments · Fixed by #31043
Closed
4 tasks done

Allow isolatedModules: true with noEmitOnError: true #31012

mheiber opened this issue Apr 18, 2019 · 2 comments · Fixed by #31043
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@mheiber
Copy link
Contributor

mheiber commented Apr 18, 2019

Search Terms

  • isolatedModules
  • noEmitOnError

Suggestion

Allow isolatedModules: true with noEmitOnError: true

Use Cases

What do you want to use this for?

My understanding of the purpose of isolatedModules: true is that it does extra validation to ensure that separate compilation is safe. We want to use it for that purpose.

Allowing emit in the presence of errors is contrary to that goal. We're doing the validation to stop dangerous code from getting through.

What shortcomings exist with current approaches?

We use TypeScript in our compilation pipeline.

The only workaround I can think of is some hack to compile to a different location and copy files over once checks pass. This doesn't seem great for watch mode, and could be error-prone or racy.

Examples

tsconfig.json:

{
    "compilerOptions": {
        "noEmitOnError": true,
        "isolatedModules": true,
    }
}

Actual behavior: tsconfig.json(5,9): error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.

Expected behavior: no error message, just works

Checklist

My suggestion meets these guidelines:

  • [x ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@RyanCavanaugh RyanCavanaugh added Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript labels Apr 18, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 18, 2019
@RyanCavanaugh
Copy link
Member

I think this restriction was added during the period of time in which we were confused about isolatedModules meant, and can be trivially removed

mheiber added a commit to mheiber/TypeScript that referenced this issue Apr 19, 2019
fix microsoft#31012

Since the purpose of isolatedModules: true is to
do extra validation to ensure that separate
compilation is safe

Allowing emit in the presence of errors is
compatible with that intention.
mheiber added a commit to mheiber/TypeScript that referenced this issue Apr 19, 2019
fix microsoft#31012

Since the purpose of isolatedModules: true is to
do extra validation to ensure that separate
compilation is safe

Allowing emit in the presence of errors is
compatible with that intention.
mheiber added a commit to mheiber/TypeScript that referenced this issue Apr 19, 2019
fix microsoft#31012

Since the purpose of isolatedModules: true is to
do extra validation to ensure that separate
compilation is safe

Allowing emit in the presence of errors is
compatible with that intention.

Signed-off-by: Max Heiber <max.heiber@gmail.com>
mheiber added a commit to mheiber/TypeScript that referenced this issue Apr 19, 2019
fix microsoft#31012

Since the purpose of isolatedModules: true is to
do extra validation to ensure that separate
compilation is safe

Allowing emit in the presence of errors is
compatible with that intention.

Signed-off-by: Max Heiber <max.heiber@gmail.com>
@mheiber
Copy link
Contributor Author

mheiber commented Apr 19, 2019

Thanks Ryan!

Opening a PR for this change

mheiber added a commit to bloomberg/TypeScript that referenced this issue Apr 20, 2019
fix microsoft#31012

Since the purpose of isolatedModules: true is to
do extra validation to ensure that separate
compilation is safe

Allowing emit in the presence of errors is
compatible with that intention.

Signed-off-by: Max Heiber <max.heiber@gmail.com>
RyanCavanaugh pushed a commit that referenced this issue Apr 25, 2019
fix #31012

Since the purpose of isolatedModules: true is to
do extra validation to ensure that separate
compilation is safe

Allowing emit in the presence of errors is
compatible with that intention.

Signed-off-by: Max Heiber <max.heiber@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants