mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 01:48:33 -05:00
@@ -2366,7 +2366,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function verifyCompilerOptions() {
|
||||
if (options.strictPropertyInitialization && !options.strictNullChecks) {
|
||||
if (options.strictPropertyInitialization && !getStrictOptionValue(options, "strictNullChecks")) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
||||
}
|
||||
|
||||
|
||||
@@ -436,6 +436,51 @@ namespace ts {
|
||||
);
|
||||
});
|
||||
|
||||
it("Correctly detects implicitly enabled strictNullChecks ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
strict: true,
|
||||
strictPropertyInitialization: true
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
strict: true,
|
||||
strictPropertyInitialization: true
|
||||
},
|
||||
errors: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("Checks dependency of strict options ", () => {
|
||||
assertCompilerOptions(
|
||||
{
|
||||
compilerOptions: {
|
||||
strict: true,
|
||||
strictNullChecks: false,
|
||||
strictPropertyInitialization: true
|
||||
}
|
||||
}, "tsconfig.json",
|
||||
{
|
||||
compilerOptions: {
|
||||
strict: true,
|
||||
strictNullChecks: false,
|
||||
strictPropertyInitialization: true
|
||||
},
|
||||
errors: [{
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Option 'strictPropertyInitialization' cannot be specified without specifying option 'strictNullChecks'.",
|
||||
code: Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1.code,
|
||||
category: Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1.category
|
||||
}]
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// jsconfig.json
|
||||
it("Convert correctly format jsconfig.json to compiler-options ", () => {
|
||||
assertCompilerOptions(
|
||||
|
||||
Reference in New Issue
Block a user