@@ -56,7 +56,9 @@ namespace ts {
5656 const modulekind = getEmitModuleKind(compilerOptions);
5757 const noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;
5858 const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System;
59- const strictNullChecks = compilerOptions.strictNullChecks;
59+ const strictNullChecks = compilerOptions.strictNullChecks === undefined ? compilerOptions.strict : compilerOptions.strictNullChecks;
60+ const noImplicitAny = compilerOptions.noImplicitAny === undefined ? compilerOptions.strict : compilerOptions.noImplicitAny;
61+ const noImplicitThis = compilerOptions.noImplicitThis === undefined ? compilerOptions.strict : compilerOptions.noImplicitThis;
6062
6163 const emitResolver = createResolver();
6264
@@ -1571,7 +1573,7 @@ namespace ts {
15711573 error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName);
15721574 return undefined;
15731575 }
1574- else if (compilerOptions. noImplicitAny && moduleNotFoundError) {
1576+ else if (noImplicitAny && moduleNotFoundError) {
15751577 error(errorNode,
15761578 Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,
15771579 moduleReference,
@@ -3414,7 +3416,7 @@ namespace ts {
34143416 return addOptionality(declaredType, /*optional*/ declaration.questionToken && includeOptionality);
34153417 }
34163418
3417- if ((compilerOptions. noImplicitAny || declaration.flags & NodeFlags.JavaScriptFile) &&
3419+ if ((noImplicitAny || declaration.flags & NodeFlags.JavaScriptFile) &&
34183420 declaration.kind === SyntaxKind.VariableDeclaration && !isBindingPattern(declaration.name) &&
34193421 !(getCombinedModifierFlags(declaration) & ModifierFlags.Export) && !isInAmbientContext(declaration)) {
34203422 // If --noImplicitAny is on or the declaration is in a Javascript file,
@@ -3516,7 +3518,7 @@ namespace ts {
35163518 if (isBindingPattern(element.name)) {
35173519 return getTypeFromBindingPattern(<BindingPattern>element.name, includePatternInType, reportErrors);
35183520 }
3519- if (reportErrors && compilerOptions. noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) {
3521+ if (reportErrors && noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) {
35203522 reportImplicitAnyError(element, anyType);
35213523 }
35223524 return anyType;
@@ -3614,7 +3616,7 @@ namespace ts {
36143616 type = declaration.dotDotDotToken ? anyArrayType : anyType;
36153617
36163618 // Report implicit any errors unless this is a private property within an ambient declaration
3617- if (reportErrors && compilerOptions. noImplicitAny) {
3619+ if (reportErrors && noImplicitAny) {
36183620 if (!declarationBelongsToPrivateAmbientMember(declaration)) {
36193621 reportImplicitAnyError(declaration, type);
36203622 }
@@ -3733,7 +3735,7 @@ namespace ts {
37333735 }
37343736 // Otherwise, fall back to 'any'.
37353737 else {
3736- if (compilerOptions. noImplicitAny) {
3738+ if (noImplicitAny) {
37373739 if (setter) {
37383740 error(setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
37393741 }
@@ -3748,7 +3750,7 @@ namespace ts {
37483750 }
37493751 if (!popTypeResolution()) {
37503752 type = anyType;
3751- if (compilerOptions. noImplicitAny) {
3753+ if (noImplicitAny) {
37523754 const getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
37533755 error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
37543756 }
@@ -3831,7 +3833,7 @@ namespace ts {
38313833 return unknownType;
38323834 }
38333835 // Otherwise variable has initializer that circularly references the variable itself
3834- if (compilerOptions. noImplicitAny) {
3836+ if (noImplicitAny) {
38353837 error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
38363838 symbolToString(symbol));
38373839 }
@@ -5592,7 +5594,7 @@ namespace ts {
55925594 }
55935595 if (!popTypeResolution()) {
55945596 type = anyType;
5595- if (compilerOptions. noImplicitAny) {
5597+ if (noImplicitAny) {
55965598 const declaration = <Declaration>signature.declaration;
55975599 if (declaration.name) {
55985600 error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(declaration.name));
@@ -6552,7 +6554,7 @@ namespace ts {
65526554 return indexInfo.type;
65536555 }
65546556 if (accessExpression && !isConstEnumObjectType(objectType)) {
6555- if (compilerOptions. noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
6557+ if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
65566558 if (getIndexTypeOfType(objectType, IndexKind.Number)) {
65576559 error(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number);
65586560 }
@@ -9146,7 +9148,7 @@ namespace ts {
91469148 }
91479149
91489150 function reportErrorsFromWidening(declaration: Declaration, type: Type) {
9149- if (produceDiagnostics && compilerOptions. noImplicitAny && type.flags & TypeFlags.ContainsWideningType) {
9151+ if (produceDiagnostics && noImplicitAny && type.flags & TypeFlags.ContainsWideningType) {
91509152 // Report implicit any error within type if possible, otherwise report error on declaration
91519153 if (!reportWideningErrorsInType(type)) {
91529154 reportImplicitAnyError(declaration, type);
@@ -11056,7 +11058,7 @@ namespace ts {
1105611058 // control flow based type does include undefined.
1105711059 if (type === autoType || type === autoArrayType) {
1105811060 if (flowType === autoType || flowType === autoArrayType) {
11059- if (compilerOptions. noImplicitAny) {
11061+ if (noImplicitAny) {
1106011062 error(declaration.name, Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType));
1106111063 error(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType));
1106211064 }
@@ -11326,7 +11328,7 @@ namespace ts {
1132611328 }
1132711329 }
1132811330
11329- if (compilerOptions. noImplicitThis) {
11331+ if (noImplicitThis) {
1133011332 // With noImplicitThis, functions may not reference 'this' if it has type 'any'
1133111333 error(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
1133211334 }
@@ -12599,7 +12601,7 @@ namespace ts {
1259912601 return links.resolvedSymbol = unknownSymbol;
1260012602 }
1260112603 else {
12602- if (compilerOptions. noImplicitAny) {
12604+ if (noImplicitAny) {
1260312605 error(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements);
1260412606 }
1260512607 return links.resolvedSymbol = unknownSymbol;
@@ -12987,7 +12989,7 @@ namespace ts {
1298712989 }
1298812990
1298912991 if (jsxElementType === undefined) {
12990- if (compilerOptions. noImplicitAny) {
12992+ if (noImplicitAny) {
1299112993 error(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
1299212994 }
1299312995 }
@@ -14810,7 +14812,7 @@ namespace ts {
1481014812 if (funcSymbol && funcSymbol.members && funcSymbol.flags & SymbolFlags.Function) {
1481114813 return getInferredClassType(funcSymbol);
1481214814 }
14813- else if (compilerOptions. noImplicitAny) {
14815+ else if (noImplicitAny) {
1481414816 error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
1481514817 }
1481614818 return anyType;
@@ -15070,7 +15072,7 @@ namespace ts {
1507015072 const iterableIteratorAny = functionFlags & FunctionFlags.Async
1507115073 ? createAsyncIterableIteratorType(anyType) // AsyncGenerator function
1507215074 : createIterableIteratorType(anyType); // Generator function
15073- if (compilerOptions. noImplicitAny) {
15075+ if (noImplicitAny) {
1507415076 error(func.asteriskToken,
1507515077 Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type, typeToString(iterableIteratorAny));
1507615078 }
@@ -16619,7 +16621,7 @@ namespace ts {
1661916621
1662016622 if (produceDiagnostics) {
1662116623 checkCollisionWithArgumentsInGeneratedCode(node);
16622- if (compilerOptions. noImplicitAny && !node.type) {
16624+ if (noImplicitAny && !node.type) {
1662316625 switch (node.kind) {
1662416626 case SyntaxKind.ConstructSignature:
1662516627 error(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
@@ -17921,7 +17923,7 @@ namespace ts {
1792117923 if (produceDiagnostics && !node.type) {
1792217924 // Report an implicit any error if there is no body, no explicit return type, and node is not a private method
1792317925 // in an ambient context
17924- if (compilerOptions. noImplicitAny && nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) {
17926+ if (noImplicitAny && nodeIsMissing(node.body) && !isPrivateWithinAmbient(node)) {
1792517927 reportImplicitAnyError(node, anyType);
1792617928 }
1792717929
0 commit comments