mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Respond to code review comments
This commit is contained in:
@@ -5385,7 +5385,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Fall back to any.
|
||||
if (compilerOptions.noImplicitAny && (compilerOptions.suppress & ErrorGroup.ImplicitAnyIndex) === 0 && objectType !== anyType) {
|
||||
if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && objectType !== anyType) {
|
||||
error(node, Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,11 @@ module ts {
|
||||
description: Diagnostics.Redirect_output_structure_to_the_directory,
|
||||
paramType: Diagnostics.DIRECTORY,
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
type: "boolean",
|
||||
@@ -104,6 +109,11 @@ module ts {
|
||||
description: Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
|
||||
paramType: Diagnostics.LOCATION,
|
||||
},
|
||||
{
|
||||
name: "suppressImplicitAnyIndexErrors",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Suppress_noImplicitAny_errors_for_indexing_into_objects_lacking_index_signatures,
|
||||
},
|
||||
{
|
||||
name: "target",
|
||||
shortName: "t",
|
||||
@@ -124,18 +134,6 @@ module ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Watch_input_files,
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
|
||||
},
|
||||
{
|
||||
name: "suppress",
|
||||
type: { "implicitanyindex": ErrorGroup.ImplicitAnyIndex},
|
||||
description: Diagnostics.Suppress_a_set_of_compiler_checks,
|
||||
paramType: Diagnostics.ERRORGROUP,
|
||||
error: Diagnostics.Argument_for_suppress_option_can_only_be_implicitAnyIndex
|
||||
},
|
||||
];
|
||||
|
||||
var shortOptionNames: Map<string> = {};
|
||||
|
||||
@@ -398,7 +398,6 @@ module ts {
|
||||
VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" },
|
||||
LOCATION: { code: 6037, category: DiagnosticCategory.Message, key: "LOCATION" },
|
||||
DIRECTORY: { code: 6038, category: DiagnosticCategory.Message, key: "DIRECTORY" },
|
||||
ERRORGROUP: { code: 6039, category: DiagnosticCategory.Message, key: "ERRORGROUP" },
|
||||
Compilation_complete_Watching_for_file_changes: { code: 6042, category: DiagnosticCategory.Message, key: "Compilation complete. Watching for file changes." },
|
||||
Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
@@ -412,8 +411,7 @@ module ts {
|
||||
Warn_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Warn on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
Suppress_a_set_of_compiler_checks: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress a set of compiler checks." },
|
||||
Argument_for_suppress_option_can_only_be_implicitAnyIndex: { code: 6056, category: DiagnosticCategory.Error, key: "Argument for '--suppress' option can only be 'implicitAnyIndex'." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_into_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing into objects lacking index signatures." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
|
||||
@@ -1591,10 +1591,6 @@
|
||||
"category": "Message",
|
||||
"code": 6038
|
||||
},
|
||||
"ERRORGROUP": {
|
||||
"category": "Message",
|
||||
"code": 6039
|
||||
},
|
||||
"Compilation complete. Watching for file changes.": {
|
||||
"category": "Message",
|
||||
"code": 6042
|
||||
@@ -1647,15 +1643,10 @@
|
||||
"category": "Error",
|
||||
"code": 6054
|
||||
},
|
||||
"Suppress a set of compiler checks.": {
|
||||
"Suppress noImplicitAny errors for indexing into objects lacking index signatures.": {
|
||||
"category": "Message",
|
||||
"code": 6055
|
||||
},
|
||||
"Argument for '--suppress' option can only be 'implicitAnyIndex'.": {
|
||||
"category": "Error",
|
||||
"code": 6056
|
||||
},
|
||||
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
|
||||
@@ -1356,6 +1356,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
@@ -1373,15 +1374,14 @@ module ts {
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
preserveConstEnums?: boolean;
|
||||
removeComments?: boolean;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
preserveConstEnums?: boolean;
|
||||
allowNonTsExtensions?: boolean;
|
||||
suppress?: ErrorGroup;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
@@ -1557,10 +1557,6 @@ module ts {
|
||||
verticalTab = 0x0B, // \v
|
||||
}
|
||||
|
||||
export const enum ErrorGroup {
|
||||
ImplicitAnyIndex = 0x01
|
||||
}
|
||||
|
||||
export interface CancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
}
|
||||
|
||||
@@ -778,13 +778,8 @@ module Harness {
|
||||
options.preserveConstEnums = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'suppress':
|
||||
if (typeof setting.value === 'string' && setting.value.toLowerCase() === 'implicitanyindex') {
|
||||
options.suppress = ts.ErrorGroup.ImplicitAnyIndex;
|
||||
}
|
||||
else {
|
||||
throw new Error('Unkown value for suppress ' + setting.value);
|
||||
}
|
||||
case 'suppressimplicitanyindexerrors':
|
||||
options.suppressImplicitAnyIndexErrors = setting.value === 'true';
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1172,7 +1167,7 @@ module Harness {
|
||||
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "suppress"];
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "suppressimplicitanyindexerrors"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//@noImplicitAny: true
|
||||
//@suppress: implicitAnyIndex
|
||||
//@suppressImplicitAnyIndexErrors: true
|
||||
|
||||
enum MyEmusEnum {
|
||||
emu
|
||||
|
||||
Reference in New Issue
Block a user