typescript 4.8.0-dev.20220511 → 4.8.0-dev.20220514

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/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220511";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220514";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8336,6 +8336,7 @@ var ts;
8336
8336
  String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."),
8337
8337
  Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."),
8338
8338
  or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."),
8339
+ or_JSX_element_expected: diag(1145, ts.DiagnosticCategory.Error, "or_JSX_element_expected_1145", "'{' or JSX element expected."),
8339
8340
  Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."),
8340
8341
  Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."),
8341
8342
  Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."),
@@ -8481,6 +8482,7 @@ var ts;
8481
8482
  infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."),
8482
8483
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
8483
8484
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
8485
+ Class_constructor_may_not_be_an_accessor: diag(1341, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
8484
8486
  Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
8485
8487
  The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
8486
8488
  A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
@@ -8499,6 +8501,7 @@ var ts;
8499
8501
  An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."),
8500
8502
  Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."),
8501
8503
  Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."),
8504
+ Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."),
8502
8505
  _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."),
8503
8506
  _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."),
8504
8507
  A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."),
@@ -9088,6 +9091,7 @@ var ts;
9088
9091
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
9089
9092
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
9090
9093
  All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
9094
+ This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
9091
9095
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
9092
9096
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
9093
9097
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -13398,6 +13402,19 @@ var ts;
13398
13402
  return isLiteralKind(node.kind);
13399
13403
  }
13400
13404
  ts.isLiteralExpression = isLiteralExpression;
13405
+ /** @internal */
13406
+ function isLiteralExpressionOfObject(node) {
13407
+ switch (node.kind) {
13408
+ case 205 /* ObjectLiteralExpression */:
13409
+ case 204 /* ArrayLiteralExpression */:
13410
+ case 13 /* RegularExpressionLiteral */:
13411
+ case 213 /* FunctionExpression */:
13412
+ case 226 /* ClassExpression */:
13413
+ return true;
13414
+ }
13415
+ return false;
13416
+ }
13417
+ ts.isLiteralExpressionOfObject = isLiteralExpressionOfObject;
13401
13418
  // Pseudo-literals
13402
13419
  /* @internal */
13403
13420
  function isTemplateLiteralKind(kind) {
@@ -35396,9 +35413,22 @@ var ts;
35396
35413
  }
35397
35414
  scanJsxIdentifier();
35398
35415
  var pos = getNodePos();
35399
- return finishNode(factory.createJsxAttribute(parseIdentifierName(), token() !== 63 /* EqualsToken */ ? undefined :
35400
- scanJsxAttributeValue() === 10 /* StringLiteral */ ? parseLiteralNode() :
35401
- parseJsxExpression(/*inExpressionContext*/ true)), pos);
35416
+ return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos);
35417
+ }
35418
+ function parseJsxAttributeValue() {
35419
+ if (token() === 63 /* EqualsToken */) {
35420
+ if (scanJsxAttributeValue() === 10 /* StringLiteral */) {
35421
+ return parseLiteralNode();
35422
+ }
35423
+ if (token() === 18 /* OpenBraceToken */) {
35424
+ return parseJsxExpression(/*inExpressionContext*/ true);
35425
+ }
35426
+ if (token() === 29 /* LessThanToken */) {
35427
+ return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true);
35428
+ }
35429
+ parseErrorAtCurrentToken(ts.Diagnostics.or_JSX_element_expected);
35430
+ }
35431
+ return undefined;
35402
35432
  }
35403
35433
  function parseJsxSpreadAttribute() {
35404
35434
  var pos = getNodePos();
@@ -51671,8 +51701,9 @@ var ts;
51671
51701
  function getExportSymbolOfValueSymbolIfExported(symbol) {
51672
51702
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
51673
51703
  }
51674
- function symbolIsValue(symbol) {
51675
- return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
51704
+ function symbolIsValue(symbol, includeTypeOnlyMembers) {
51705
+ return !!(symbol.flags & 111551 /* Value */ ||
51706
+ symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
51676
51707
  }
51677
51708
  function findConstructorDeclaration(node) {
51678
51709
  var members = node.members;
@@ -59362,12 +59393,12 @@ var ts;
59362
59393
  * @param type a type to look up property from
59363
59394
  * @param name a name of property to look up in a given type
59364
59395
  */
59365
- function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment) {
59396
+ function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
59366
59397
  type = getReducedApparentType(type);
59367
59398
  if (type.flags & 524288 /* Object */) {
59368
59399
  var resolved = resolveStructuredTypeMembers(type);
59369
59400
  var symbol = resolved.members.get(name);
59370
- if (symbol && symbolIsValue(symbol)) {
59401
+ if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
59371
59402
  return symbol;
59372
59403
  }
59373
59404
  if (skipObjectFunctionPropertyAugment)
@@ -62747,7 +62778,7 @@ var ts;
62747
62778
  // the `exports` lookup process that only looks up namespace members which is used for most type references
62748
62779
  var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
62749
62780
  var next = node.isTypeOf
62750
- ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText)
62781
+ ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ true)
62751
62782
  : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
62752
62783
  if (!next) {
62753
62784
  error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
@@ -74663,9 +74694,8 @@ var ts;
74663
74694
  markAliasReferenced(parentSymbol, node);
74664
74695
  }
74665
74696
  return isErrorType(apparentType) ? errorType : apparentType;
74666
- ;
74667
74697
  }
74668
- prop = getPropertyOfType(apparentType, right.escapedText);
74698
+ prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* QualifiedName */);
74669
74699
  }
74670
74700
  // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
74671
74701
  // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
@@ -79157,6 +79187,10 @@ var ts;
79157
79187
  case 35 /* ExclamationEqualsToken */:
79158
79188
  case 36 /* EqualsEqualsEqualsToken */:
79159
79189
  case 37 /* ExclamationEqualsEqualsToken */:
79190
+ if (ts.isLiteralExpressionOfObject(left) || ts.isLiteralExpressionOfObject(right)) {
79191
+ var eqType = operator === 34 /* EqualsEqualsToken */ || operator === 36 /* EqualsEqualsEqualsToken */;
79192
+ error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
79193
+ }
79160
79194
  reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
79161
79195
  return booleanType;
79162
79196
  case 102 /* InstanceOfKeyword */:
@@ -80448,6 +80482,9 @@ var ts;
80448
80482
  // Grammar checking
80449
80483
  if (!checkGrammarMethod(node))
80450
80484
  checkGrammarComputedPropertyName(node.name);
80485
+ if (ts.isMethodDeclaration(node) && node.asteriskToken && ts.isIdentifier(node.name) && ts.idText(node.name) === "constructor") {
80486
+ error(node.name, ts.Diagnostics.Class_constructor_may_not_be_a_generator);
80487
+ }
80451
80488
  // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration
80452
80489
  checkFunctionOrMethodDeclaration(node);
80453
80490
  // method signatures already report "implementation not allowed in ambient context" elsewhere
@@ -80575,6 +80612,9 @@ var ts;
80575
80612
  return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
80576
80613
  }
80577
80614
  function checkAccessorDeclaration(node) {
80615
+ if (ts.isIdentifier(node.name) && ts.idText(node.name) === "constructor") {
80616
+ error(node.name, ts.Diagnostics.Class_constructor_may_not_be_an_accessor);
80617
+ }
80578
80618
  addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
80579
80619
  checkSourceElement(node.body);
80580
80620
  setNodeLinksForPrivateIdentifierScope(node);
@@ -98003,22 +98043,29 @@ var ts;
98003
98043
  if (node === undefined) {
98004
98044
  return factory.createTrue();
98005
98045
  }
98006
- else if (node.kind === 10 /* StringLiteral */) {
98046
+ if (node.kind === 10 /* StringLiteral */) {
98007
98047
  // Always recreate the literal to escape any escape sequences or newlines which may be in the original jsx string and which
98008
98048
  // Need to be escaped to be handled correctly in a normal string
98009
98049
  var singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
98010
98050
  var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
98011
98051
  return ts.setTextRange(literal, node);
98012
98052
  }
98013
- else if (node.kind === 288 /* JsxExpression */) {
98053
+ if (node.kind === 288 /* JsxExpression */) {
98014
98054
  if (node.expression === undefined) {
98015
98055
  return factory.createTrue();
98016
98056
  }
98017
98057
  return ts.visitNode(node.expression, visitor, ts.isExpression);
98018
98058
  }
98019
- else {
98020
- return ts.Debug.failBadSyntaxKind(node);
98059
+ if (ts.isJsxElement(node)) {
98060
+ return visitJsxElement(node, /*isChild*/ false);
98061
+ }
98062
+ if (ts.isJsxSelfClosingElement(node)) {
98063
+ return visitJsxSelfClosingElement(node, /*isChild*/ false);
98064
+ }
98065
+ if (ts.isJsxFragment(node)) {
98066
+ return visitJsxFragment(node, /*isChild*/ false);
98021
98067
  }
98068
+ return ts.Debug.failBadSyntaxKind(node);
98022
98069
  }
98023
98070
  function visitJsxText(node) {
98024
98071
  var fixed = fixupWhitespaceAndDecodeEntities(node.text);
@@ -116592,6 +116639,8 @@ var ts;
116592
116639
  ts.Diagnostics.extends_clause_already_seen.code,
116593
116640
  ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
116594
116641
  ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
116642
+ ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
116643
+ ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
116595
116644
  ]);
116596
116645
  /**
116597
116646
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -123119,6 +123168,13 @@ var ts;
123119
123168
  ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
123120
123169
  WildcardDirectoryOfReferencedProject: "Wild card directory of referenced project",
123121
123170
  PackageJson: "package.json file",
123171
+ ClosedScriptInfo: "Closed Script info",
123172
+ ConfigFileForInferredRoot: "Config file for the inferred project root",
123173
+ NodeModules: "node_modules for closed script infos and package.jsons affecting module specifier cache",
123174
+ MissingSourceMapFile: "Missing source map file",
123175
+ NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
123176
+ MissingGeneratedFile: "Missing generated file",
123177
+ NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
123122
123178
  };
123123
123179
  function createWatchFactory(host, options) {
123124
123180
  var watchLogLevel = host.trace ? options.extendedDiagnostics ? ts.WatchLogLevel.Verbose : options.diagnostics ? ts.WatchLogLevel.TriggerOnly : ts.WatchLogLevel.None : ts.WatchLogLevel.None;
@@ -166302,7 +166358,7 @@ var ts;
166302
166358
  function getDefaultLibFilePath(options) {
166303
166359
  // Check __dirname is defined and that we are on a node.js system.
166304
166360
  if (typeof __dirname !== "undefined") {
166305
- return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options);
166361
+ return ts.combinePaths(__dirname, ts.getDefaultLibFileName(options));
166306
166362
  }
166307
166363
  throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
166308
166364
  }
@@ -1388,8 +1388,9 @@ declare namespace ts {
1388
1388
  readonly kind: SyntaxKind.JsxAttribute;
1389
1389
  readonly parent: JsxAttributes;
1390
1390
  readonly name: Identifier;
1391
- readonly initializer?: StringLiteral | JsxExpression;
1391
+ readonly initializer?: JsxAttributeValue;
1392
1392
  }
1393
+ export type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
1393
1394
  export interface JsxSpreadAttribute extends ObjectLiteralElement {
1394
1395
  readonly kind: SyntaxKind.JsxSpreadAttribute;
1395
1396
  readonly parent: JsxAttributes;
@@ -3746,8 +3747,8 @@ declare namespace ts {
3746
3747
  createJsxOpeningFragment(): JsxOpeningFragment;
3747
3748
  createJsxJsxClosingFragment(): JsxClosingFragment;
3748
3749
  updateJsxFragment(node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment): JsxFragment;
3749
- createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression | undefined): JsxAttribute;
3750
- updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression | undefined): JsxAttribute;
3750
+ createJsxAttribute(name: Identifier, initializer: JsxAttributeValue | undefined): JsxAttribute;
3751
+ updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: JsxAttributeValue | undefined): JsxAttribute;
3751
3752
  createJsxAttributes(properties: readonly JsxAttributeLike[]): JsxAttributes;
3752
3753
  updateJsxAttributes(node: JsxAttributes, properties: readonly JsxAttributeLike[]): JsxAttributes;
3753
3754
  createJsxSpreadAttribute(expression: Expression): JsxSpreadAttribute;
@@ -7481,9 +7482,9 @@ declare namespace ts {
7481
7482
  /** @deprecated Use `factory.updateJsxFragment` or the factory supplied by your transformation context instead. */
7482
7483
  const updateJsxFragment: (node: JsxFragment, openingFragment: JsxOpeningFragment, children: readonly JsxChild[], closingFragment: JsxClosingFragment) => JsxFragment;
7483
7484
  /** @deprecated Use `factory.createJsxAttribute` or the factory supplied by your transformation context instead. */
7484
- const createJsxAttribute: (name: Identifier, initializer: StringLiteral | JsxExpression | undefined) => JsxAttribute;
7485
+ const createJsxAttribute: (name: Identifier, initializer: JsxAttributeValue | undefined) => JsxAttribute;
7485
7486
  /** @deprecated Use `factory.updateJsxAttribute` or the factory supplied by your transformation context instead. */
7486
- const updateJsxAttribute: (node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression | undefined) => JsxAttribute;
7487
+ const updateJsxAttribute: (node: JsxAttribute, name: Identifier, initializer: JsxAttributeValue | undefined) => JsxAttribute;
7487
7488
  /** @deprecated Use `factory.createJsxAttributes` or the factory supplied by your transformation context instead. */
7488
7489
  const createJsxAttributes: (properties: readonly JsxAttributeLike[]) => JsxAttributes;
7489
7490
  /** @deprecated Use `factory.updateJsxAttributes` or the factory supplied by your transformation context instead. */
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220511";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220514";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8336,6 +8336,7 @@ var ts;
8336
8336
  String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."),
8337
8337
  Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."),
8338
8338
  or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."),
8339
+ or_JSX_element_expected: diag(1145, ts.DiagnosticCategory.Error, "or_JSX_element_expected_1145", "'{' or JSX element expected."),
8339
8340
  Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."),
8340
8341
  Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."),
8341
8342
  Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."),
@@ -8481,6 +8482,7 @@ var ts;
8481
8482
  infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type: diag(1338, ts.DiagnosticCategory.Error, "infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type_1338", "'infer' declarations are only permitted in the 'extends' clause of a conditional type."),
8482
8483
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
8483
8484
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
8485
+ Class_constructor_may_not_be_an_accessor: diag(1341, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
8484
8486
  Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
8485
8487
  The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
8486
8488
  A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
@@ -8499,6 +8501,7 @@ var ts;
8499
8501
  An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."),
8500
8502
  Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."),
8501
8503
  Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."),
8504
+ Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."),
8502
8505
  _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."),
8503
8506
  _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."),
8504
8507
  A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."),
@@ -9088,6 +9091,7 @@ var ts;
9088
9091
  Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
9089
9092
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
9090
9093
  All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
9094
+ This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
9091
9095
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
9092
9096
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
9093
9097
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -13398,6 +13402,19 @@ var ts;
13398
13402
  return isLiteralKind(node.kind);
13399
13403
  }
13400
13404
  ts.isLiteralExpression = isLiteralExpression;
13405
+ /** @internal */
13406
+ function isLiteralExpressionOfObject(node) {
13407
+ switch (node.kind) {
13408
+ case 205 /* ObjectLiteralExpression */:
13409
+ case 204 /* ArrayLiteralExpression */:
13410
+ case 13 /* RegularExpressionLiteral */:
13411
+ case 213 /* FunctionExpression */:
13412
+ case 226 /* ClassExpression */:
13413
+ return true;
13414
+ }
13415
+ return false;
13416
+ }
13417
+ ts.isLiteralExpressionOfObject = isLiteralExpressionOfObject;
13401
13418
  // Pseudo-literals
13402
13419
  /* @internal */
13403
13420
  function isTemplateLiteralKind(kind) {
@@ -35396,9 +35413,22 @@ var ts;
35396
35413
  }
35397
35414
  scanJsxIdentifier();
35398
35415
  var pos = getNodePos();
35399
- return finishNode(factory.createJsxAttribute(parseIdentifierName(), token() !== 63 /* EqualsToken */ ? undefined :
35400
- scanJsxAttributeValue() === 10 /* StringLiteral */ ? parseLiteralNode() :
35401
- parseJsxExpression(/*inExpressionContext*/ true)), pos);
35416
+ return finishNode(factory.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos);
35417
+ }
35418
+ function parseJsxAttributeValue() {
35419
+ if (token() === 63 /* EqualsToken */) {
35420
+ if (scanJsxAttributeValue() === 10 /* StringLiteral */) {
35421
+ return parseLiteralNode();
35422
+ }
35423
+ if (token() === 18 /* OpenBraceToken */) {
35424
+ return parseJsxExpression(/*inExpressionContext*/ true);
35425
+ }
35426
+ if (token() === 29 /* LessThanToken */) {
35427
+ return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true);
35428
+ }
35429
+ parseErrorAtCurrentToken(ts.Diagnostics.or_JSX_element_expected);
35430
+ }
35431
+ return undefined;
35402
35432
  }
35403
35433
  function parseJsxSpreadAttribute() {
35404
35434
  var pos = getNodePos();
@@ -51671,8 +51701,9 @@ var ts;
51671
51701
  function getExportSymbolOfValueSymbolIfExported(symbol) {
51672
51702
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
51673
51703
  }
51674
- function symbolIsValue(symbol) {
51675
- return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
51704
+ function symbolIsValue(symbol, includeTypeOnlyMembers) {
51705
+ return !!(symbol.flags & 111551 /* Value */ ||
51706
+ symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol)));
51676
51707
  }
51677
51708
  function findConstructorDeclaration(node) {
51678
51709
  var members = node.members;
@@ -59362,12 +59393,12 @@ var ts;
59362
59393
  * @param type a type to look up property from
59363
59394
  * @param name a name of property to look up in a given type
59364
59395
  */
59365
- function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment) {
59396
+ function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
59366
59397
  type = getReducedApparentType(type);
59367
59398
  if (type.flags & 524288 /* Object */) {
59368
59399
  var resolved = resolveStructuredTypeMembers(type);
59369
59400
  var symbol = resolved.members.get(name);
59370
- if (symbol && symbolIsValue(symbol)) {
59401
+ if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
59371
59402
  return symbol;
59372
59403
  }
59373
59404
  if (skipObjectFunctionPropertyAugment)
@@ -62747,7 +62778,7 @@ var ts;
62747
62778
  // the `exports` lookup process that only looks up namespace members which is used for most type references
62748
62779
  var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
62749
62780
  var next = node.isTypeOf
62750
- ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText)
62781
+ ? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ true)
62751
62782
  : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
62752
62783
  if (!next) {
62753
62784
  error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
@@ -74663,9 +74694,8 @@ var ts;
74663
74694
  markAliasReferenced(parentSymbol, node);
74664
74695
  }
74665
74696
  return isErrorType(apparentType) ? errorType : apparentType;
74666
- ;
74667
74697
  }
74668
- prop = getPropertyOfType(apparentType, right.escapedText);
74698
+ prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* QualifiedName */);
74669
74699
  }
74670
74700
  // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
74671
74701
  // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
@@ -79157,6 +79187,10 @@ var ts;
79157
79187
  case 35 /* ExclamationEqualsToken */:
79158
79188
  case 36 /* EqualsEqualsEqualsToken */:
79159
79189
  case 37 /* ExclamationEqualsEqualsToken */:
79190
+ if (ts.isLiteralExpressionOfObject(left) || ts.isLiteralExpressionOfObject(right)) {
79191
+ var eqType = operator === 34 /* EqualsEqualsToken */ || operator === 36 /* EqualsEqualsEqualsToken */;
79192
+ error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
79193
+ }
79160
79194
  reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
79161
79195
  return booleanType;
79162
79196
  case 102 /* InstanceOfKeyword */:
@@ -80448,6 +80482,9 @@ var ts;
80448
80482
  // Grammar checking
80449
80483
  if (!checkGrammarMethod(node))
80450
80484
  checkGrammarComputedPropertyName(node.name);
80485
+ if (ts.isMethodDeclaration(node) && node.asteriskToken && ts.isIdentifier(node.name) && ts.idText(node.name) === "constructor") {
80486
+ error(node.name, ts.Diagnostics.Class_constructor_may_not_be_a_generator);
80487
+ }
80451
80488
  // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration
80452
80489
  checkFunctionOrMethodDeclaration(node);
80453
80490
  // method signatures already report "implementation not allowed in ambient context" elsewhere
@@ -80575,6 +80612,9 @@ var ts;
80575
80612
  return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
80576
80613
  }
80577
80614
  function checkAccessorDeclaration(node) {
80615
+ if (ts.isIdentifier(node.name) && ts.idText(node.name) === "constructor") {
80616
+ error(node.name, ts.Diagnostics.Class_constructor_may_not_be_an_accessor);
80617
+ }
80578
80618
  addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
80579
80619
  checkSourceElement(node.body);
80580
80620
  setNodeLinksForPrivateIdentifierScope(node);
@@ -98003,22 +98043,29 @@ var ts;
98003
98043
  if (node === undefined) {
98004
98044
  return factory.createTrue();
98005
98045
  }
98006
- else if (node.kind === 10 /* StringLiteral */) {
98046
+ if (node.kind === 10 /* StringLiteral */) {
98007
98047
  // Always recreate the literal to escape any escape sequences or newlines which may be in the original jsx string and which
98008
98048
  // Need to be escaped to be handled correctly in a normal string
98009
98049
  var singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
98010
98050
  var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote);
98011
98051
  return ts.setTextRange(literal, node);
98012
98052
  }
98013
- else if (node.kind === 288 /* JsxExpression */) {
98053
+ if (node.kind === 288 /* JsxExpression */) {
98014
98054
  if (node.expression === undefined) {
98015
98055
  return factory.createTrue();
98016
98056
  }
98017
98057
  return ts.visitNode(node.expression, visitor, ts.isExpression);
98018
98058
  }
98019
- else {
98020
- return ts.Debug.failBadSyntaxKind(node);
98059
+ if (ts.isJsxElement(node)) {
98060
+ return visitJsxElement(node, /*isChild*/ false);
98061
+ }
98062
+ if (ts.isJsxSelfClosingElement(node)) {
98063
+ return visitJsxSelfClosingElement(node, /*isChild*/ false);
98064
+ }
98065
+ if (ts.isJsxFragment(node)) {
98066
+ return visitJsxFragment(node, /*isChild*/ false);
98021
98067
  }
98068
+ return ts.Debug.failBadSyntaxKind(node);
98022
98069
  }
98023
98070
  function visitJsxText(node) {
98024
98071
  var fixed = fixupWhitespaceAndDecodeEntities(node.text);
@@ -116592,6 +116639,8 @@ var ts;
116592
116639
  ts.Diagnostics.extends_clause_already_seen.code,
116593
116640
  ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
116594
116641
  ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
116642
+ ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
116643
+ ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
116595
116644
  ]);
116596
116645
  /**
116597
116646
  * Determine if source file needs to be re-created even if its text hasn't changed
@@ -123119,6 +123168,13 @@ var ts;
123119
123168
  ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
123120
123169
  WildcardDirectoryOfReferencedProject: "Wild card directory of referenced project",
123121
123170
  PackageJson: "package.json file",
123171
+ ClosedScriptInfo: "Closed Script info",
123172
+ ConfigFileForInferredRoot: "Config file for the inferred project root",
123173
+ NodeModules: "node_modules for closed script infos and package.jsons affecting module specifier cache",
123174
+ MissingSourceMapFile: "Missing source map file",
123175
+ NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
123176
+ MissingGeneratedFile: "Missing generated file",
123177
+ NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
123122
123178
  };
123123
123179
  function createWatchFactory(host, options) {
123124
123180
  var watchLogLevel = host.trace ? options.extendedDiagnostics ? ts.WatchLogLevel.Verbose : options.diagnostics ? ts.WatchLogLevel.TriggerOnly : ts.WatchLogLevel.None : ts.WatchLogLevel.None;
@@ -166302,7 +166358,7 @@ var ts;
166302
166358
  function getDefaultLibFilePath(options) {
166303
166359
  // Check __dirname is defined and that we are on a node.js system.
166304
166360
  if (typeof __dirname !== "undefined") {
166305
- return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options);
166361
+ return ts.combinePaths(__dirname, ts.getDefaultLibFileName(options));
166306
166362
  }
166307
166363
  throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ");
166308
166364
  }