Merge pull request #5410 from kenhowardpdx/es6-source-order

Fixed ES6 Source Order
This commit is contained in:
Mohamed Hegazy 2015-10-27 10:24:25 -07:00
commit 6d9e7938dc
11 changed files with 182880 additions and 182760 deletions

View file

@ -164,7 +164,7 @@ var librarySourceMap = [
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], }, { target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
{ target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], }, { target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]}, { target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }, { target: "lib.es6.d.ts", sources: ["es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
]; ];
var libraryTargets = librarySourceMap.map(function (f) { var libraryTargets = librarySourceMap.map(function (f) {

2
lib/lib.core.d.ts vendored
View file

@ -1225,7 +1225,7 @@ interface ArrayBuffer {
interface ArrayBufferConstructor { interface ArrayBufferConstructor {
prototype: ArrayBuffer; prototype: ArrayBuffer;
new (byteLength: number): ArrayBuffer; new (byteLength: number): ArrayBuffer;
isView(arg: any): boolean; isView(arg: any): arg is ArrayBufferView;
} }
declare var ArrayBuffer: ArrayBufferConstructor; declare var ArrayBuffer: ArrayBufferConstructor;

View file

@ -1225,7 +1225,7 @@ interface ArrayBuffer {
interface ArrayBufferConstructor { interface ArrayBufferConstructor {
prototype: ArrayBuffer; prototype: ArrayBuffer;
new (byteLength: number): ArrayBuffer; new (byteLength: number): ArrayBuffer;
isView(arg: any): boolean; isView(arg: any): arg is ArrayBufferView;
} }
declare var ArrayBuffer: ArrayBufferConstructor; declare var ArrayBuffer: ArrayBufferConstructor;

2
lib/lib.d.ts vendored
View file

@ -1225,7 +1225,7 @@ interface ArrayBuffer {
interface ArrayBufferConstructor { interface ArrayBufferConstructor {
prototype: ArrayBuffer; prototype: ArrayBuffer;
new (byteLength: number): ArrayBuffer; new (byteLength: number): ArrayBuffer;
isView(arg: any): boolean; isView(arg: any): arg is ArrayBufferView;
} }
declare var ArrayBuffer: ArrayBufferConstructor; declare var ArrayBuffer: ArrayBufferConstructor;

2632
lib/lib.es6.d.ts vendored

File diff suppressed because it is too large Load diff

View file

@ -709,15 +709,13 @@ var ts;
} }
ts.objectAllocator = { ts.objectAllocator = {
getNodeConstructor: function (kind) { getNodeConstructor: function (kind) {
function Node() { function Node(pos, end) {
this.pos = pos;
this.end = end;
this.flags = 0;
this.parent = undefined;
} }
Node.prototype = { Node.prototype = { kind: kind };
kind: kind,
pos: -1,
end: -1,
flags: 0,
parent: undefined
};
return Node; return Node;
}, },
getSymbolConstructor: function () { return Symbol; }, getSymbolConstructor: function () { return Symbol; },
@ -748,9 +746,10 @@ var ts;
})(Debug = ts.Debug || (ts.Debug = {})); })(Debug = ts.Debug || (ts.Debug = {}));
function copyListRemovingItem(item, list) { function copyListRemovingItem(item, list) {
var copiedList = []; var copiedList = [];
for (var i = 0, len = list.length; i < len; i++) { for (var _i = 0; _i < list.length; _i++) {
if (list[i] !== item) { var e = list[_i];
copiedList.push(list[i]); if (e !== item) {
copiedList.push(e);
} }
} }
return copiedList; return copiedList;
@ -1053,7 +1052,7 @@ var ts;
}; };
}, },
watchDirectory: function (path, callback, recursive) { watchDirectory: function (path, callback, recursive) {
return _fs.watch(path, { persisten: true, recursive: !!recursive }, function (eventName, relativeFileName) { return _fs.watch(path, { persistent: true, recursive: !!recursive }, function (eventName, relativeFileName) {
if (eventName === "rename") { if (eventName === "rename") {
callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName)));
} }
@ -1263,7 +1262,7 @@ var ts;
Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." },
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." },
Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es2015' when targeting 'ES5' or lower." },
Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." },
@ -1511,7 +1510,6 @@ var ts;
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." },
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." },
@ -1537,6 +1535,7 @@ var ts;
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." },
JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX expressions must have one parent element" },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@ -1617,7 +1616,7 @@ var ts;
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." },
Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." },
Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." },
Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." },
@ -1632,8 +1631,8 @@ var ts;
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" },
Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" },
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." },
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." },
Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." },
@ -1654,8 +1653,8 @@ var ts;
Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'." },
Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." },
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
@ -3859,15 +3858,15 @@ var ts;
return node.end - node.pos; return node.end - node.pos;
} }
ts.getFullWidth = getFullWidth; ts.getFullWidth = getFullWidth;
function arrayIsEqualTo(arr1, arr2, comparer) { function arrayIsEqualTo(array1, array2, equaler) {
if (!arr1 || !arr2) { if (!array1 || !array2) {
return arr1 === arr2; return array1 === array2;
} }
if (arr1.length !== arr2.length) { if (array1.length !== array2.length) {
return false; return false;
} }
for (var i = 0; i < arr1.length; ++i) { for (var i = 0; i < array1.length; ++i) {
var equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];
if (!equals) { if (!equals) {
return false; return false;
} }
@ -5089,7 +5088,7 @@ var ts;
} }
ts.nodeIsSynthesized = nodeIsSynthesized; ts.nodeIsSynthesized = nodeIsSynthesized;
function createSynthesizedNode(kind, startsOnNewLine) { function createSynthesizedNode(kind, startsOnNewLine) {
var node = ts.createNode(kind); var node = ts.createNode(kind, -1, -1);
node.startsOnNewLine = startsOnNewLine; node.startsOnNewLine = startsOnNewLine;
return node; return node;
} }
@ -5776,16 +5775,6 @@ var ts;
} }
} }
ts.getTypeParameterOwner = getTypeParameterOwner; ts.getTypeParameterOwner = getTypeParameterOwner;
function arrayStructurallyIsEqualTo(array1, array2) {
if (!array1 || !array2) {
return false;
}
if (array1.length !== array2.length) {
return false;
}
return ts.arrayIsEqualTo(array1.sort(), array2.sort());
}
ts.arrayStructurallyIsEqualTo = arrayStructurallyIsEqualTo;
})(ts || (ts = {})); })(ts || (ts = {}));
var ts; var ts;
(function (ts) { (function (ts) {
@ -5795,8 +5784,8 @@ var ts;
return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind));
} }
ts.getNodeConstructor = getNodeConstructor; ts.getNodeConstructor = getNodeConstructor;
function createNode(kind) { function createNode(kind, pos, end) {
return new (getNodeConstructor(kind))(); return new (getNodeConstructor(kind))(pos, end);
} }
ts.createNode = createNode; ts.createNode = createNode;
function visitNode(cbNode, node) { function visitNode(cbNode, node) {
@ -6525,13 +6514,10 @@ var ts;
} }
function createNode(kind, pos) { function createNode(kind, pos) {
nodeCount++; nodeCount++;
var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))();
if (!(pos >= 0)) { if (!(pos >= 0)) {
pos = scanner.getStartPos(); pos = scanner.getStartPos();
} }
node.pos = pos; return new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(pos, pos);
node.end = pos;
return node;
} }
function finishNode(node, end) { function finishNode(node, end) {
node.end = end === undefined ? scanner.getStartPos() : end; node.end = end === undefined ? scanner.getStartPos() : end;
@ -8084,17 +8070,32 @@ var ts;
} }
function parseJsxElementOrSelfClosingElement(inExpressionContext) { function parseJsxElementOrSelfClosingElement(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
var result;
if (opening.kind === 235) { if (opening.kind === 235) {
var node = createNode(233, opening.pos); var node = createNode(233, opening.pos);
node.openingElement = opening; node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement.tagName); node.children = parseJsxChildren(node.openingElement.tagName);
node.closingElement = parseJsxClosingElement(inExpressionContext); node.closingElement = parseJsxClosingElement(inExpressionContext);
return finishNode(node); result = finishNode(node);
} }
else { else {
ts.Debug.assert(opening.kind === 234); ts.Debug.assert(opening.kind === 234);
return opening; result = opening;
} }
if (inExpressionContext && token === 25) {
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
var badNode = createNode(181, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
badNode.operatorToken = createMissingNode(24, false, undefined);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
}
return result;
} }
function parseJsxText() { function parseJsxText() {
var node = createNode(236, scanner.getStartPos()); var node = createNode(236, scanner.getStartPos());
@ -12632,22 +12633,27 @@ var ts;
} }
return type.resolvedBaseConstructorType; return type.resolvedBaseConstructorType;
} }
function hasClassBaseType(type) {
return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32); });
}
function getBaseTypes(type) { function getBaseTypes(type) {
var isClass = type.symbol.flags & 32;
var isInterface = type.symbol.flags & 64;
if (!type.resolvedBaseTypes) { if (!type.resolvedBaseTypes) {
if (type.symbol.flags & 32) { if (!isClass && !isInterface) {
ts.Debug.fail("type must be class or interface");
}
if (isClass) {
resolveBaseTypesOfClass(type); resolveBaseTypesOfClass(type);
} }
else if (type.symbol.flags & 64) { if (isInterface) {
resolveBaseTypesOfInterface(type); resolveBaseTypesOfInterface(type);
} }
else {
ts.Debug.fail("type must be class or interface");
}
} }
return type.resolvedBaseTypes; return type.resolvedBaseTypes;
} }
function resolveBaseTypesOfClass(type) { function resolveBaseTypesOfClass(type) {
type.resolvedBaseTypes = emptyArray; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
var baseContructorType = getBaseConstructorTypeOfClass(type); var baseContructorType = getBaseConstructorTypeOfClass(type);
if (!(baseContructorType.flags & 80896)) { if (!(baseContructorType.flags & 80896)) {
return; return;
@ -12676,10 +12682,15 @@ var ts;
error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
return; return;
} }
type.resolvedBaseTypes = [baseType]; if (type.resolvedBaseTypes === emptyArray) {
type.resolvedBaseTypes = [baseType];
}
else {
type.resolvedBaseTypes.push(baseType);
}
} }
function resolveBaseTypesOfInterface(type) { function resolveBaseTypesOfInterface(type) {
type.resolvedBaseTypes = []; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i]; var declaration = _a[_i];
if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) {
@ -12689,7 +12700,12 @@ var ts;
if (baseType !== unknownType) { if (baseType !== unknownType) {
if (getTargetType(baseType).flags & (1024 | 2048)) { if (getTargetType(baseType).flags & (1024 | 2048)) {
if (type !== baseType && !hasBaseType(baseType, type)) { if (type !== baseType && !hasBaseType(baseType, type)) {
type.resolvedBaseTypes.push(baseType); if (type.resolvedBaseTypes === emptyArray) {
type.resolvedBaseTypes = [baseType];
}
else {
type.resolvedBaseTypes.push(baseType);
}
} }
else { else {
error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
@ -12987,7 +13003,7 @@ var ts;
return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals);
} }
function getDefaultConstructSignatures(classType) { function getDefaultConstructSignatures(classType) {
if (!getBaseTypes(classType).length) { if (!hasClassBaseType(classType)) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)];
} }
var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseConstructorType = getBaseConstructorTypeOfClass(classType);
@ -13388,7 +13404,9 @@ var ts;
function getSignatureFromDeclaration(declaration) { function getSignatureFromDeclaration(declaration) {
var links = getNodeLinks(declaration); var links = getNodeLinks(declaration);
if (!links.resolvedSignature) { if (!links.resolvedSignature) {
var classType = declaration.kind === 144 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var classType = declaration.kind === 144 ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : var typeParameters = classType ? classType.localTypeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
var parameters = []; var parameters = [];
@ -14352,7 +14370,7 @@ var ts;
var apparentType = getApparentType(source); var apparentType = getApparentType(source);
if (apparentType.flags & (80896 | 32768) && target.flags & 80896) { if (apparentType.flags & (80896 | 32768) && target.flags & 80896) {
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo;
if (result = objectTypeRelatedTo(apparentType, target, reportStructuralErrors)) { if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) {
errorInfo = saveErrorInfo; errorInfo = saveErrorInfo;
return result; return result;
} }
@ -14371,7 +14389,7 @@ var ts;
return result; return result;
} }
} }
return objectTypeRelatedTo(source, target, false); return objectTypeRelatedTo(source, source, target, false);
} }
if (source.flags & 512 && target.flags & 512) { if (source.flags & 512 && target.flags & 512) {
return typeParameterIdenticalTo(source, target); return typeParameterIdenticalTo(source, target);
@ -14393,30 +14411,31 @@ var ts;
resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) {
return true; return true;
} }
return false;
} }
if (type.flags & 49152) { else if (type.flags & 49152) {
for (var _i = 0, _a = type.types; _i < _a.length; _i++) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var t = _a[_i]; var t = _a[_i];
if (isKnownProperty(t, name)) { if (isKnownProperty(t, name)) {
return true; return true;
} }
} }
return false;
} }
return true; return false;
} }
function hasExcessProperties(source, target, reportErrors) { function hasExcessProperties(source, target, reportErrors) {
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { if (someConstituentTypeHasKind(target, 80896)) {
var prop = _a[_i]; for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
if (!isKnownProperty(target, prop.name)) { var prop = _a[_i];
if (reportErrors) { if (!isKnownProperty(target, prop.name)) {
errorNode = prop.valueDeclaration; if (reportErrors) {
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); errorNode = prop.valueDeclaration;
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target));
}
return true;
} }
return true;
} }
} }
return false;
} }
function eachTypeRelatedToSomeType(source, target) { function eachTypeRelatedToSomeType(source, target) {
var result = -1; var result = -1;
@ -14505,11 +14524,11 @@ var ts;
} }
return isIdenticalTo(source.constraint, target.constraint); return isIdenticalTo(source.constraint, target.constraint);
} }
function objectTypeRelatedTo(source, target, reportErrors) { function objectTypeRelatedTo(apparentSource, originalSource, target, reportErrors) {
if (overflow) { if (overflow) {
return 0; return 0;
} }
var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id;
var related = relation[id]; var related = relation[id];
if (related !== undefined) { if (related !== undefined) {
if (!elaborateErrors || (related === 3)) { if (!elaborateErrors || (related === 3)) {
@ -14533,13 +14552,13 @@ var ts;
maybeStack = []; maybeStack = [];
expandingFlags = 0; expandingFlags = 0;
} }
sourceStack[depth] = source; sourceStack[depth] = apparentSource;
targetStack[depth] = target; targetStack[depth] = target;
maybeStack[depth] = {}; maybeStack[depth] = {};
maybeStack[depth][id] = 1; maybeStack[depth][id] = 1;
depth++; depth++;
var saveExpandingFlags = expandingFlags; var saveExpandingFlags = expandingFlags;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth))
expandingFlags |= 1; expandingFlags |= 1;
if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth))
expandingFlags |= 2; expandingFlags |= 2;
@ -14548,15 +14567,15 @@ var ts;
result = 1; result = 1;
} }
else { else {
result = propertiesRelatedTo(source, target, reportErrors); result = propertiesRelatedTo(apparentSource, target, reportErrors);
if (result) { if (result) {
result &= signaturesRelatedTo(source, target, 0, reportErrors); result &= signaturesRelatedTo(apparentSource, target, 0, reportErrors);
if (result) { if (result) {
result &= signaturesRelatedTo(source, target, 1, reportErrors); result &= signaturesRelatedTo(apparentSource, target, 1, reportErrors);
if (result) { if (result) {
result &= stringIndexTypesRelatedTo(source, target, reportErrors); result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
if (result) { if (result) {
result &= numberIndexTypesRelatedTo(source, target, reportErrors); result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
} }
} }
} }
@ -14829,12 +14848,15 @@ var ts;
} }
return result; return result;
} }
function stringIndexTypesRelatedTo(source, target, reportErrors) { function stringIndexTypesRelatedTo(source, originalSource, target, reportErrors) {
if (relation === identityRelation) { if (relation === identityRelation) {
return indexTypesIdenticalTo(0, source, target); return indexTypesIdenticalTo(0, source, target);
} }
var targetType = getIndexTypeOfType(target, 0); var targetType = getIndexTypeOfType(target, 0);
if (targetType && !(targetType.flags & 1)) { if (targetType) {
if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) {
return -1;
}
var sourceType = getIndexTypeOfType(source, 0); var sourceType = getIndexTypeOfType(source, 0);
if (!sourceType) { if (!sourceType) {
if (reportErrors) { if (reportErrors) {
@ -14853,12 +14875,15 @@ var ts;
} }
return -1; return -1;
} }
function numberIndexTypesRelatedTo(source, target, reportErrors) { function numberIndexTypesRelatedTo(source, originalSource, target, reportErrors) {
if (relation === identityRelation) { if (relation === identityRelation) {
return indexTypesIdenticalTo(1, source, target); return indexTypesIdenticalTo(1, source, target);
} }
var targetType = getIndexTypeOfType(target, 1); var targetType = getIndexTypeOfType(target, 1);
if (targetType && !(targetType.flags & 1)) { if (targetType) {
if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) {
return -1;
}
var sourceStringType = getIndexTypeOfType(source, 0); var sourceStringType = getIndexTypeOfType(source, 0);
var sourceNumberType = getIndexTypeOfType(source, 1); var sourceNumberType = getIndexTypeOfType(source, 1);
if (!(sourceStringType || sourceNumberType)) { if (!(sourceStringType || sourceNumberType)) {
@ -14966,11 +14991,10 @@ var ts;
} }
source = getErasedSignature(source); source = getErasedSignature(source);
target = getErasedSignature(target); target = getErasedSignature(target);
var sourceLen = source.parameters.length;
var targetLen = target.parameters.length; var targetLen = target.parameters.length;
for (var i = 0; i < targetLen; i++) { for (var i = 0; i < targetLen; i++) {
var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]);
var related = compareTypes(s, t); var related = compareTypes(s, t);
if (!related) { if (!related) {
return 0; return 0;
@ -14982,6 +15006,9 @@ var ts;
} }
return result; return result;
} }
function isRestParameterIndex(signature, parameterIndex) {
return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1;
}
function isSupertypeOfEach(candidate, types) { function isSupertypeOfEach(candidate, types) {
for (var _i = 0; _i < types.length; _i++) { for (var _i = 0; _i < types.length; _i++) {
var type = types[_i]; var type = types[_i];
@ -15920,8 +15947,9 @@ var ts;
if (indexOfParameter < len) { if (indexOfParameter < len) {
return getTypeAtPosition(contextualSignature, indexOfParameter); return getTypeAtPosition(contextualSignature, indexOfParameter);
} }
if (indexOfParameter === (func.parameters.length - 1) && if (funcHasRestParameters &&
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { indexOfParameter === (func.parameters.length - 1) &&
isRestParameterIndex(contextualSignature, func.parameters.length - 1)) {
return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));
} }
} }
@ -16451,8 +16479,6 @@ var ts;
case 234: case 234:
checkJsxSelfClosingElement(child); checkJsxSelfClosingElement(child);
break; break;
default:
ts.Debug.assert(child.kind === 236);
} }
} }
return jsxElementType || anyType; return jsxElementType || anyType;
@ -17041,7 +17067,7 @@ var ts;
return false; return false;
} }
if (spreadArgIndex >= 0) { if (spreadArgIndex >= 0) {
return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; return isRestParameterIndex(signature, spreadArgIndex);
} }
if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) {
return false; return false;
@ -17187,83 +17213,83 @@ var ts;
} }
} }
function getEffectiveDecoratorFirstArgumentType(node) { function getEffectiveDecoratorFirstArgumentType(node) {
switch (node.kind) { if (node.kind === 214) {
case 214: var classSymbol = getSymbolOfNode(node);
case 186: return getTypeOfSymbol(classSymbol);
}
if (node.kind === 138) {
node = node.parent;
if (node.kind === 144) {
var classSymbol = getSymbolOfNode(node); var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol); return getTypeOfSymbol(classSymbol);
case 138: }
node = node.parent;
if (node.kind === 144) {
var classSymbol_1 = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol_1);
}
case 141:
case 143:
case 145:
case 146:
return getParentTypeOfClassElement(node);
default:
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
if (node.kind === 141 ||
node.kind === 143 ||
node.kind === 145 ||
node.kind === 146) {
return getParentTypeOfClassElement(node);
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
function getEffectiveDecoratorSecondArgumentType(node) { function getEffectiveDecoratorSecondArgumentType(node) {
switch (node.kind) { if (node.kind === 214) {
case 214: ts.Debug.fail("Class decorators should not have a second synthetic argument.");
ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType;
return unknownType;
case 138:
node = node.parent;
if (node.kind === 144) {
return anyType;
}
case 141:
case 143:
case 145:
case 146:
var element = node;
switch (element.name.kind) {
case 69:
case 8:
case 9:
return getStringLiteralType(element.name);
case 136:
var nameType = checkComputedPropertyName(element.name);
if (allConstituentTypesHaveKind(nameType, 16777216)) {
return nameType;
}
else {
return stringType;
}
default:
ts.Debug.fail("Unsupported property name.");
return unknownType;
}
default:
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
if (node.kind === 138) {
node = node.parent;
if (node.kind === 144) {
return anyType;
}
}
if (node.kind === 141 ||
node.kind === 143 ||
node.kind === 145 ||
node.kind === 146) {
var element = node;
switch (element.name.kind) {
case 69:
case 8:
case 9:
return getStringLiteralType(element.name);
case 136:
var nameType = checkComputedPropertyName(element.name);
if (allConstituentTypesHaveKind(nameType, 16777216)) {
return nameType;
}
else {
return stringType;
}
default:
ts.Debug.fail("Unsupported property name.");
return unknownType;
}
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
function getEffectiveDecoratorThirdArgumentType(node) { function getEffectiveDecoratorThirdArgumentType(node) {
switch (node.kind) { if (node.kind === 214) {
case 214: ts.Debug.fail("Class decorators should not have a third synthetic argument.");
ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType;
return unknownType;
case 138:
return numberType;
case 141:
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
case 143:
case 145:
case 146:
var propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
default:
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
if (node.kind === 138) {
return numberType;
}
if (node.kind === 141) {
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
}
if (node.kind === 143 ||
node.kind === 145 ||
node.kind === 146) {
var propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
function getEffectiveDecoratorArgumentType(node, argIndex) { function getEffectiveDecoratorArgumentType(node, argIndex) {
if (argIndex === 0) { if (argIndex === 0) {
@ -17639,7 +17665,7 @@ var ts;
var contextualParameterType = getTypeAtPosition(context, i); var contextualParameterType = getTypeAtPosition(context, i);
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
} }
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {
var parameter = ts.lastOrUndefined(signature.parameters); var parameter = ts.lastOrUndefined(signature.parameters);
var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
@ -18907,7 +18933,10 @@ var ts;
} }
function getEffectiveDeclarationFlags(n, flagsToCheck) { function getEffectiveDeclarationFlags(n, flagsToCheck) {
var flags = ts.getCombinedNodeFlags(n); var flags = ts.getCombinedNodeFlags(n);
if (n.parent.kind !== 215 && ts.isInAmbientContext(n)) { if (n.parent.kind !== 215 &&
n.parent.kind !== 214 &&
n.parent.kind !== 186 &&
ts.isInAmbientContext(n)) {
if (!(flags & 2)) { if (!(flags & 2)) {
flags |= 1; flags |= 1;
} }
@ -20102,9 +20131,6 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
} }
checkClassLikeDeclaration(node); checkClassLikeDeclaration(node);
if (getSymbolOfNode(node).flags & 64 && !ts.isInAmbientContext(node)) {
error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
}
ts.forEach(node.members, checkSourceElement); ts.forEach(node.members, checkSourceElement);
} }
function checkClassLikeDeclaration(node) { function checkClassLikeDeclaration(node) {
@ -20324,15 +20350,6 @@ var ts;
checkIndexConstraints(type); checkIndexConstraints(type);
} }
} }
if (symbol && symbol.declarations) {
for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) {
var declaration = _c[_b];
if (declaration.kind === 214 && !ts.isInAmbientContext(declaration)) {
error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
break;
}
}
}
} }
ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {
if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) {
@ -25376,32 +25393,36 @@ var ts;
write("."); write(".");
} }
} }
else if (modulekind !== 5) { else {
var declaration = resolver.getReferencedImportDeclaration(node); if (modulekind !== 5) {
if (declaration) { var declaration = resolver.getReferencedImportDeclaration(node);
if (declaration.kind === 223) { if (declaration) {
write(getGeneratedNameForNode(declaration.parent)); if (declaration.kind === 223) {
write(languageVersion === 0 ? "[\"default\"]" : ".default"); write(getGeneratedNameForNode(declaration.parent));
return; write(languageVersion === 0 ? "[\"default\"]" : ".default");
} return;
else if (declaration.kind === 226) {
write(getGeneratedNameForNode(declaration.parent.parent.parent));
var name_23 = declaration.propertyName || declaration.name;
var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23);
if (languageVersion === 0 && identifier === "default") {
write("[\"default\"]");
} }
else { else if (declaration.kind === 226) {
write("."); write(getGeneratedNameForNode(declaration.parent.parent.parent));
write(identifier); var name_23 = declaration.propertyName || declaration.name;
var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_23);
if (languageVersion === 0 && identifier === "default") {
write("[\"default\"]");
}
else {
write(".");
write(identifier);
}
return;
} }
return;
} }
} }
declaration = resolver.getReferencedNestedRedeclaration(node); if (languageVersion !== 2) {
if (declaration) { var declaration = resolver.getReferencedNestedRedeclaration(node);
write(getGeneratedNameForNode(declaration.name)); if (declaration) {
return; write(getGeneratedNameForNode(declaration.name));
return;
}
} }
} }
if (ts.nodeIsSynthesized(node)) { if (ts.nodeIsSynthesized(node)) {
@ -26142,7 +26163,7 @@ var ts;
return isSourceFileLevelDeclarationInSystemJsModule(node, false); return isSourceFileLevelDeclarationInSystemJsModule(node, false);
} }
function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { if (!node || !isCurrentFileSystemExternalModule()) {
return false; return false;
} }
var current = node; var current = node;
@ -30625,7 +30646,7 @@ var ts;
var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; });
if (options.isolatedModules) { if (options.isolatedModules) {
if (!options.module && languageVersion < 2) { if (!options.module && languageVersion < 2) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));
} }
var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });
if (firstNonExternalModuleSourceFile) { if (firstNonExternalModuleSourceFile) {
@ -30638,7 +30659,7 @@ var ts;
programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
} }
if (options.module === 5 && languageVersion < 2) { if (options.module === 5 && languageVersion < 2) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower));
} }
if (options.outDir || if (options.outDir ||
options.sourceRoot || options.sourceRoot ||
@ -30752,9 +30773,9 @@ var ts;
"es6": 5, "es6": 5,
"es2015": 5 "es2015": 5
}, },
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
paramType: ts.Diagnostics.KIND, paramType: ts.Diagnostics.KIND,
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015
}, },
{ {
name: "newLine", name: "newLine",
@ -30884,9 +30905,9 @@ var ts;
"es6": 2, "es6": 2,
"es2015": 2 "es2015": 2
}, },
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental,
paramType: ts.Diagnostics.VERSION, paramType: ts.Diagnostics.VERSION,
error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6 error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015
}, },
{ {
name: "version", name: "version",
@ -31053,56 +31074,12 @@ var ts;
} }
ts.parseConfigFileTextToJson = parseConfigFileTextToJson; ts.parseConfigFileTextToJson = parseConfigFileTextToJson;
function parseJsonConfigFileContent(json, host, basePath) { function parseJsonConfigFileContent(json, host, basePath) {
var errors = []; var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors;
return { return {
options: getCompilerOptions(), options: options,
fileNames: getFileNames(), fileNames: getFileNames(),
errors: errors errors: errors
}; };
function getCompilerOptions() {
var options = {};
var optionNameMap = {};
ts.forEach(ts.optionDeclarations, function (option) {
optionNameMap[option.name] = option;
});
var jsonOptions = json["compilerOptions"];
if (jsonOptions) {
for (var id in jsonOptions) {
if (ts.hasProperty(optionNameMap, id)) {
var opt = optionNameMap[id];
var optType = opt.type;
var value = jsonOptions[id];
var expectedType = typeof optType === "string" ? optType : "string";
if (typeof value === expectedType) {
if (typeof optType !== "string") {
var key = value.toLowerCase();
if (ts.hasProperty(optType, key)) {
value = optType[key];
}
else {
errors.push(ts.createCompilerDiagnostic(opt.error));
value = 0;
}
}
if (opt.isFilePath) {
value = ts.normalizePath(ts.combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
}
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id));
}
}
}
return options;
}
function getFileNames() { function getFileNames() {
var fileNames = []; var fileNames = [];
if (ts.hasProperty(json, "files")) { if (ts.hasProperty(json, "files")) {
@ -31138,6 +31115,49 @@ var ts;
} }
} }
ts.parseJsonConfigFileContent = parseJsonConfigFileContent; ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
function convertCompilerOptionsFromJson(jsonOptions, basePath) {
var options = {};
var errors = [];
if (!jsonOptions) {
return { options: options, errors: errors };
}
var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; });
for (var id in jsonOptions) {
if (ts.hasProperty(optionNameMap, id)) {
var opt = optionNameMap[id];
var optType = opt.type;
var value = jsonOptions[id];
var expectedType = typeof optType === "string" ? optType : "string";
if (typeof value === expectedType) {
if (typeof optType !== "string") {
var key = value.toLowerCase();
if (ts.hasProperty(optType, key)) {
value = optType[key];
}
else {
errors.push(ts.createCompilerDiagnostic(opt.error));
value = 0;
}
}
if (opt.isFilePath) {
value = ts.normalizePath(ts.combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
}
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id));
}
}
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
})(ts || (ts = {})); })(ts || (ts = {}));
var ts; var ts;
(function (ts) { (function (ts) {
@ -31260,6 +31280,8 @@ var ts;
var hostGetSourceFile; var hostGetSourceFile;
var timerHandleForRecompilation; var timerHandleForRecompilation;
var timerHandleForDirectoryChanges; var timerHandleForDirectoryChanges;
var cachedExistingFiles;
var hostFileExists;
if (commandLine.options.locale) { if (commandLine.options.locale) {
if (!isJSONSupported()) { if (!isJSONSupported()) {
reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"));
@ -31354,7 +31376,10 @@ var ts;
compilerHost = ts.createCompilerHost(compilerOptions); compilerHost = ts.createCompilerHost(compilerOptions);
hostGetSourceFile = compilerHost.getSourceFile; hostGetSourceFile = compilerHost.getSourceFile;
compilerHost.getSourceFile = getSourceFile; compilerHost.getSourceFile = getSourceFile;
hostFileExists = compilerHost.fileExists;
compilerHost.fileExists = cachedFileExists;
} }
cachedExistingFiles = {};
var compileResult = compile(rootFileNames, compilerOptions, compilerHost); var compileResult = compile(rootFileNames, compilerOptions, compilerHost);
if (!compilerOptions.watch) { if (!compilerOptions.watch) {
return ts.sys.exit(compileResult.exitStatus); return ts.sys.exit(compileResult.exitStatus);
@ -31362,6 +31387,12 @@ var ts;
setCachedProgram(compileResult.program); setCachedProgram(compileResult.program);
reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); reportWatchDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes));
} }
function cachedFileExists(fileName) {
if (ts.hasProperty(cachedExistingFiles, fileName)) {
return cachedExistingFiles[fileName];
}
return cachedExistingFiles[fileName] = hostFileExists(fileName);
}
function getSourceFile(fileName, languageVersion, onError) { function getSourceFile(fileName, languageVersion, onError) {
if (cachedProgram) { if (cachedProgram) {
var sourceFile_1 = cachedProgram.getSourceFile(fileName); var sourceFile_1 = cachedProgram.getSourceFile(fileName);
@ -31421,7 +31452,7 @@ var ts;
var parsedCommandLine = parseConfigFile(); var parsedCommandLine = parseConfigFile();
var newFileNames = ts.map(parsedCommandLine.fileNames, compilerHost.getCanonicalFileName); var newFileNames = ts.map(parsedCommandLine.fileNames, compilerHost.getCanonicalFileName);
var canonicalRootFileNames = ts.map(rootFileNames, compilerHost.getCanonicalFileName); var canonicalRootFileNames = ts.map(rootFileNames, compilerHost.getCanonicalFileName);
if (!ts.arrayStructurallyIsEqualTo(newFileNames, canonicalRootFileNames)) { if (!ts.arrayIsEqualTo(newFileNames && newFileNames.sort(), canonicalRootFileNames && canonicalRootFileNames.sort())) {
setCachedProgram(undefined); setCachedProgram(undefined);
startTimerForRecompilation(); startTimerForRecompilation();
} }
@ -31562,7 +31593,7 @@ var ts;
} }
function writeConfigFile(options, fileNames) { function writeConfigFile(options, fileNames) {
var currentDirectory = ts.sys.getCurrentDirectory(); var currentDirectory = ts.sys.getCurrentDirectory();
var file = ts.combinePaths(currentDirectory, "tsconfig.json"); var file = ts.normalizePath(ts.combinePaths(currentDirectory, "tsconfig.json"));
if (ts.sys.fileExists(file)) { if (ts.sys.fileExists(file)) {
reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file)); reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
} }

View file

@ -709,15 +709,13 @@ var ts;
} }
ts.objectAllocator = { ts.objectAllocator = {
getNodeConstructor: function (kind) { getNodeConstructor: function (kind) {
function Node() { function Node(pos, end) {
this.pos = pos;
this.end = end;
this.flags = 0;
this.parent = undefined;
} }
Node.prototype = { Node.prototype = { kind: kind };
kind: kind,
pos: -1,
end: -1,
flags: 0,
parent: undefined
};
return Node; return Node;
}, },
getSymbolConstructor: function () { return Symbol; }, getSymbolConstructor: function () { return Symbol; },
@ -748,9 +746,10 @@ var ts;
})(Debug = ts.Debug || (ts.Debug = {})); })(Debug = ts.Debug || (ts.Debug = {}));
function copyListRemovingItem(item, list) { function copyListRemovingItem(item, list) {
var copiedList = []; var copiedList = [];
for (var i = 0, len = list.length; i < len; i++) { for (var _i = 0; _i < list.length; _i++) {
if (list[i] !== item) { var e = list[_i];
copiedList.push(list[i]); if (e !== item) {
copiedList.push(e);
} }
} }
return copiedList; return copiedList;
@ -1053,7 +1052,7 @@ var ts;
}; };
}, },
watchDirectory: function (path, callback, recursive) { watchDirectory: function (path, callback, recursive) {
return _fs.watch(path, { persisten: true, recursive: !!recursive }, function (eventName, relativeFileName) { return _fs.watch(path, { persistent: true, recursive: !!recursive }, function (eventName, relativeFileName) {
if (eventName === "rename") { if (eventName === "rename") {
callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName)));
} }
@ -1263,7 +1262,7 @@ var ts;
Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." },
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." },
Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es2015' when targeting 'ES5' or lower." },
Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." },
@ -1511,7 +1510,6 @@ var ts;
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." },
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." },
@ -1537,6 +1535,7 @@ var ts;
Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." },
Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." },
Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." },
JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX expressions must have one parent element" },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@ -1617,7 +1616,7 @@ var ts;
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." },
Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." },
Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." },
Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." },
@ -1632,8 +1631,8 @@ var ts;
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." }, Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." },
Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." },
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" },
Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" },
Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." },
Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." },
Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." },
@ -1654,8 +1653,8 @@ var ts;
Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'." },
Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." },
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
@ -3156,9 +3155,9 @@ var ts;
"es6": 5, "es6": 5,
"es2015": 5 "es2015": 5
}, },
description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
paramType: ts.Diagnostics.KIND, paramType: ts.Diagnostics.KIND,
error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015
}, },
{ {
name: "newLine", name: "newLine",
@ -3288,9 +3287,9 @@ var ts;
"es6": 2, "es6": 2,
"es2015": 2 "es2015": 2
}, },
description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental,
paramType: ts.Diagnostics.VERSION, paramType: ts.Diagnostics.VERSION,
error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6 error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015
}, },
{ {
name: "version", name: "version",
@ -3457,56 +3456,12 @@ var ts;
} }
ts.parseConfigFileTextToJson = parseConfigFileTextToJson; ts.parseConfigFileTextToJson = parseConfigFileTextToJson;
function parseJsonConfigFileContent(json, host, basePath) { function parseJsonConfigFileContent(json, host, basePath) {
var errors = []; var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath), options = _a.options, errors = _a.errors;
return { return {
options: getCompilerOptions(), options: options,
fileNames: getFileNames(), fileNames: getFileNames(),
errors: errors errors: errors
}; };
function getCompilerOptions() {
var options = {};
var optionNameMap = {};
ts.forEach(ts.optionDeclarations, function (option) {
optionNameMap[option.name] = option;
});
var jsonOptions = json["compilerOptions"];
if (jsonOptions) {
for (var id in jsonOptions) {
if (ts.hasProperty(optionNameMap, id)) {
var opt = optionNameMap[id];
var optType = opt.type;
var value = jsonOptions[id];
var expectedType = typeof optType === "string" ? optType : "string";
if (typeof value === expectedType) {
if (typeof optType !== "string") {
var key = value.toLowerCase();
if (ts.hasProperty(optType, key)) {
value = optType[key];
}
else {
errors.push(ts.createCompilerDiagnostic(opt.error));
value = 0;
}
}
if (opt.isFilePath) {
value = ts.normalizePath(ts.combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
}
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id));
}
}
}
return options;
}
function getFileNames() { function getFileNames() {
var fileNames = []; var fileNames = [];
if (ts.hasProperty(json, "files")) { if (ts.hasProperty(json, "files")) {
@ -3542,6 +3497,49 @@ var ts;
} }
} }
ts.parseJsonConfigFileContent = parseJsonConfigFileContent; ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
function convertCompilerOptionsFromJson(jsonOptions, basePath) {
var options = {};
var errors = [];
if (!jsonOptions) {
return { options: options, errors: errors };
}
var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; });
for (var id in jsonOptions) {
if (ts.hasProperty(optionNameMap, id)) {
var opt = optionNameMap[id];
var optType = opt.type;
var value = jsonOptions[id];
var expectedType = typeof optType === "string" ? optType : "string";
if (typeof value === expectedType) {
if (typeof optType !== "string") {
var key = value.toLowerCase();
if (ts.hasProperty(optType, key)) {
value = optType[key];
}
else {
errors.push(ts.createCompilerDiagnostic(opt.error));
value = 0;
}
}
if (opt.isFilePath) {
value = ts.normalizePath(ts.combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
}
}
else {
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id));
}
}
return { options: options, errors: errors };
}
ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson;
})(ts || (ts = {})); })(ts || (ts = {}));
var ts; var ts;
(function (ts) { (function (ts) {
@ -3592,15 +3590,15 @@ var ts;
return node.end - node.pos; return node.end - node.pos;
} }
ts.getFullWidth = getFullWidth; ts.getFullWidth = getFullWidth;
function arrayIsEqualTo(arr1, arr2, comparer) { function arrayIsEqualTo(array1, array2, equaler) {
if (!arr1 || !arr2) { if (!array1 || !array2) {
return arr1 === arr2; return array1 === array2;
} }
if (arr1.length !== arr2.length) { if (array1.length !== array2.length) {
return false; return false;
} }
for (var i = 0; i < arr1.length; ++i) { for (var i = 0; i < array1.length; ++i) {
var equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];
if (!equals) { if (!equals) {
return false; return false;
} }
@ -4822,7 +4820,7 @@ var ts;
} }
ts.nodeIsSynthesized = nodeIsSynthesized; ts.nodeIsSynthesized = nodeIsSynthesized;
function createSynthesizedNode(kind, startsOnNewLine) { function createSynthesizedNode(kind, startsOnNewLine) {
var node = ts.createNode(kind); var node = ts.createNode(kind, -1, -1);
node.startsOnNewLine = startsOnNewLine; node.startsOnNewLine = startsOnNewLine;
return node; return node;
} }
@ -5509,16 +5507,6 @@ var ts;
} }
} }
ts.getTypeParameterOwner = getTypeParameterOwner; ts.getTypeParameterOwner = getTypeParameterOwner;
function arrayStructurallyIsEqualTo(array1, array2) {
if (!array1 || !array2) {
return false;
}
if (array1.length !== array2.length) {
return false;
}
return ts.arrayIsEqualTo(array1.sort(), array2.sort());
}
ts.arrayStructurallyIsEqualTo = arrayStructurallyIsEqualTo;
})(ts || (ts = {})); })(ts || (ts = {}));
var ts; var ts;
(function (ts) { (function (ts) {
@ -5528,8 +5516,8 @@ var ts;
return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind));
} }
ts.getNodeConstructor = getNodeConstructor; ts.getNodeConstructor = getNodeConstructor;
function createNode(kind) { function createNode(kind, pos, end) {
return new (getNodeConstructor(kind))(); return new (getNodeConstructor(kind))(pos, end);
} }
ts.createNode = createNode; ts.createNode = createNode;
function visitNode(cbNode, node) { function visitNode(cbNode, node) {
@ -6258,13 +6246,10 @@ var ts;
} }
function createNode(kind, pos) { function createNode(kind, pos) {
nodeCount++; nodeCount++;
var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))();
if (!(pos >= 0)) { if (!(pos >= 0)) {
pos = scanner.getStartPos(); pos = scanner.getStartPos();
} }
node.pos = pos; return new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(pos, pos);
node.end = pos;
return node;
} }
function finishNode(node, end) { function finishNode(node, end) {
node.end = end === undefined ? scanner.getStartPos() : end; node.end = end === undefined ? scanner.getStartPos() : end;
@ -7817,17 +7802,32 @@ var ts;
} }
function parseJsxElementOrSelfClosingElement(inExpressionContext) { function parseJsxElementOrSelfClosingElement(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
var result;
if (opening.kind === 235) { if (opening.kind === 235) {
var node = createNode(233, opening.pos); var node = createNode(233, opening.pos);
node.openingElement = opening; node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement.tagName); node.children = parseJsxChildren(node.openingElement.tagName);
node.closingElement = parseJsxClosingElement(inExpressionContext); node.closingElement = parseJsxClosingElement(inExpressionContext);
return finishNode(node); result = finishNode(node);
} }
else { else {
ts.Debug.assert(opening.kind === 234); ts.Debug.assert(opening.kind === 234);
return opening; result = opening;
} }
if (inExpressionContext && token === 25) {
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
var badNode = createNode(181, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
badNode.operatorToken = createMissingNode(24, false, undefined);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
}
return result;
} }
function parseJsxText() { function parseJsxText() {
var node = createNode(236, scanner.getStartPos()); var node = createNode(236, scanner.getStartPos());
@ -13095,22 +13095,27 @@ var ts;
} }
return type.resolvedBaseConstructorType; return type.resolvedBaseConstructorType;
} }
function hasClassBaseType(type) {
return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32); });
}
function getBaseTypes(type) { function getBaseTypes(type) {
var isClass = type.symbol.flags & 32;
var isInterface = type.symbol.flags & 64;
if (!type.resolvedBaseTypes) { if (!type.resolvedBaseTypes) {
if (type.symbol.flags & 32) { if (!isClass && !isInterface) {
ts.Debug.fail("type must be class or interface");
}
if (isClass) {
resolveBaseTypesOfClass(type); resolveBaseTypesOfClass(type);
} }
else if (type.symbol.flags & 64) { if (isInterface) {
resolveBaseTypesOfInterface(type); resolveBaseTypesOfInterface(type);
} }
else {
ts.Debug.fail("type must be class or interface");
}
} }
return type.resolvedBaseTypes; return type.resolvedBaseTypes;
} }
function resolveBaseTypesOfClass(type) { function resolveBaseTypesOfClass(type) {
type.resolvedBaseTypes = emptyArray; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
var baseContructorType = getBaseConstructorTypeOfClass(type); var baseContructorType = getBaseConstructorTypeOfClass(type);
if (!(baseContructorType.flags & 80896)) { if (!(baseContructorType.flags & 80896)) {
return; return;
@ -13139,10 +13144,15 @@ var ts;
error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
return; return;
} }
type.resolvedBaseTypes = [baseType]; if (type.resolvedBaseTypes === emptyArray) {
type.resolvedBaseTypes = [baseType];
}
else {
type.resolvedBaseTypes.push(baseType);
}
} }
function resolveBaseTypesOfInterface(type) { function resolveBaseTypesOfInterface(type) {
type.resolvedBaseTypes = []; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i]; var declaration = _a[_i];
if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) {
@ -13152,7 +13162,12 @@ var ts;
if (baseType !== unknownType) { if (baseType !== unknownType) {
if (getTargetType(baseType).flags & (1024 | 2048)) { if (getTargetType(baseType).flags & (1024 | 2048)) {
if (type !== baseType && !hasBaseType(baseType, type)) { if (type !== baseType && !hasBaseType(baseType, type)) {
type.resolvedBaseTypes.push(baseType); if (type.resolvedBaseTypes === emptyArray) {
type.resolvedBaseTypes = [baseType];
}
else {
type.resolvedBaseTypes.push(baseType);
}
} }
else { else {
error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1));
@ -13450,7 +13465,7 @@ var ts;
return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals);
} }
function getDefaultConstructSignatures(classType) { function getDefaultConstructSignatures(classType) {
if (!getBaseTypes(classType).length) { if (!hasClassBaseType(classType)) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)];
} }
var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseConstructorType = getBaseConstructorTypeOfClass(classType);
@ -13851,7 +13866,9 @@ var ts;
function getSignatureFromDeclaration(declaration) { function getSignatureFromDeclaration(declaration) {
var links = getNodeLinks(declaration); var links = getNodeLinks(declaration);
if (!links.resolvedSignature) { if (!links.resolvedSignature) {
var classType = declaration.kind === 144 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var classType = declaration.kind === 144 ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : var typeParameters = classType ? classType.localTypeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
var parameters = []; var parameters = [];
@ -14815,7 +14832,7 @@ var ts;
var apparentType = getApparentType(source); var apparentType = getApparentType(source);
if (apparentType.flags & (80896 | 32768) && target.flags & 80896) { if (apparentType.flags & (80896 | 32768) && target.flags & 80896) {
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo;
if (result = objectTypeRelatedTo(apparentType, target, reportStructuralErrors)) { if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) {
errorInfo = saveErrorInfo; errorInfo = saveErrorInfo;
return result; return result;
} }
@ -14834,7 +14851,7 @@ var ts;
return result; return result;
} }
} }
return objectTypeRelatedTo(source, target, false); return objectTypeRelatedTo(source, source, target, false);
} }
if (source.flags & 512 && target.flags & 512) { if (source.flags & 512 && target.flags & 512) {
return typeParameterIdenticalTo(source, target); return typeParameterIdenticalTo(source, target);
@ -14856,30 +14873,31 @@ var ts;
resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) { resolved.stringIndexType || resolved.numberIndexType || getPropertyOfType(type, name)) {
return true; return true;
} }
return false;
} }
if (type.flags & 49152) { else if (type.flags & 49152) {
for (var _i = 0, _a = type.types; _i < _a.length; _i++) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
var t = _a[_i]; var t = _a[_i];
if (isKnownProperty(t, name)) { if (isKnownProperty(t, name)) {
return true; return true;
} }
} }
return false;
} }
return true; return false;
} }
function hasExcessProperties(source, target, reportErrors) { function hasExcessProperties(source, target, reportErrors) {
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { if (someConstituentTypeHasKind(target, 80896)) {
var prop = _a[_i]; for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
if (!isKnownProperty(target, prop.name)) { var prop = _a[_i];
if (reportErrors) { if (!isKnownProperty(target, prop.name)) {
errorNode = prop.valueDeclaration; if (reportErrors) {
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); errorNode = prop.valueDeclaration;
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target));
}
return true;
} }
return true;
} }
} }
return false;
} }
function eachTypeRelatedToSomeType(source, target) { function eachTypeRelatedToSomeType(source, target) {
var result = -1; var result = -1;
@ -14968,11 +14986,11 @@ var ts;
} }
return isIdenticalTo(source.constraint, target.constraint); return isIdenticalTo(source.constraint, target.constraint);
} }
function objectTypeRelatedTo(source, target, reportErrors) { function objectTypeRelatedTo(apparentSource, originalSource, target, reportErrors) {
if (overflow) { if (overflow) {
return 0; return 0;
} }
var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id;
var related = relation[id]; var related = relation[id];
if (related !== undefined) { if (related !== undefined) {
if (!elaborateErrors || (related === 3)) { if (!elaborateErrors || (related === 3)) {
@ -14996,13 +15014,13 @@ var ts;
maybeStack = []; maybeStack = [];
expandingFlags = 0; expandingFlags = 0;
} }
sourceStack[depth] = source; sourceStack[depth] = apparentSource;
targetStack[depth] = target; targetStack[depth] = target;
maybeStack[depth] = {}; maybeStack[depth] = {};
maybeStack[depth][id] = 1; maybeStack[depth][id] = 1;
depth++; depth++;
var saveExpandingFlags = expandingFlags; var saveExpandingFlags = expandingFlags;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth))
expandingFlags |= 1; expandingFlags |= 1;
if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth))
expandingFlags |= 2; expandingFlags |= 2;
@ -15011,15 +15029,15 @@ var ts;
result = 1; result = 1;
} }
else { else {
result = propertiesRelatedTo(source, target, reportErrors); result = propertiesRelatedTo(apparentSource, target, reportErrors);
if (result) { if (result) {
result &= signaturesRelatedTo(source, target, 0, reportErrors); result &= signaturesRelatedTo(apparentSource, target, 0, reportErrors);
if (result) { if (result) {
result &= signaturesRelatedTo(source, target, 1, reportErrors); result &= signaturesRelatedTo(apparentSource, target, 1, reportErrors);
if (result) { if (result) {
result &= stringIndexTypesRelatedTo(source, target, reportErrors); result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
if (result) { if (result) {
result &= numberIndexTypesRelatedTo(source, target, reportErrors); result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
} }
} }
} }
@ -15292,12 +15310,15 @@ var ts;
} }
return result; return result;
} }
function stringIndexTypesRelatedTo(source, target, reportErrors) { function stringIndexTypesRelatedTo(source, originalSource, target, reportErrors) {
if (relation === identityRelation) { if (relation === identityRelation) {
return indexTypesIdenticalTo(0, source, target); return indexTypesIdenticalTo(0, source, target);
} }
var targetType = getIndexTypeOfType(target, 0); var targetType = getIndexTypeOfType(target, 0);
if (targetType && !(targetType.flags & 1)) { if (targetType) {
if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) {
return -1;
}
var sourceType = getIndexTypeOfType(source, 0); var sourceType = getIndexTypeOfType(source, 0);
if (!sourceType) { if (!sourceType) {
if (reportErrors) { if (reportErrors) {
@ -15316,12 +15337,15 @@ var ts;
} }
return -1; return -1;
} }
function numberIndexTypesRelatedTo(source, target, reportErrors) { function numberIndexTypesRelatedTo(source, originalSource, target, reportErrors) {
if (relation === identityRelation) { if (relation === identityRelation) {
return indexTypesIdenticalTo(1, source, target); return indexTypesIdenticalTo(1, source, target);
} }
var targetType = getIndexTypeOfType(target, 1); var targetType = getIndexTypeOfType(target, 1);
if (targetType && !(targetType.flags & 1)) { if (targetType) {
if ((targetType.flags & 1) && !(originalSource.flags & 16777726)) {
return -1;
}
var sourceStringType = getIndexTypeOfType(source, 0); var sourceStringType = getIndexTypeOfType(source, 0);
var sourceNumberType = getIndexTypeOfType(source, 1); var sourceNumberType = getIndexTypeOfType(source, 1);
if (!(sourceStringType || sourceNumberType)) { if (!(sourceStringType || sourceNumberType)) {
@ -15429,11 +15453,10 @@ var ts;
} }
source = getErasedSignature(source); source = getErasedSignature(source);
target = getErasedSignature(target); target = getErasedSignature(target);
var sourceLen = source.parameters.length;
var targetLen = target.parameters.length; var targetLen = target.parameters.length;
for (var i = 0; i < targetLen; i++) { for (var i = 0; i < targetLen; i++) {
var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]);
var related = compareTypes(s, t); var related = compareTypes(s, t);
if (!related) { if (!related) {
return 0; return 0;
@ -15445,6 +15468,9 @@ var ts;
} }
return result; return result;
} }
function isRestParameterIndex(signature, parameterIndex) {
return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1;
}
function isSupertypeOfEach(candidate, types) { function isSupertypeOfEach(candidate, types) {
for (var _i = 0; _i < types.length; _i++) { for (var _i = 0; _i < types.length; _i++) {
var type = types[_i]; var type = types[_i];
@ -16383,8 +16409,9 @@ var ts;
if (indexOfParameter < len) { if (indexOfParameter < len) {
return getTypeAtPosition(contextualSignature, indexOfParameter); return getTypeAtPosition(contextualSignature, indexOfParameter);
} }
if (indexOfParameter === (func.parameters.length - 1) && if (funcHasRestParameters &&
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { indexOfParameter === (func.parameters.length - 1) &&
isRestParameterIndex(contextualSignature, func.parameters.length - 1)) {
return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters));
} }
} }
@ -16914,8 +16941,6 @@ var ts;
case 234: case 234:
checkJsxSelfClosingElement(child); checkJsxSelfClosingElement(child);
break; break;
default:
ts.Debug.assert(child.kind === 236);
} }
} }
return jsxElementType || anyType; return jsxElementType || anyType;
@ -17504,7 +17529,7 @@ var ts;
return false; return false;
} }
if (spreadArgIndex >= 0) { if (spreadArgIndex >= 0) {
return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; return isRestParameterIndex(signature, spreadArgIndex);
} }
if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) {
return false; return false;
@ -17650,83 +17675,83 @@ var ts;
} }
} }
function getEffectiveDecoratorFirstArgumentType(node) { function getEffectiveDecoratorFirstArgumentType(node) {
switch (node.kind) { if (node.kind === 214) {
case 214: var classSymbol = getSymbolOfNode(node);
case 186: return getTypeOfSymbol(classSymbol);
}
if (node.kind === 138) {
node = node.parent;
if (node.kind === 144) {
var classSymbol = getSymbolOfNode(node); var classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol); return getTypeOfSymbol(classSymbol);
case 138: }
node = node.parent;
if (node.kind === 144) {
var classSymbol_1 = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol_1);
}
case 141:
case 143:
case 145:
case 146:
return getParentTypeOfClassElement(node);
default:
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
if (node.kind === 141 ||
node.kind === 143 ||
node.kind === 145 ||
node.kind === 146) {
return getParentTypeOfClassElement(node);
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
function getEffectiveDecoratorSecondArgumentType(node) { function getEffectiveDecoratorSecondArgumentType(node) {
switch (node.kind) { if (node.kind === 214) {
case 214: ts.Debug.fail("Class decorators should not have a second synthetic argument.");
ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType;
return unknownType;
case 138:
node = node.parent;
if (node.kind === 144) {
return anyType;
}
case 141:
case 143:
case 145:
case 146:
var element = node;
switch (element.name.kind) {
case 69:
case 8:
case 9:
return getStringLiteralType(element.name);
case 136:
var nameType = checkComputedPropertyName(element.name);
if (allConstituentTypesHaveKind(nameType, 16777216)) {
return nameType;
}
else {
return stringType;
}
default:
ts.Debug.fail("Unsupported property name.");
return unknownType;
}
default:
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
if (node.kind === 138) {
node = node.parent;
if (node.kind === 144) {
return anyType;
}
}
if (node.kind === 141 ||
node.kind === 143 ||
node.kind === 145 ||
node.kind === 146) {
var element = node;
switch (element.name.kind) {
case 69:
case 8:
case 9:
return getStringLiteralType(element.name);
case 136:
var nameType = checkComputedPropertyName(element.name);
if (allConstituentTypesHaveKind(nameType, 16777216)) {
return nameType;
}
else {
return stringType;
}
default:
ts.Debug.fail("Unsupported property name.");
return unknownType;
}
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
function getEffectiveDecoratorThirdArgumentType(node) { function getEffectiveDecoratorThirdArgumentType(node) {
switch (node.kind) { if (node.kind === 214) {
case 214: ts.Debug.fail("Class decorators should not have a third synthetic argument.");
ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType;
return unknownType;
case 138:
return numberType;
case 141:
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
case 143:
case 145:
case 146:
var propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
default:
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
if (node.kind === 138) {
return numberType;
}
if (node.kind === 141) {
ts.Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
}
if (node.kind === 143 ||
node.kind === 145 ||
node.kind === 146) {
var propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
}
ts.Debug.fail("Unsupported decorator target.");
return unknownType;
} }
function getEffectiveDecoratorArgumentType(node, argIndex) { function getEffectiveDecoratorArgumentType(node, argIndex) {
if (argIndex === 0) { if (argIndex === 0) {
@ -18102,7 +18127,7 @@ var ts;
var contextualParameterType = getTypeAtPosition(context, i); var contextualParameterType = getTypeAtPosition(context, i);
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
} }
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {
var parameter = ts.lastOrUndefined(signature.parameters); var parameter = ts.lastOrUndefined(signature.parameters);
var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters));
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper);
@ -19370,7 +19395,10 @@ var ts;
} }
function getEffectiveDeclarationFlags(n, flagsToCheck) { function getEffectiveDeclarationFlags(n, flagsToCheck) {
var flags = ts.getCombinedNodeFlags(n); var flags = ts.getCombinedNodeFlags(n);
if (n.parent.kind !== 215 && ts.isInAmbientContext(n)) { if (n.parent.kind !== 215 &&
n.parent.kind !== 214 &&
n.parent.kind !== 186 &&
ts.isInAmbientContext(n)) {
if (!(flags & 2)) { if (!(flags & 2)) {
flags |= 1; flags |= 1;
} }
@ -20565,9 +20593,6 @@ var ts;
grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
} }
checkClassLikeDeclaration(node); checkClassLikeDeclaration(node);
if (getSymbolOfNode(node).flags & 64 && !ts.isInAmbientContext(node)) {
error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
}
ts.forEach(node.members, checkSourceElement); ts.forEach(node.members, checkSourceElement);
} }
function checkClassLikeDeclaration(node) { function checkClassLikeDeclaration(node) {
@ -20787,15 +20812,6 @@ var ts;
checkIndexConstraints(type); checkIndexConstraints(type);
} }
} }
if (symbol && symbol.declarations) {
for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) {
var declaration = _c[_b];
if (declaration.kind === 214 && !ts.isInAmbientContext(declaration)) {
error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
break;
}
}
}
} }
ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {
if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) {
@ -25839,32 +25855,36 @@ var ts;
write("."); write(".");
} }
} }
else if (modulekind !== 5) { else {
var declaration = resolver.getReferencedImportDeclaration(node); if (modulekind !== 5) {
if (declaration) { var declaration = resolver.getReferencedImportDeclaration(node);
if (declaration.kind === 223) { if (declaration) {
write(getGeneratedNameForNode(declaration.parent)); if (declaration.kind === 223) {
write(languageVersion === 0 ? "[\"default\"]" : ".default"); write(getGeneratedNameForNode(declaration.parent));
return; write(languageVersion === 0 ? "[\"default\"]" : ".default");
} return;
else if (declaration.kind === 226) {
write(getGeneratedNameForNode(declaration.parent.parent.parent));
var name_24 = declaration.propertyName || declaration.name;
var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_24);
if (languageVersion === 0 && identifier === "default") {
write("[\"default\"]");
} }
else { else if (declaration.kind === 226) {
write("."); write(getGeneratedNameForNode(declaration.parent.parent.parent));
write(identifier); var name_24 = declaration.propertyName || declaration.name;
var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_24);
if (languageVersion === 0 && identifier === "default") {
write("[\"default\"]");
}
else {
write(".");
write(identifier);
}
return;
} }
return;
} }
} }
declaration = resolver.getReferencedNestedRedeclaration(node); if (languageVersion !== 2) {
if (declaration) { var declaration = resolver.getReferencedNestedRedeclaration(node);
write(getGeneratedNameForNode(declaration.name)); if (declaration) {
return; write(getGeneratedNameForNode(declaration.name));
return;
}
} }
} }
if (ts.nodeIsSynthesized(node)) { if (ts.nodeIsSynthesized(node)) {
@ -26605,7 +26625,7 @@ var ts;
return isSourceFileLevelDeclarationInSystemJsModule(node, false); return isSourceFileLevelDeclarationInSystemJsModule(node, false);
} }
function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) {
if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { if (!node || !isCurrentFileSystemExternalModule()) {
return false; return false;
} }
var current = node; var current = node;
@ -31088,7 +31108,7 @@ var ts;
var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; });
if (options.isolatedModules) { if (options.isolatedModules) {
if (!options.module && languageVersion < 2) { if (!options.module && languageVersion < 2) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher)); programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));
} }
var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; });
if (firstNonExternalModuleSourceFile) { if (firstNonExternalModuleSourceFile) {
@ -31101,7 +31121,7 @@ var ts;
programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
} }
if (options.module === 5 && languageVersion < 2) { if (options.module === 5 && languageVersion < 2) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower));
} }
if (options.outDir || if (options.outDir ||
options.sourceRoot || options.sourceRoot ||
@ -35145,7 +35165,7 @@ var ts;
var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
if (isTokenInRange) { if (isTokenInRange) {
var rangeHasError = rangeContainsError(currentTokenInfo.token); var rangeHasError = rangeContainsError(currentTokenInfo.token);
var prevStartLine = previousRangeStartLine; var savePreviousRange = previousRange;
lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);
if (rangeHasError) { if (rangeHasError) {
indentToken = false; indentToken = false;
@ -35155,7 +35175,8 @@ var ts;
indentToken = lineAdded; indentToken = lineAdded;
} }
else { else {
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine; var prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
} }
} }
} }
@ -35920,9 +35941,7 @@ var ts;
]; ];
var jsDocCompletionEntries; var jsDocCompletionEntries;
function createNode(kind, pos, end, flags, parent) { function createNode(kind, pos, end, flags, parent) {
var node = new (ts.getNodeConstructor(kind))(); var node = new (ts.getNodeConstructor(kind))(pos, end);
node.pos = pos;
node.end = end;
node.flags = flags; node.flags = flags;
node.parent = parent; node.parent = parent;
return node; return node;
@ -41268,14 +41287,14 @@ var ts;
function initializeServices() { function initializeServices() {
ts.objectAllocator = { ts.objectAllocator = {
getNodeConstructor: function (kind) { getNodeConstructor: function (kind) {
function Node() { function Node(pos, end) {
this.pos = pos;
this.end = end;
this.flags = 0;
this.parent = undefined;
} }
var proto = kind === 248 ? new SourceFileObject() : new NodeObject(); var proto = kind === 248 ? new SourceFileObject() : new NodeObject();
proto.kind = kind; proto.kind = kind;
proto.pos = -1;
proto.end = -1;
proto.flags = 0;
proto.parent = undefined;
Node.prototype = proto; Node.prototype = proto;
return Node; return Node;
}, },
@ -42687,7 +42706,7 @@ var ts;
var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error;
var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); }));
var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); }));
if (!ts.arrayStructurallyIsEqualTo(currentRootFiles, newRootFiles)) { if (!ts.arrayIsEqualTo(currentRootFiles && currentRootFiles.sort(), newRootFiles && newRootFiles.sort())) {
this.updateConfiguredProject(project); this.updateConfiguredProject(project);
this.updateProjectStructure(); this.updateProjectStructure();
} }
@ -43254,11 +43273,15 @@ var ts;
if (info.isOpen) { if (info.isOpen) {
if (this.openFileRoots.indexOf(info) >= 0) { if (this.openFileRoots.indexOf(info) >= 0) {
this.openFileRoots = copyListRemovingItem(info, this.openFileRoots); this.openFileRoots = copyListRemovingItem(info, this.openFileRoots);
if (info.defaultProject && !info.defaultProject.isConfiguredProject()) {
this.removeProject(info.defaultProject);
}
} }
if (this.openFilesReferenced.indexOf(info) >= 0) { if (this.openFilesReferenced.indexOf(info) >= 0) {
this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced);
} }
this.openFileRootsConfigured.push(info); this.openFileRootsConfigured.push(info);
info.defaultProject = project;
} }
} }
project.addRoot(info); project.addRoot(info);

13
lib/typescript.d.ts vendored
View file

@ -328,6 +328,7 @@ declare namespace ts {
FirstNode = 135, FirstNode = 135,
} }
const enum NodeFlags { const enum NodeFlags {
None = 0,
Export = 1, Export = 1,
Ambient = 2, Ambient = 2,
Public = 16, Public = 16,
@ -954,7 +955,7 @@ declare namespace ts {
getSourceFile(fileName: string): SourceFile; getSourceFile(fileName: string): SourceFile;
getCurrentDirectory(): string; getCurrentDirectory(): string;
} }
interface ParseConfigHost extends ModuleResolutionHost { interface ParseConfigHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
} }
interface WriteFileCallback { interface WriteFileCallback {
@ -1521,11 +1522,10 @@ declare namespace ts {
*/ */
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration; function getTypeParameterOwner(d: Declaration): Declaration;
function arrayStructurallyIsEqualTo<T>(array1: Array<T>, array2: Array<T>): boolean;
} }
declare namespace ts { declare namespace ts {
function getNodeConstructor(kind: SyntaxKind): new () => Node; function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node;
function createNode(kind: SyntaxKind): Node; function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
@ -1564,10 +1564,15 @@ declare namespace ts {
/** /**
* Parse the contents of a config file (tsconfig.json). * Parse the contents of a config file (tsconfig.json).
* @param json The contents of the config file to parse * @param json The contents of the config file to parse
* @param host Instance of ParseConfigHost used to enumerate files in folder.
* @param basePath A root directory to resolve relative path entries in the config * @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir * file to. e.g. outDir
*/ */
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine; function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): {
options: CompilerOptions;
errors: Diagnostic[];
};
} }
declare namespace ts { declare namespace ts {
/** The version of the language service API */ /** The version of the language service API */

File diff suppressed because it is too large Load diff

View file

@ -328,6 +328,7 @@ declare namespace ts {
FirstNode = 135, FirstNode = 135,
} }
const enum NodeFlags { const enum NodeFlags {
None = 0,
Export = 1, Export = 1,
Ambient = 2, Ambient = 2,
Public = 16, Public = 16,
@ -954,7 +955,7 @@ declare namespace ts {
getSourceFile(fileName: string): SourceFile; getSourceFile(fileName: string): SourceFile;
getCurrentDirectory(): string; getCurrentDirectory(): string;
} }
interface ParseConfigHost extends ModuleResolutionHost { interface ParseConfigHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
} }
interface WriteFileCallback { interface WriteFileCallback {
@ -1521,11 +1522,10 @@ declare namespace ts {
*/ */
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration; function getTypeParameterOwner(d: Declaration): Declaration;
function arrayStructurallyIsEqualTo<T>(array1: Array<T>, array2: Array<T>): boolean;
} }
declare namespace ts { declare namespace ts {
function getNodeConstructor(kind: SyntaxKind): new () => Node; function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node;
function createNode(kind: SyntaxKind): Node; function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
@ -1564,10 +1564,15 @@ declare namespace ts {
/** /**
* Parse the contents of a config file (tsconfig.json). * Parse the contents of a config file (tsconfig.json).
* @param json The contents of the config file to parse * @param json The contents of the config file to parse
* @param host Instance of ParseConfigHost used to enumerate files in folder.
* @param basePath A root directory to resolve relative path entries in the config * @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir * file to. e.g. outDir
*/ */
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine; function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): {
options: CompilerOptions;
errors: Diagnostic[];
};
} }
declare namespace ts { declare namespace ts {
/** The version of the language service API */ /** The version of the language service API */

File diff suppressed because it is too large Load diff