typescript 4.4.0-dev.20210806 → 4.4.2

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.
@@ -21,7 +21,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
21
21
  ar[i] = from[i];
22
22
  }
23
23
  }
24
- return to.concat(ar || from);
24
+ return to.concat(ar || Array.prototype.slice.call(from));
25
25
  };
26
26
  var __assign = (this && this.__assign) || function () {
27
27
  __assign = Object.assign || function(t) {
@@ -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.20210806";
297
+ ts.version = "4.4.2";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8170,7 +8170,7 @@ var ts;
8170
8170
  Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
8171
8171
  Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
8172
8172
  _0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module: diag(1208, ts.DiagnosticCategory.Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."),
8173
- Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
8173
+ Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode: diag(1210, ts.DiagnosticCategory.Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),
8174
8174
  A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
8175
8175
  Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
8176
8176
  Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: diag(1213, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."),
@@ -9772,6 +9772,8 @@ var ts;
9772
9772
  Can_only_convert_named_export: diag(95164, ts.DiagnosticCategory.Message, "Can_only_convert_named_export_95164", "Can only convert named export"),
9773
9773
  Add_missing_properties: diag(95165, ts.DiagnosticCategory.Message, "Add_missing_properties_95165", "Add missing properties"),
9774
9774
  Add_all_missing_properties: diag(95166, ts.DiagnosticCategory.Message, "Add_all_missing_properties_95166", "Add all missing properties"),
9775
+ Add_missing_attributes: diag(95167, ts.DiagnosticCategory.Message, "Add_missing_attributes_95167", "Add missing attributes"),
9776
+ Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
9775
9777
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
9776
9778
  Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
9777
9779
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -20863,6 +20865,11 @@ var ts;
20863
20865
  return false;
20864
20866
  }
20865
20867
  ts.hasContextSensitiveParameters = hasContextSensitiveParameters;
20868
+ /* @internal */
20869
+ function isInfinityOrNaNString(name) {
20870
+ return name === "Infinity" || name === "-Infinity" || name === "NaN";
20871
+ }
20872
+ ts.isInfinityOrNaNString = isInfinityOrNaNString;
20866
20873
  })(ts || (ts = {}));
20867
20874
  /* @internal */
20868
20875
  var ts;
@@ -27420,7 +27427,7 @@ var ts;
27420
27427
  name: "typescript:spreadArray",
27421
27428
  importName: "__spreadArray",
27422
27429
  scoped: false,
27423
- text: "\n var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || from);\n };"
27430
+ text: "\n var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n };"
27424
27431
  };
27425
27432
  // ES2015 Destructuring Helpers
27426
27433
  ts.valuesHelper = {
@@ -44466,7 +44473,7 @@ var ts;
44466
44473
  // Provide specialized messages to help the user understand why we think they're in
44467
44474
  // strict mode.
44468
44475
  if (ts.getContainingClass(node)) {
44469
- return ts.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;
44476
+ return ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode;
44470
44477
  }
44471
44478
  if (file.externalModuleIndicator) {
44472
44479
  return ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode;
@@ -70060,9 +70067,6 @@ var ts;
70060
70067
  // but this behavior is consistent with checkIndexedAccess
70061
70068
  return isTypeAssignableToKind(checkComputedPropertyName(name), 296 /* NumberLike */);
70062
70069
  }
70063
- function isInfinityOrNaNString(name) {
70064
- return name === "Infinity" || name === "-Infinity" || name === "NaN";
70065
- }
70066
70070
  function isNumericLiteralName(name) {
70067
70071
  // The intent of numeric names is that
70068
70072
  // - they are names with text in a numeric form, and that
@@ -80354,8 +80358,8 @@ var ts;
80354
80358
  error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
80355
80359
  error(member, ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
80356
80360
  }
80357
- else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.valueDeclaration) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
80358
- var baseHasAbstract = ts.hasAbstractModifier(baseProp.valueDeclaration);
80361
+ else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
80362
+ var baseHasAbstract = ts.some(baseProp.declarations, function (d) { return ts.hasAbstractModifier(d); });
80359
80363
  if (hasOverride) {
80360
80364
  return;
80361
80365
  }
@@ -80735,7 +80739,7 @@ var ts;
80735
80739
  }
80736
80740
  else {
80737
80741
  var text = ts.getTextOfPropertyName(member.name);
80738
- if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
80742
+ if (isNumericLiteralName(text) && !ts.isInfinityOrNaNString(text)) {
80739
80743
  error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name);
80740
80744
  }
80741
80745
  }
@@ -80835,7 +80839,7 @@ var ts;
80835
80839
  return evaluate(expr.expression);
80836
80840
  case 79 /* Identifier */:
80837
80841
  var identifier = expr;
80838
- if (isInfinityOrNaNString(identifier.escapedText)) {
80842
+ if (ts.isInfinityOrNaNString(identifier.escapedText)) {
80839
80843
  return +(identifier.escapedText);
80840
80844
  }
80841
80845
  return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
@@ -121729,7 +121733,7 @@ var ts;
121729
121733
  if (ts.isClassDeclaration(node)) {
121730
121734
  // for class and function declarations, use the `default` modifier
121731
121735
  // when the declaration is unnamed.
121732
- var defaultModifier = ts.find(node.modifiers, isDefaultModifier);
121736
+ var defaultModifier = node.modifiers && ts.find(node.modifiers, isDefaultModifier);
121733
121737
  if (defaultModifier)
121734
121738
  return defaultModifier;
121735
121739
  }
@@ -125487,7 +125491,7 @@ var ts;
125487
125491
  if (ts.isJsxExpression(node)) {
125488
125492
  inJSXElement = false;
125489
125493
  }
125490
- if (ts.isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) {
125494
+ if (ts.isIdentifier(node) && !inJSXElement && !inImportClause(node) && !ts.isInfinityOrNaNString(node.escapedText)) {
125491
125495
  var symbol = typeChecker.getSymbolAtLocation(node);
125492
125496
  if (symbol) {
125493
125497
  if (symbol.flags & 2097152 /* Alias */) {
@@ -125619,9 +125623,6 @@ var ts;
125619
125623
  function isRightSideOfQualifiedNameOrPropertyAccess(node) {
125620
125624
  return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node);
125621
125625
  }
125622
- function isInfinityOrNaNString(name) {
125623
- return name === "Infinity" || name === "NaN";
125624
- }
125625
125626
  var tokenFromDeclarationMapping = new ts.Map([
125626
125627
  [252 /* VariableDeclaration */, 7 /* variable */],
125627
125628
  [162 /* Parameter */, 6 /* parameter */],
@@ -137684,7 +137685,7 @@ var ts;
137684
137685
  for (var i = 0; i < args.length; ++i) {
137685
137686
  var originalArg = args[i];
137686
137687
  var arg = ts.skipParentheses(originalArg);
137687
- if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableExpression(arg)) {
137688
+ if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
137688
137689
  continue;
137689
137690
  }
137690
137691
  var identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i);
@@ -137722,8 +137723,22 @@ var ts;
137722
137723
  var regex = leadingParameterNameCommentRegexFactory(name);
137723
137724
  return ts.some(ranges, function (range) { return regex.test(sourceFileText.substring(range.pos, range.end)); });
137724
137725
  }
137725
- function isHintableExpression(node) {
137726
- return ts.isLiteralExpression(node) || ts.isBooleanLiteral(node) || ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isObjectLiteralExpression(node) || ts.isArrayLiteralExpression(node);
137726
+ function isHintableLiteral(node) {
137727
+ switch (node.kind) {
137728
+ case 217 /* PrefixUnaryExpression */: {
137729
+ var operand = node.operand;
137730
+ return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText);
137731
+ }
137732
+ case 110 /* TrueKeyword */:
137733
+ case 95 /* FalseKeyword */:
137734
+ case 104 /* NullKeyword */:
137735
+ return true;
137736
+ case 79 /* Identifier */: {
137737
+ var name = node.escapedText;
137738
+ return isUndefined(name) || ts.isInfinityOrNaNString(name);
137739
+ }
137740
+ }
137741
+ return ts.isLiteralExpression(node);
137727
137742
  }
137728
137743
  function visitFunctionDeclarationLikeForReturnType(decl) {
137729
137744
  if (ts.isArrowFunction(decl)) {
@@ -137801,6 +137816,9 @@ var ts;
137801
137816
  printer.writeNode(4 /* Unspecified */, typeNode, /*sourceFile*/ file, writer);
137802
137817
  });
137803
137818
  }
137819
+ function isUndefined(name) {
137820
+ return name === "undefined";
137821
+ }
137804
137822
  }
137805
137823
  InlayHints.provideInlayHints = provideInlayHints;
137806
137824
  })(InlayHints = ts.InlayHints || (ts.InlayHints = {}));
@@ -147056,6 +147074,7 @@ var ts;
147056
147074
  (function (codefix) {
147057
147075
  var fixMissingMember = "fixMissingMember";
147058
147076
  var fixMissingProperties = "fixMissingProperties";
147077
+ var fixMissingAttributes = "fixMissingAttributes";
147059
147078
  var fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
147060
147079
  var errorCodes = [
147061
147080
  ts.Diagnostics.Property_0_does_not_exist_on_type_1.code,
@@ -147077,6 +147096,10 @@ var ts;
147077
147096
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); });
147078
147097
  return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)];
147079
147098
  }
147099
+ if (info.kind === 4 /* JsxAttributes */) {
147100
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); });
147101
+ return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)];
147102
+ }
147080
147103
  if (info.kind === 2 /* Function */) {
147081
147104
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
147082
147105
  return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
@@ -147087,7 +147110,7 @@ var ts;
147087
147110
  }
147088
147111
  return ts.concatenate(getActionsForMissingMethodDeclaration(context, info), getActionsForMissingMemberDeclaration(context, info));
147089
147112
  },
147090
- fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties],
147113
+ fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
147091
147114
  getAllCodeActions: function (context) {
147092
147115
  var program = context.program, fixId = context.fixId;
147093
147116
  var checker = program.getTypeChecker();
@@ -147099,15 +147122,14 @@ var ts;
147099
147122
  if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
147100
147123
  return;
147101
147124
  }
147102
- if (fixId === fixMissingFunctionDeclaration) {
147103
- if (info.kind === 2 /* Function */) {
147104
- addFunctionDeclaration(changes, context, info);
147105
- }
147125
+ if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* Function */) {
147126
+ addFunctionDeclaration(changes, context, info);
147106
147127
  }
147107
- else if (fixId === fixMissingProperties) {
147108
- if (info.kind === 3 /* ObjectLiteral */) {
147109
- addObjectLiteralProperties(changes, context, info);
147110
- }
147128
+ else if (fixId === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
147129
+ addObjectLiteralProperties(changes, context, info);
147130
+ }
147131
+ else if (fixId === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
147132
+ addJsxAttributes(changes, context, info);
147111
147133
  }
147112
147134
  else {
147113
147135
  if (info.kind === 0 /* Enum */) {
@@ -147163,6 +147185,7 @@ var ts;
147163
147185
  InfoKind[InfoKind["ClassOrInterface"] = 1] = "ClassOrInterface";
147164
147186
  InfoKind[InfoKind["Function"] = 2] = "Function";
147165
147187
  InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
147188
+ InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
147166
147189
  })(InfoKind || (InfoKind = {}));
147167
147190
  function getInfo(sourceFile, tokenPos, checker, program) {
147168
147191
  // The identifier of the missing property. eg:
@@ -147179,6 +147202,12 @@ var ts;
147179
147202
  return { kind: 3 /* ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer };
147180
147203
  }
147181
147204
  }
147205
+ if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
147206
+ var attributes = getUnmatchedAttributes(checker, token.parent);
147207
+ if (ts.length(attributes)) {
147208
+ return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
147209
+ }
147210
+ }
147182
147211
  if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
147183
147212
  return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
147184
147213
  }
@@ -147407,17 +147436,31 @@ var ts;
147407
147436
  var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(254 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration);
147408
147437
  changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
147409
147438
  }
147439
+ function addJsxAttributes(changes, context, info) {
147440
+ var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
147441
+ var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
147442
+ var checker = context.program.getTypeChecker();
147443
+ var jsxAttributesNode = info.parentDeclaration.attributes;
147444
+ var hasSpreadAttribute = ts.some(jsxAttributesNode.properties, ts.isJsxSpreadAttribute);
147445
+ var attrs = ts.map(info.attributes, function (attr) {
147446
+ var value = attr.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(attr.valueDeclaration)) : createUndefined();
147447
+ return ts.factory.createJsxAttribute(ts.factory.createIdentifier(attr.name), ts.factory.createJsxExpression(/*dotDotDotToken*/ undefined, value));
147448
+ });
147449
+ var jsxAttributes = ts.factory.createJsxAttributes(hasSpreadAttribute ? __spreadArray(__spreadArray([], attrs, true), jsxAttributesNode.properties, true) : __spreadArray(__spreadArray([], jsxAttributesNode.properties, true), attrs, true));
147450
+ var options = { prefix: jsxAttributesNode.pos === jsxAttributesNode.end ? " " : undefined };
147451
+ changes.replaceNode(context.sourceFile, jsxAttributesNode, jsxAttributes, options);
147452
+ }
147410
147453
  function addObjectLiteralProperties(changes, context, info) {
147411
147454
  var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
147412
147455
  var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
147413
147456
  var checker = context.program.getTypeChecker();
147414
147457
  var props = ts.map(info.properties, function (prop) {
147415
- var initializer = prop.valueDeclaration ? tryGetInitializerValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
147458
+ var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
147416
147459
  return ts.factory.createPropertyAssignment(prop.name, initializer);
147417
147460
  });
147418
147461
  changes.replaceNode(context.sourceFile, info.parentDeclaration, ts.factory.createObjectLiteralExpression(__spreadArray(__spreadArray([], info.parentDeclaration.properties, true), props, true), /*multiLine*/ true));
147419
147462
  }
147420
- function tryGetInitializerValueFromType(context, checker, importAdder, quotePreference, type) {
147463
+ function tryGetValueFromType(context, checker, importAdder, quotePreference, type) {
147421
147464
  if (type.flags & 3 /* AnyOrUnknown */) {
147422
147465
  return createUndefined();
147423
147466
  }
@@ -147454,7 +147497,7 @@ var ts;
147454
147497
  return ts.factory.createNull();
147455
147498
  }
147456
147499
  if (type.flags & 1048576 /* Union */) {
147457
- var expression = ts.firstDefined(type.types, function (t) { return tryGetInitializerValueFromType(context, checker, importAdder, quotePreference, t); });
147500
+ var expression = ts.firstDefined(type.types, function (t) { return tryGetValueFromType(context, checker, importAdder, quotePreference, t); });
147458
147501
  return expression !== null && expression !== void 0 ? expression : createUndefined();
147459
147502
  }
147460
147503
  if (checker.isArrayLikeType(type)) {
@@ -147462,7 +147505,7 @@ var ts;
147462
147505
  }
147463
147506
  if (isObjectLiteralType(type)) {
147464
147507
  var props = ts.map(checker.getPropertiesOfType(type), function (prop) {
147465
- var initializer = prop.valueDeclaration ? tryGetInitializerValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
147508
+ var initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration)) : createUndefined();
147466
147509
  return ts.factory.createPropertyAssignment(prop.name, initializer);
147467
147510
  });
