Warn when a subset of input files have "use strict" with --outFile #11464
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
As per #4270, the supported way to control strict mode when not using ES6 modules is to put
"use strict";
at the top of the file. However, when the--outFile
option is used to concatenate the emitted code for the input files into a single output file, the strict mode of the output file ends up being controlled by the first input file; attempting to enable strict mode on some input files and not others does not work. The compiler could warn if a user tries this by mistake.TypeScript Version: 2.0.3
Code
tsc a.ts b.ts --outFile ab.js
Expected behavior: Semantic error: "Cannot enable strict mode on a subset of input files when using --outFile" or similar.
Actual behavior: No warning and the following output:
So strict mode is enabled on both input files, or neither if the order is reversed.
The text was updated successfully, but these errors were encountered: