typescript 5.0.0-dev.20230209 → 5.0.0-dev.20230211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.0";
26
- var version = `${versionMajorMinor}.0-dev.20230209`;
26
+ var version = `${versionMajorMinor}.0-dev.20230211`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -614,6 +614,12 @@ function first(array) {
614
614
  Debug.assert(array.length !== 0);
615
615
  return array[0];
616
616
  }
617
+ function firstIterator(iter) {
618
+ for (const value of iter) {
619
+ return value;
620
+ }
621
+ Debug.fail("iterator is empty");
622
+ }
617
623
  function lastOrUndefined(array) {
618
624
  return array === void 0 || array.length === 0 ? void 0 : array[array.length - 1];
619
625
  }
@@ -6174,6 +6180,7 @@ var Diagnostics = {
6174
6180
  To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, 3 /* Message */, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),
6175
6181
  _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
6176
6182
  _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
6183
+ Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
6177
6184
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
6178
6185
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
6179
6186
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7530,7 +7537,7 @@ var Diagnostics = {
7530
7537
  You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
7531
7538
  You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
7532
7539
  Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
7533
- Decorators_must_come_after_export_or_export_default_in_JavaScript_files: diag(8038, 1 /* Error */, "Decorators_must_come_after_export_or_export_default_in_JavaScript_files_8038", "Decorators must come after 'export' or 'export default' in JavaScript files."),
7540
+ Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
7534
7541
  Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
7535
7542
  Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
7536
7543
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -11650,101 +11657,400 @@ function getInternalEmitFlags(node) {
11650
11657
  return emitNode && emitNode.internalFlags || 0;
11651
11658
  }
11652
11659
  function getScriptTargetFeatures() {
11653
- return {
11654
- es2015: {
11655
- Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"],
11656
- RegExp: ["flags", "sticky", "unicode"],
11657
- Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"],
11658
- ArrayConstructor: ["from", "of"],
11659
- ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"],
11660
- NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"],
11661
- Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"],
11662
- Map: ["entries", "keys", "values"],
11663
- Set: ["entries", "keys", "values"],
11664
- Promise: emptyArray,
11665
- PromiseConstructor: ["all", "race", "reject", "resolve"],
11666
- Symbol: ["for", "keyFor"],
11667
- WeakMap: ["entries", "keys", "values"],
11668
- WeakSet: ["entries", "keys", "values"],
11669
- Iterator: emptyArray,
11670
- AsyncIterator: emptyArray,
11671
- String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"],
11672
- StringConstructor: ["fromCodePoint", "raw"]
11673
- },
11674
- es2016: {
11675
- Array: ["includes"]
11676
- },
11677
- es2017: {
11678
- Atomics: emptyArray,
11679
- SharedArrayBuffer: emptyArray,
11680
- String: ["padStart", "padEnd"],
11681
- ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"],
11682
- DateTimeFormat: ["formatToParts"]
11683
- },
11684
- es2018: {
11685
- Promise: ["finally"],
11686
- RegExpMatchArray: ["groups"],
11687
- RegExpExecArray: ["groups"],
11688
- RegExp: ["dotAll"],
11689
- Intl: ["PluralRules"],
11690
- AsyncIterable: emptyArray,
11691
- AsyncIterableIterator: emptyArray,
11692
- AsyncGenerator: emptyArray,
11693
- AsyncGeneratorFunction: emptyArray,
11694
- NumberFormat: ["formatToParts"]
11695
- },
11696
- es2019: {
11697
- Array: ["flat", "flatMap"],
11698
- ObjectConstructor: ["fromEntries"],
11699
- String: ["trimStart", "trimEnd", "trimLeft", "trimRight"],
11700
- Symbol: ["description"]
11701
- },
11702
- es2020: {
11703
- BigInt: emptyArray,
11704
- BigInt64Array: emptyArray,
11705
- BigUint64Array: emptyArray,
11706
- PromiseConstructor: ["allSettled"],
11707
- SymbolConstructor: ["matchAll"],
11708
- String: ["matchAll"],
11709
- DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"],
11710
- RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"]
11711
- },
11712
- es2021: {
11713
- PromiseConstructor: ["any"],
11714
- String: ["replaceAll"]
11715
- },
11716
- es2022: {
11717
- Array: ["at"],
11718
- String: ["at"],
11719
- Int8Array: ["at"],
11720
- Uint8Array: ["at"],
11721
- Uint8ClampedArray: ["at"],
11722
- Int16Array: ["at"],
11723
- Uint16Array: ["at"],
11724
- Int32Array: ["at"],
11725
- Uint32Array: ["at"],
11726
- Float32Array: ["at"],
11727
- Float64Array: ["at"],
11728
- BigInt64Array: ["at"],
11729
- BigUint64Array: ["at"],
11730
- ObjectConstructor: ["hasOwn"],
11731
- Error: ["cause"]
11732
- },
11733
- es2023: {
11734
- Array: ["findLastIndex", "findLast"],
11735
- Int8Array: ["findLastIndex", "findLast"],
11736
- Uint8Array: ["findLastIndex", "findLast"],
11737
- Uint8ClampedArray: ["findLastIndex", "findLast"],
11738
- Int16Array: ["findLastIndex", "findLast"],
11739
- Uint16Array: ["findLastIndex", "findLast"],
11740
- Int32Array: ["findLastIndex", "findLast"],
11741
- Uint32Array: ["findLastIndex", "findLast"],
11742
- Float32Array: ["findLastIndex", "findLast"],
11743
- Float64Array: ["findLastIndex", "findLast"],
11744
- BigInt64Array: ["findLastIndex", "findLast"],
11745
- BigUint64Array: ["findLastIndex", "findLast"]
11746
- }
11747
- };
11660
+ return new Map(Object.entries({
11661
+ Array: new Map(Object.entries({
11662
+ es2015: [
11663
+ "find",
11664
+ "findIndex",
11665
+ "fill",
11666
+ "copyWithin",
11667
+ "entries",
11668
+ "keys",
11669
+ "values"
11670
+ ],
11671
+ es2016: [
11672
+ "includes"
11673
+ ],
11674
+ es2019: [
11675
+ "flat",
11676
+ "flatMap"
11677
+ ],
11678
+ es2022: [
11679
+ "at"
11680
+ ],
11681
+ es2023: [
11682
+ "findLastIndex",
11683
+ "findLast"
11684
+ ]
11685
+ })),
11686
+ Iterator: new Map(Object.entries({
11687
+ es2015: emptyArray
11688
+ })),
11689
+ AsyncIterator: new Map(Object.entries({
11690
+ es2015: emptyArray
11691
+ })),
11692
+ Atomics: new Map(Object.entries({
11693
+ es2017: emptyArray
11694
+ })),
11695
+ SharedArrayBuffer: new Map(Object.entries({
11696
+ es2017: emptyArray
11697
+ })),
11698
+ AsyncIterable: new Map(Object.entries({
11699
+ es2018: emptyArray
11700
+ })),
11701
+ AsyncIterableIterator: new Map(Object.entries({
11702
+ es2018: emptyArray
11703
+ })),
11704
+ AsyncGenerator: new Map(Object.entries({
11705
+ es2018: emptyArray
11706
+ })),
11707
+ AsyncGeneratorFunction: new Map(Object.entries({
11708
+ es2018: emptyArray
11709
+ })),
11710
+ RegExp: new Map(Object.entries({
11711
+ es2015: [
11712
+ "flags",
11713
+ "sticky",
11714
+ "unicode"
11715
+ ],
11716
+ es2018: [
11717
+ "dotAll"
11718
+ ]
11719
+ })),
11720
+ Reflect: new Map(Object.entries({
11721
+ es2015: [
11722
+ "apply",
11723
+ "construct",
11724
+ "defineProperty",
11725
+ "deleteProperty",
11726
+ "get",
11727
+ " getOwnPropertyDescriptor",
11728
+ "getPrototypeOf",
11729
+ "has",
11730
+ "isExtensible",
11731
+ "ownKeys",
11732
+ "preventExtensions",
11733
+ "set",
11734
+ "setPrototypeOf"
11735
+ ]
11736
+ })),
11737
+ ArrayConstructor: new Map(Object.entries({
11738
+ es2015: [
11739
+ "from",
11740
+ "of"
11741
+ ]
11742
+ })),
11743
+ ObjectConstructor: new Map(Object.entries({
11744
+ es2015: [
11745
+ "assign",
11746
+ "getOwnPropertySymbols",
11747
+ "keys",
11748
+ "is",
11749
+ "setPrototypeOf"
11750
+ ],
11751
+ es2017: [
11752
+ "values",
11753
+ "entries",
11754
+ "getOwnPropertyDescriptors"
11755
+ ],
11756
+ es2019: [
11757
+ "fromEntries"
11758
+ ],
11759
+ es2022: [
11760
+ "hasOwn"
11761
+ ]
11762
+ })),
11763
+ NumberConstructor: new Map(Object.entries({
11764
+ es2015: [
11765
+ "isFinite",
11766
+ "isInteger",
11767
+ "isNaN",
11768
+ "isSafeInteger",
11769
+ "parseFloat",
11770
+ "parseInt"
11771
+ ]
11772
+ })),
11773
+ Math: new Map(Object.entries({
11774
+ es2015: [
11775
+ "clz32",
11776
+ "imul",
11777
+ "sign",
11778
+ "log10",
11779
+ "log2",
11780
+ "log1p",
11781
+ "expm1",
11782
+ "cosh",
11783
+ "sinh",
11784
+ "tanh",
11785
+ "acosh",
11786
+ "asinh",
11787
+ "atanh",
11788
+ "hypot",
11789
+ "trunc",
11790
+ "fround",
11791
+ "cbrt"
11792
+ ]
11793
+ })),
11794
+ Map: new Map(Object.entries({
11795
+ es2015: [
11796
+ "entries",
11797
+ "keys",
11798
+ "values"
11799
+ ]
11800
+ })),
11801
+ Set: new Map(Object.entries({
11802
+ es2015: [
11803
+ "entries",
11804
+ "keys",
11805
+ "values"
11806
+ ]
11807
+ })),
11808
+ PromiseConstructor: new Map(Object.entries({
11809
+ es2015: [
11810
+ "all",
11811
+ "race",
11812
+ "reject",
11813
+ "resolve"
11814
+ ],
11815
+ es2020: [
11816
+ "allSettled"
11817
+ ],
11818
+ es2021: [
11819
+ "any"
11820
+ ]
11821
+ })),
11822
+ Symbol: new Map(Object.entries({
11823
+ es2015: [
11824
+ "for",
11825
+ "keyFor"
11826
+ ],
11827
+ es2019: [
11828
+ "description"
11829
+ ]
11830
+ })),
11831
+ WeakMap: new Map(Object.entries({
11832
+ es2015: [
11833
+ "entries",
11834
+ "keys",
11835
+ "values"
11836
+ ]
11837
+ })),
11838
+ WeakSet: new Map(Object.entries({
11839
+ es2015: [
11840
+ "entries",
11841
+ "keys",
11842
+ "values"
11843
+ ]
11844
+ })),
11845
+ String: new Map(Object.entries({
11846
+ es2015: [
11847
+ "codePointAt",
11848
+ "includes",
11849
+ "endsWith",
11850
+ "normalize",
11851
+ "repeat",
11852
+ "startsWith",
11853
+ "anchor",
11854
+ "big",
11855
+ "blink",
11856
+ "bold",
11857
+ "fixed",
11858
+ "fontcolor",
11859
+ "fontsize",
11860
+ "italics",
11861
+ "link",
11862
+ "small",
11863
+ "strike",
11864
+ "sub",
11865
+ "sup"
11866
+ ],
11867
+ es2017: [
11868
+ "padStart",
11869
+ "padEnd"
11870
+ ],
11871
+ es2019: [
11872
+ "trimStart",
11873
+ "trimEnd",
11874
+ "trimLeft",
11875
+ "trimRight"
11876
+ ],
11877
+ es2020: [
11878
+ "matchAll"
11879
+ ],
11880
+ es2021: [
11881
+ "replaceAll"
11882
+ ],
11883
+ es2022: [
11884
+ "at"
11885
+ ]
11886
+ })),
11887
+ StringConstructor: new Map(Object.entries({
11888
+ es2015: [
11889
+ "fromCodePoint",
11890
+ "raw"
11891
+ ]
11892
+ })),
11893
+ DateTimeFormat: new Map(Object.entries({
11894
+ es2017: [
11895
+ "formatToParts"
11896
+ ]
11897
+ })),
11898
+ Promise: new Map(Object.entries({
11899
+ es2015: emptyArray,
11900
+ es2018: [
11901
+ "finally"
11902
+ ]
11903
+ })),
11904
+ RegExpMatchArray: new Map(Object.entries({
11905
+ es2018: [
11906
+ "groups"
11907
+ ]
11908
+ })),
11909
+ RegExpExecArray: new Map(Object.entries({
11910
+ es2018: [
11911
+ "groups"
11912
+ ]
11913
+ })),
11914
+ Intl: new Map(Object.entries({
11915
+ es2018: [
11916
+ "PluralRules"
11917
+ ]
11918
+ })),
11919
+ NumberFormat: new Map(Object.entries({
11920
+ es2018: [
11921
+ "formatToParts"
11922
+ ]
11923
+ })),
11924
+ SymbolConstructor: new Map(Object.entries({
11925
+ es2020: [
11926
+ "matchAll"
11927
+ ]
11928
+ })),
11929
+ DataView: new Map(Object.entries({
11930
+ es2020: [
11931
+ "setBigInt64",
11932
+ "setBigUint64",
11933
+ "getBigInt64",
11934
+ "getBigUint64"
11935
+ ]
11936
+ })),
11937
+ BigInt: new Map(Object.entries({
11938
+ es2020: emptyArray
11939
+ })),
11940
+ RelativeTimeFormat: new Map(Object.entries({
11941
+ es2020: [
11942
+ "format",
11943
+ "formatToParts",
11944
+ "resolvedOptions"
11945
+ ]
11946
+ })),
11947
+ Int8Array: new Map(Object.entries({
11948
+ es2022: [
11949
+ "at"
11950
+ ],
11951
+ es2023: [
11952
+ "findLastIndex",
11953
+ "findLast"
11954
+ ]
11955
+ })),
11956
+ Uint8Array: new Map(Object.entries({
11957
+ es2022: [
11958
+ "at"
11959
+ ],
11960
+ es2023: [
11961
+ "findLastIndex",
11962
+ "findLast"
11963
+ ]
11964
+ })),
11965
+ Uint8ClampedArray: new Map(Object.entries({
11966
+ es2022: [
11967
+ "at"
11968
+ ],
11969
+ es2023: [
11970
+ "findLastIndex",
11971
+ "findLast"
11972
+ ]
11973
+ })),
11974
+ Int16Array: new Map(Object.entries({
11975
+ es2022: [
11976
+ "at"
11977
+ ],
11978
+ es2023: [
11979
+ "findLastIndex",
11980
+ "findLast"
11981
+ ]
11982
+ })),
11983
+ Uint16Array: new Map(Object.entries({
11984
+ es2022: [
11985
+ "at"
11986
+ ],
11987
+ es2023: [
11988
+ "findLastIndex",
11989
+ "findLast"
11990
+ ]
11991
+ })),
11992
+ Int32Array: new Map(Object.entries({
11993
+ es2022: [
11994
+ "at"
11995
+ ],
11996
+ es2023: [
11997
+ "findLastIndex",
11998
+ "findLast"
11999
+ ]
12000
+ })),
12001
+ Uint32Array: new Map(Object.entries({
12002
+ es2022: [
12003
+ "at"
12004
+ ],
12005
+ es2023: [
12006
+ "findLastIndex",
12007
+ "findLast"
12008
+ ]
12009
+ })),
12010
+ Float32Array: new Map(Object.entries({
12011
+ es2022: [
12012
+ "at"
12013
+ ],
12014
+ es2023: [
12015
+ "findLastIndex",
12016
+ "findLast"
12017
+ ]
12018
+ })),
12019
+ Float64Array: new Map(Object.entries({
12020
+ es2022: [
12021
+ "at"
12022
+ ],
12023
+ es2023: [
12024
+ "findLastIndex",
12025
+ "findLast"
12026
+ ]
12027
+ })),
12028
+ BigInt64Array: new Map(Object.entries({
12029
+ es2020: emptyArray,
12030
+ es2022: [
12031
+ "at"
12032
+ ],
12033
+ es2023: [
12034
+ "findLastIndex",
12035
+ "findLast"
12036
+ ]
12037
+ })),
12038
+ BigUint64Array: new Map(Object.entries({
12039
+ es2020: emptyArray,
12040
+ es2022: [
12041
+ "at"
12042
+ ],
12043
+ es2023: [
12044
+ "findLastIndex",
12045
+ "findLast"
12046
+ ]
12047
+ })),
12048
+ Error: new Map(Object.entries({
12049
+ es2022: [
12050
+ "cause"
12051
+ ]
12052
+ }))
12053
+ }));
11748
12054
  }
11749
12055
  function getLiteralText(node, sourceFile, flags) {
11750
12056
  var _a2;
@@ -22501,14 +22807,114 @@ function createEmitHelperFactory(context) {
22501
22807
  factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name)
22502
22808
  ]);
22503
22809
  }
22810
+ function createESDecorateClassElementAccessGetMethod(elementName) {
22811
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
22812
+ return factory2.createPropertyAssignment(
22813
+ "get",
22814
+ factory2.createArrowFunction(
22815
+ /*modifiers*/
22816
+ void 0,
22817
+ /*typeParameters*/
22818
+ void 0,
22819
+ [factory2.createParameterDeclaration(
22820
+ /*modifiers*/
22821
+ void 0,
22822
+ /*dotDotDotToken*/
22823
+ void 0,
22824
+ factory2.createIdentifier("obj")
22825
+ )],
22826
+ /*type*/
22827
+ void 0,
22828
+ /*equalsGreaterThanToken*/
22829
+ void 0,
22830
+ accessor
22831
+ )
22832
+ );
22833
+ }
22834
+ function createESDecorateClassElementAccessSetMethod(elementName) {
22835
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
22836
+ return factory2.createPropertyAssignment(
22837
+ "set",
22838
+ factory2.createArrowFunction(
22839
+ /*modifiers*/
22840
+ void 0,
22841
+ /*typeParameters*/
22842
+ void 0,
22843
+ [
22844
+ factory2.createParameterDeclaration(
22845
+ /*modifiers*/
22846
+ void 0,
22847
+ /*dotDotDotToken*/
22848
+ void 0,
22849
+ factory2.createIdentifier("obj")
22850
+ ),
22851
+ factory2.createParameterDeclaration(
22852
+ /*modifiers*/
22853
+ void 0,
22854
+ /*dotDotDotToken*/
22855
+ void 0,
22856
+ factory2.createIdentifier("value")
22857
+ )
22858
+ ],
22859
+ /*type*/
22860
+ void 0,
22861
+ /*equalsGreaterThanToken*/
22862
+ void 0,
22863
+ factory2.createBlock([
22864
+ factory2.createExpressionStatement(
22865
+ factory2.createAssignment(
22866
+ accessor,
22867
+ factory2.createIdentifier("value")
22868
+ )
22869
+ )
22870
+ ])
22871
+ )
22872
+ );
22873
+ }
22874
+ function createESDecorateClassElementAccessHasMethod(elementName) {
22875
+ const propertyName = elementName.computed ? elementName.name : isIdentifier(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name;
22876
+ return factory2.createPropertyAssignment(
22877
+ "has",
22878
+ factory2.createArrowFunction(
22879
+ /*modifiers*/
22880
+ void 0,
22881
+ /*typeParameters*/
22882
+ void 0,
22883
+ [factory2.createParameterDeclaration(
22884
+ /*modifiers*/
22885
+ void 0,
22886
+ /*dotDotDotToken*/
22887
+ void 0,
22888
+ factory2.createIdentifier("obj")
22889
+ )],
22890
+ /*type*/
22891
+ void 0,
22892
+ /*equalsGreaterThanToken*/
22893
+ void 0,
22894
+ factory2.createBinaryExpression(
22895
+ propertyName,
22896
+ 101 /* InKeyword */,
22897
+ factory2.createIdentifier("obj")
22898
+ )
22899
+ )
22900
+ );
22901
+ }
22902
+ function createESDecorateClassElementAccessObject(name, access) {
22903
+ const properties = [];
22904
+ properties.push(createESDecorateClassElementAccessHasMethod(name));
22905
+ if (access.get)
22906
+ properties.push(createESDecorateClassElementAccessGetMethod(name));
22907
+ if (access.set)
22908
+ properties.push(createESDecorateClassElementAccessSetMethod(name));
22909
+ return factory2.createObjectLiteralExpression(properties);
22910
+ }
22504
22911
  function createESDecorateClassElementContextObject(contextIn) {
22505
22912
  return factory2.createObjectLiteralExpression([
22506
22913
  factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral(contextIn.kind)),
22507
22914
  factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory2.createStringLiteralFromNode(contextIn.name.name)),
22508
22915
  factory2.createPropertyAssignment(factory2.createIdentifier("static"), contextIn.static ? factory2.createTrue() : factory2.createFalse()),
22509
- factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse())
22510
- // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494
22511
- // factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
22916
+ factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse()),
22917
+ factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
22512
22918
  ]);
22513
22919
  }
22514
22920
  function createESDecorateContextObject(contextIn) {
@@ -28822,6 +29228,12 @@ var Parser;
28822
29228
  case 114 /* VoidKeyword */:
28823
29229
  return parseVoidExpression();
28824
29230
  case 29 /* LessThanToken */:
29231
+ if (languageVariant === 1 /* JSX */) {
29232
+ return parseJsxElementOrSelfClosingElementOrFragment(
29233
+ /*inExpressionContext*/
29234
+ true
29235
+ );
29236
+ }
28825
29237
  return parseTypeAssertion();
28826
29238
  case 133 /* AwaitKeyword */:
28827
29239
  if (isAwaitExpression2()) {
@@ -29193,6 +29605,7 @@ var Parser;
29193
29605
  return finishNode(factory2.createJsxJsxClosingFragment(), pos);
29194
29606
  }
29195
29607
  function parseTypeAssertion() {
29608
+ Debug.assert(scriptKind === 3 /* TS */, "Type assertions should never be parsed outside of TS; they should either be comparisons or JSX.");
29196
29609
  const pos = getNodePos();
29197
29610
  parseExpected(29 /* LessThanToken */);
29198
29611
  const type = parseType();
@@ -30543,17 +30956,25 @@ var Parser;
30543
30956
  function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
30544
30957
  const pos = getNodePos();
30545
30958
  let list;
30546
- let modifier, hasSeenStaticModifier = false;
30959
+ let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false;
30960
+ if (allowDecorators && token() === 59 /* AtToken */) {
30961
+ while (decorator = tryParseDecorator()) {
30962
+ list = append(list, decorator);
30963
+ }
30964
+ }
30547
30965
  while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
30548
30966
  if (modifier.kind === 124 /* StaticKeyword */)
30549
30967
  hasSeenStaticModifier = true;
30550
30968
  list = append(list, modifier);
30969
+ hasLeadingModifier = true;
30551
30970
  }
30552
- if (allowDecorators && token() === 59 /* AtToken */) {
30553
- let decorator;
30971
+ if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) {
30554
30972
  while (decorator = tryParseDecorator()) {
30555
30973
  list = append(list, decorator);
30974
+ hasTrailingDecorator = true;
30556
30975
  }
30976
+ }
30977
+ if (hasTrailingDecorator) {
30557
30978
  while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
30558
30979
  if (modifier.kind === 124 /* StaticKeyword */)
30559
30980
  hasSeenStaticModifier = true;
@@ -42874,6 +43295,7 @@ function createTypeChecker(host) {
42874
43295
  let flowTypeCache;
42875
43296
  const contextualTypeNodes = [];
42876
43297
  const contextualTypes = [];
43298
+ const contextualIsCache = [];
42877
43299
  let contextualTypeCount = 0;
42878
43300
  const inferenceContextNodes = [];
42879
43301
  const inferenceContexts = [];
@@ -55310,7 +55732,7 @@ function createTypeChecker(host) {
55310
55732
  }
55311
55733
  }
55312
55734
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
55313
- const templates = filter(types, isPatternLiteralType);
55735
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
55314
55736
  if (templates.length) {
55315
55737
  let i = types.length;
55316
55738
  while (i > 0) {
@@ -57835,7 +58257,12 @@ function createTypeChecker(host) {
57835
58257
  }
57836
58258
  }
57837
58259
  function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
57838
- pushContextualType(next, sourcePropType);
58260
+ pushContextualType(
58261
+ next,
58262
+ sourcePropType,
58263
+ /*isCache*/
58264
+ false
58265
+ );
57839
58266
  const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
57840
58267
  popContextualType();
57841
58268
  return result;
@@ -58143,7 +58570,12 @@ function createTypeChecker(host) {
58143
58570
  if (isTupleLikeType(source)) {
58144
58571
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
58145
58572
  }
58146
- pushContextualType(node, target);
58573
+ pushContextualType(
58574
+ node,
58575
+ target,
58576
+ /*isCache*/
58577
+ false
58578
+ );
58147
58579
  const tupleizedType = checkArrayLiteral(
58148
58580
  node,
58149
58581
  1 /* Contextual */,
@@ -63833,10 +64265,12 @@ function createTypeChecker(host) {
63833
64265
  }
63834
64266
  function isConstantReference(node) {
63835
64267
  switch (node.kind) {
63836
- case 79 /* Identifier */: {
63837
- const symbol = getResolvedSymbol(node);
63838
- return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
63839
- }
64268
+ case 79 /* Identifier */:
64269
+ if (!isThisInTypeQuery(node)) {
64270
+ const symbol = getResolvedSymbol(node);
64271
+ return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
64272
+ }
64273
+ break;
63840
64274
  case 208 /* PropertyAccessExpression */:
63841
64275
  case 209 /* ElementAccessExpression */:
63842
64276
  return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
@@ -66190,11 +66624,13 @@ function createTypeChecker(host) {
66190
66624
  if (node.flags & 33554432 /* InWithStatement */) {
66191
66625
  return void 0;
66192
66626
  }
66193
- const index = findContextualNode(node);
66627
+ const index = findContextualNode(
66628
+ node,
66629
+ /*includeCaches*/
66630
+ !contextFlags
66631
+ );
66194
66632
  if (index >= 0) {
66195
- const cached = contextualTypes[index];
66196
- if (cached || !contextFlags)
66197
- return cached;
66633
+ return contextualTypes[index];
66198
66634
  }
66199
66635
  const { parent } = node;
66200
66636
  switch (parent.kind) {
@@ -66265,17 +66701,30 @@ function createTypeChecker(host) {
66265
66701
  }
66266
66702
  return void 0;
66267
66703
  }
66268
- function pushContextualType(node, type) {
66704
+ function pushCachedContextualType(node) {
66705
+ pushContextualType(
66706
+ node,
66707
+ getContextualType(
66708
+ node,
66709
+ /*contextFlags*/
66710
+ void 0
66711
+ ),
66712
+ /*isCache*/
66713
+ true
66714
+ );
66715
+ }
66716
+ function pushContextualType(node, type, isCache) {
66269
66717
  contextualTypeNodes[contextualTypeCount] = node;
66270
66718
  contextualTypes[contextualTypeCount] = type;
66719
+ contextualIsCache[contextualTypeCount] = isCache;
66271
66720
  contextualTypeCount++;
66272
66721
  }
66273
66722
  function popContextualType() {
66274
66723
  contextualTypeCount--;
66275
66724
  }
66276
- function findContextualNode(node) {
66725
+ function findContextualNode(node, includeCaches) {
66277
66726
  for (let i = contextualTypeCount - 1; i >= 0; i--) {
66278
- if (node === contextualTypeNodes[i]) {
66727
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
66279
66728
  return i;
66280
66729
  }
66281
66730
  }
@@ -66298,7 +66747,11 @@ function createTypeChecker(host) {
66298
66747
  }
66299
66748
  function getContextualJsxElementAttributesType(node, contextFlags) {
66300
66749
  if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
66301
- const index = findContextualNode(node.parent);
66750
+ const index = findContextualNode(
66751
+ node.parent,
66752
+ /*includeCaches*/
66753
+ !contextFlags
66754
+ );
66302
66755
  if (index >= 0) {
66303
66756
  return contextualTypes[index];
66304
66757
  }
@@ -66569,11 +67022,7 @@ function createTypeChecker(host) {
66569
67022
  const elementCount = elements.length;
66570
67023
  const elementTypes = [];
66571
67024
  const elementFlags = [];
66572
- pushContextualType(node, getContextualType(
66573
- node,
66574
- /*contextFlags*/
66575
- void 0
66576
- ));
67025
+ pushCachedContextualType(node);
66577
67026
  const inDestructuringPattern = isAssignmentTarget(node);
66578
67027
  const inConstContext = isConstContext(node);
66579
67028
  const contextualType = getApparentTypeOfContextualType(
@@ -66736,11 +67185,7 @@ function createTypeChecker(host) {
66736
67185
  let propertiesTable = createSymbolTable();
66737
67186
  let propertiesArray = [];
66738
67187
  let spread = emptyObjectType;
66739
- pushContextualType(node, getContextualType(
66740
- node,
66741
- /*contextFlags*/
66742
- void 0
66743
- ));
67188
+ pushCachedContextualType(node);
66744
67189
  const contextualType = getApparentTypeOfContextualType(
66745
67190
  node,
66746
67191
  /*contextFlags*/
@@ -68080,26 +68525,22 @@ function createTypeChecker(host) {
68080
68525
  function getSuggestedLibForNonExistentName(name) {
68081
68526
  const missingName = diagnosticName(name);
68082
68527
  const allFeatures = getScriptTargetFeatures();
68083
- const libTargets = getOwnKeys(allFeatures);
68084
- for (const libTarget of libTargets) {
68085
- const containingTypes = getOwnKeys(allFeatures[libTarget]);
68086
- if (containingTypes !== void 0 && contains(containingTypes, missingName)) {
68087
- return libTarget;
68088
- }
68089
- }
68528
+ const typeFeatures = allFeatures.get(missingName);
68529
+ return typeFeatures && firstIterator(typeFeatures.keys());
68090
68530
  }
68091
68531
  function getSuggestedLibForNonExistentProperty(missingProperty, containingType) {
68092
68532
  const container = getApparentType(containingType).symbol;
68093
68533
  if (!container) {
68094
68534
  return void 0;
68095
68535
  }
68536
+ const containingTypeName = symbolName(container);
68096
68537
  const allFeatures = getScriptTargetFeatures();
68097
- const libTargets = getOwnKeys(allFeatures);
68098
- for (const libTarget of libTargets) {
68099
- const featuresOfLib = allFeatures[libTarget];
68100
- const featuresOfContainingType = featuresOfLib[symbolName(container)];
68101
- if (featuresOfContainingType !== void 0 && contains(featuresOfContainingType, missingProperty)) {
68102
- return libTarget;
68538
+ const typeFeatures = allFeatures.get(containingTypeName);
68539
+ if (typeFeatures) {
68540
+ for (const [libTarget, featuresOfType] of typeFeatures) {
68541
+ if (contains(featuresOfType, missingProperty)) {
68542
+ return libTarget;
68543
+ }
68103
68544
  }
68104
68545
  }
68105
68546
  }
@@ -72755,14 +73196,19 @@ function createTypeChecker(host) {
72755
73196
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
72756
73197
  }
72757
73198
  function getContextNode(node) {
72758
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
73199
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
72759
73200
  return node.parent.parent;
72760
73201
  }
72761
73202
  return node;
72762
73203
  }
72763
73204
  function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
72764
73205
  const contextNode = getContextNode(node);
72765
- pushContextualType(contextNode, contextualType);
73206
+ pushContextualType(
73207
+ contextNode,
73208
+ contextualType,
73209
+ /*isCache*/
73210
+ false
73211
+ );
72766
73212
  pushInferenceContext(contextNode, inferenceContext);
72767
73213
  const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
72768
73214
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -73103,7 +73549,12 @@ function createTypeChecker(host) {
73103
73549
  if (links.contextFreeType) {
73104
73550
  return links.contextFreeType;
73105
73551
  }
73106
- pushContextualType(node, anyType);
73552
+ pushContextualType(
73553
+ node,
73554
+ anyType,
73555
+ /*isCache*/
73556
+ false
73557
+ );
73107
73558
  const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
73108
73559
  popContextualType();
73109
73560
  return type;
@@ -80557,6 +81008,7 @@ function createTypeChecker(host) {
80557
81008
  let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator;
80558
81009
  let flags = 0 /* None */;
80559
81010
  let sawExportBeforeDecorators = false;
81011
+ let hasLeadingDecorators = false;
80560
81012
  for (const modifier of node.modifiers) {
80561
81013
  if (isDecorator(modifier)) {
80562
81014
  if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) {
@@ -80574,8 +81026,22 @@ function createTypeChecker(host) {
80574
81026
  if (flags & ~(1025 /* ExportDefault */ | 131072 /* Decorator */)) {
80575
81027
  return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
80576
81028
  }
81029
+ if (hasLeadingDecorators && flags & 126975 /* Modifier */) {
81030
+ Debug.assertIsDefined(firstDecorator);
81031
+ const sourceFile = getSourceFileOfNode(modifier);
81032
+ if (!hasParseDiagnostics(sourceFile)) {
81033
+ addRelatedInfo(
81034
+ error(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
81035
+ createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
81036
+ );
81037
+ return true;
81038
+ }
81039
+ return false;
81040
+ }
80577
81041
  flags |= 131072 /* Decorator */;
80578
- if (flags & 1 /* Export */) {
81042
+ if (!(flags & 126975 /* Modifier */)) {
81043
+ hasLeadingDecorators = true;
81044
+ } else if (flags & 1 /* Export */) {
80579
81045
  sawExportBeforeDecorators = true;
80580
81046
  }
80581
81047
  firstDecorator != null ? firstDecorator : firstDecorator = modifier;
@@ -113502,11 +113968,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113502
113968
  diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
113503
113969
  } else if (isClassDeclaration(parent)) {
113504
113970
  const exportIndex = findIndex(parent.modifiers, isExportModifier);
113505
- const defaultIndex = findIndex(parent.modifiers, isDefaultModifier);
113506
- if (exportIndex >= 0 && decoratorIndex < exportIndex) {
113507
- diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_must_come_after_export_or_export_default_in_JavaScript_files));
113508
- } else if (defaultIndex >= 0 && decoratorIndex < defaultIndex) {
113509
- diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
113971
+ if (exportIndex >= 0) {
113972
+ const defaultIndex = findIndex(parent.modifiers, isDefaultModifier);
113973
+ if (decoratorIndex > exportIndex && defaultIndex >= 0 && decoratorIndex < defaultIndex) {
113974
+ diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
113975
+ } else if (exportIndex >= 0 && decoratorIndex < exportIndex) {
113976
+ const trailingDecoratorIndex = findIndex(parent.modifiers, isDecorator, exportIndex);
113977
+ if (trailingDecoratorIndex >= 0) {
113978
+ diagnostics.push(addRelatedInfo(
113979
+ createDiagnosticForNode2(parent.modifiers[trailingDecoratorIndex], Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
113980
+ createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorator_used_before_export_here)
113981
+ ));
113982
+ }
113983
+ }
113510
113984
  }
113511
113985
  }
113512
113986
  }