147468
147511
  return ts.factory.createObjectLiteralExpression(props, /*multiLine*/ true);
@@ -147495,6 +147538,31 @@ var ts;
147495
147538
  return (type.flags & 524288 /* Object */) &&
147496
147539
  ((ts.getObjectFlags(type) & 128 /* ObjectLiteral */) || (type.symbol && ts.tryCast(ts.singleOrUndefined(type.symbol.declarations), ts.isTypeLiteralNode)));
147497
147540
  }
147541
+ function getUnmatchedAttributes(checker, source) {
147542
+ var attrsType = checker.getContextualType(source.attributes);
147543
+ if (attrsType === undefined)
147544
+ return ts.emptyArray;
147545
+ var targetProps = attrsType.getProperties();
147546
+ if (!ts.length(targetProps))
147547
+ return ts.emptyArray;
147548
+ var seenNames = new ts.Set();
147549
+ for (var _i = 0, _a = source.attributes.properties; _i < _a.length; _i++) {
147550
+ var sourceProp = _a[_i];
147551
+ if (ts.isJsxAttribute(sourceProp)) {
147552
+ seenNames.add(sourceProp.name.escapedText);
147553
+ }
147554
+ if (ts.isJsxSpreadAttribute(sourceProp)) {
147555
+ var type = checker.getTypeAtLocation(sourceProp.expression);
147556
+ for (var _b = 0, _c = type.getProperties(); _b < _c.length; _b++) {
147557
+ var prop = _c[_b];
147558
+ seenNames.add(prop.escapedName);
147559
+ }
147560
+ }
147561
+ }
147562
+ return ts.filter(targetProps, function (targetProp) {
147563
+ return !((targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */) || seenNames.has(targetProp.escapedName));
147564
+ });
147565
+ }
147498
147566
  })(codefix = ts.codefix || (ts.codefix = {}));
147499
147567
  })(ts || (ts = {}));
147500
147568
  /* @internal */
@@ -160219,12 +160287,6 @@ var ts;
160219
160287
  /** Completion was re-triggered as the current completion list is incomplete. */
160220
160288
  CompletionTriggerKind[CompletionTriggerKind["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
160221
160289
  })(CompletionTriggerKind = protocol.CompletionTriggerKind || (protocol.CompletionTriggerKind = {}));
160222
- var InlayHintKind;
160223
- (function (InlayHintKind) {
160224
- InlayHintKind["Type"] = "Type";
160225
- InlayHintKind["Parameter"] = "Parameter";
160226
- InlayHintKind["Enum"] = "Enum";
160227
- })(InlayHintKind = protocol.InlayHintKind || (protocol.InlayHintKind = {}));
160228
160290
  var IndentStyle;
160229
160291
  (function (IndentStyle) {
160230
160292
  IndentStyle["None"] = "None";
@@ -168023,9 +168085,9 @@ var ts;
168023
168085
  });
168024
168086
  };
168025
168087
  Session.prototype.provideInlayHints = function (args) {
168026
- var _a = this.getFileAndLanguageServiceForSyntacticOperation(args), file = _a.file, languageService = _a.languageService;
168088
+ var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
168027
168089
  var scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
168028
- var hints = languageService.provideInlayHints(file, args, this.getPreferences(file));
168090
+ var hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
168029
168091
  return hints.map(function (hint) { return (__assign(__assign({}, hint), { position: scriptInfo.positionToLineOffset(hint.position) })); });
168030
168092
  };
168031
168093
  Session.prototype.setCompilerOptionsForInferredProjects = function (args) {
@@ -5886,7 +5886,7 @@ declare namespace ts {
5886
5886
  interface InlayHint {
5887
5887
  text: string;
5888
5888
  position: number;
5889
- kind?: InlayHintKind;
5889
+ kind: InlayHintKind;
5890
5890
  whitespaceBefore?: boolean;
5891
5891
  whitespaceAfter?: boolean;
5892
5892
  }