typescript 5.4.0-dev.20231129 → 5.4.0-dev.20231130

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.
@@ -47,12 +47,13 @@ declare namespace Intl {
47
47
  select(n: number): LDMLPluralRule;
48
48
  }
49
49
 
50
- const PluralRules: {
50
+ interface PluralRulesConstructor {
51
51
  new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
52
52
  (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
53
-
54
53
  supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
55
- };
54
+ }
55
+
56
+ const PluralRules: PluralRulesConstructor;
56
57
 
57
58
  // We can only have one definition for 'type' in TypeScript, and so you can learn where the keys come from here:
58
59
  type ES2018NumberFormatPartType = "literal" | "nan" | "infinity" | "percent" | "integer" | "group" | "decimal" | "fraction" | "plusSign" | "minusSign" | "percentSign" | "currency" | "code" | "symbol" | "name";
@@ -19,9 +19,11 @@ and limitations under the License.
19
19
  /// <reference lib="es2018.intl" />
20
20
  declare namespace Intl {
21
21
  /**
22
- * [Unicode BCP 47 Locale Identifiers](https://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) definition.
22
+ * A string that is a valid [Unicode BCP 47 Locale Identifier](https://unicode.org/reports/tr35/#Unicode_locale_identifier).
23
23
  *
24
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
24
+ * For example: "fa", "es-MX", "zh-Hant-TW".
25
+ *
26
+ * See [MDN - Intl - locales argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
25
27
  */
26
28
  type UnicodeBCP47LocaleIdentifier = string;
27
29
 
@@ -89,16 +91,9 @@ declare namespace Intl {
89
91
  type RelativeTimeFormatStyle = "long" | "short" | "narrow";
90
92
 
91
93
  /**
92
- * [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.
94
+ * The locale or locales to use
93
95
  *
94
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
95
- */
96
- type BCP47LanguageTag = string;
97
-
98
- /**
99
- * The locale(s) to use
100
- *
101
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
96
+ * See [MDN - Intl - locales argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
102
97
  */
103
98
  type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | readonly (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
104
99
 
@@ -218,7 +213,7 @@ declare namespace Intl {
218
213
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
219
214
  */
220
215
  new (
221
- locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
216
+ locales?: LocalesArgument,
222
217
  options?: RelativeTimeFormatOptions,
223
218
  ): RelativeTimeFormat;
224
219
 
@@ -241,7 +236,7 @@ declare namespace Intl {
241
236
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).
242
237
  */
243
238
  supportedLocalesOf(
244
- locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
239
+ locales?: LocalesArgument,
245
240
  options?: RelativeTimeFormatOptions,
246
241
  ): UnicodeBCP47LocaleIdentifier[];
247
242
  };
@@ -312,7 +307,7 @@ declare namespace Intl {
312
307
  /** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
313
308
  minimize(): Locale;
314
309
  /** Returns the locale's full locale identifier string. */
315
- toString(): BCP47LanguageTag;
310
+ toString(): UnicodeBCP47LocaleIdentifier;
316
311
  }
317
312
 
318
313
  /**
@@ -330,7 +325,7 @@ declare namespace Intl {
330
325
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
331
326
  */
332
327
  const Locale: {
333
- new (tag: BCP47LanguageTag | Locale, options?: LocaleOptions): Locale;
328
+ new (tag: UnicodeBCP47LocaleIdentifier | Locale, options?: LocaleOptions): Locale;
334
329
  };
335
330
 
336
331
  type DisplayNamesFallback =
@@ -424,6 +419,31 @@ declare namespace Intl {
424
419
  *
425
420
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
426
421
  */
427
- supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): BCP47LanguageTag[];
422
+ supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
428
423
  };
424
+
425
+ interface CollatorConstructor {
426
+ new (locales?: LocalesArgument, options?: CollatorOptions): Collator;
427
+ (locales?: LocalesArgument, options?: CollatorOptions): Collator;
428
+ supportedLocalesOf(locales: LocalesArgument, options?: CollatorOptions): string[];
429
+ }
430
+
431
+ interface DateTimeFormatConstructor {
432
+ new (locales?: LocalesArgument, options?: DateTimeFormatOptions): DateTimeFormat;
433
+ (locales?: LocalesArgument, options?: DateTimeFormatOptions): DateTimeFormat;
434
+ supportedLocalesOf(locales: LocalesArgument, options?: DateTimeFormatOptions): string[];
435
+ }
436
+
437
+ interface NumberFormatConstructor {
438
+ new (locales?: LocalesArgument, options?: NumberFormatOptions): NumberFormat;
439
+ (locales?: LocalesArgument, options?: NumberFormatOptions): NumberFormat;
440
+ supportedLocalesOf(locales: LocalesArgument, options?: NumberFormatOptions): string[];
441
+ }
442
+
443
+ interface PluralRulesConstructor {
444
+ new (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
445
+ (locales?: LocalesArgument, options?: PluralRulesOptions): PluralRules;
446
+
447
+ supportedLocalesOf(locales: LocalesArgument, options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
448
+ }
429
449
  }
@@ -25,4 +25,18 @@ interface String {
25
25
  * @param regexp A variable name or string literal containing the regular expression pattern and flags.
26
26
  */
27
27
  matchAll(regexp: RegExp): IterableIterator<RegExpMatchArray>;
28
+
29
+ /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */
30
+ toLocaleLowerCase(locales?: Intl.LocalesArgument): string;
31
+
32
+ /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */
33
+ toLocaleUpperCase(locales?: Intl.LocalesArgument): string;
34
+
35
+ /**
36
+ * Determines whether two strings are equivalent in the current or specified locale.
37
+ * @param that String to compare to target string
38
+ * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
39
+ * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
40
+ */
41
+ localeCompare(that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions): number;
28
42
  }
@@ -143,7 +143,7 @@ declare namespace Intl {
143
143
  *
144
144
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat).
145
145
  */
146
- new (locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: ListFormatOptions): ListFormat;
146
+ new (locales?: LocalesArgument, options?: ListFormatOptions): ListFormat;
147
147
 
148
148
  /**
149
149
  * Returns an array containing those of the provided locales that are
@@ -161,6 +161,6 @@ declare namespace Intl {
161
161
  *
162
162
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf).
163
163
  */
164
- supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick<ListFormatOptions, "localeMatcher">): BCP47LanguageTag[];
164
+ supportedLocalesOf(locales: LocalesArgument, options?: Pick<ListFormatOptions, "localeMatcher">): UnicodeBCP47LocaleIdentifier[];
165
165
  };
166
166
  }
@@ -89,7 +89,7 @@ declare namespace Intl {
89
89
  *
90
90
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter).
91
91
  */
92
- new (locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: SegmenterOptions): Segmenter;
92
+ new (locales?: LocalesArgument, options?: SegmenterOptions): Segmenter;
93
93
 
94
94
  /**
95
95
  * Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.
@@ -103,7 +103,7 @@ declare namespace Intl {
103
103
  *
104
104
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/supportedLocalesOf)
105
105
  */
106
- supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick<SegmenterOptions, "localeMatcher">): BCP47LanguageTag[];
106
+ supportedLocalesOf(locales: LocalesArgument, options?: Pick<SegmenterOptions, "localeMatcher">): UnicodeBCP47LocaleIdentifier[];
107
107
  };
108
108
 
109
109
  /**
package/lib/lib.es5.d.ts CHANGED
@@ -4418,11 +4418,14 @@ declare namespace Intl {
4418
4418
  compare(x: string, y: string): number;
4419
4419
  resolvedOptions(): ResolvedCollatorOptions;
4420
4420
  }
4421
- var Collator: {
4421
+
4422
+ interface CollatorConstructor {
4422
4423
  new (locales?: string | string[], options?: CollatorOptions): Collator;
4423
4424
  (locales?: string | string[], options?: CollatorOptions): Collator;
4424
4425
  supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];
4425
- };
4426
+ }
4427
+
4428
+ var Collator: CollatorConstructor;
4426
4429
 
4427
4430
  interface NumberFormatOptions {
4428
4431
  localeMatcher?: string | undefined;
@@ -4454,12 +4457,15 @@ declare namespace Intl {
4454
4457
  format(value: number): string;
4455
4458
  resolvedOptions(): ResolvedNumberFormatOptions;
4456
4459
  }
4457
- var NumberFormat: {
4460
+
4461
+ interface NumberFormatConstructor {
4458
4462
  new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
4459
4463
  (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
4460
4464
  supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
4461
4465
  readonly prototype: NumberFormat;
4462
- };
4466
+ }
4467
+
4468
+ var NumberFormat: NumberFormatConstructor;
4463
4469
 
4464
4470
  interface DateTimeFormatOptions {
4465
4471
  localeMatcher?: "best fit" | "lookup" | undefined;
@@ -4498,12 +4504,15 @@ declare namespace Intl {
4498
4504
  format(date?: Date | number): string;
4499
4505
  resolvedOptions(): ResolvedDateTimeFormatOptions;
4500
4506
  }
4501
- var DateTimeFormat: {
4507
+
4508
+ interface DateTimeFormatConstructor {
4502
4509
  new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
4503
4510
  (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
4504
4511
  supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
4505
4512
  readonly prototype: DateTimeFormat;
4506
- };
4513
+ }
4514
+
4515
+ var DateTimeFormat: DateTimeFormatConstructor;
4507
4516
  }
4508
4517
 
4509
4518
  interface String {
@@ -20,3 +20,4 @@ and limitations under the License.
20
20
  /// <reference lib="esnext.intl" />
21
21
  /// <reference lib="esnext.decorators" />
22
22
  /// <reference lib="esnext.disposable" />
23
+ /// <reference lib="esnext.promise" />
@@ -0,0 +1,35 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ /// <reference no-default-lib="true"/>
18
+
19
+ interface PromiseWithResolvers<T> {
20
+ promise: Promise<T>;
21
+ resolve: (value: T | PromiseLike<T>) => void;
22
+ reject: (reason?: any) => void;
23
+ }
24
+
25
+ interface PromiseConstructor {
26
+ /**
27
+ * Creates a new Promise and returns it in an object, along with its resolve and reject functions.
28
+ * @returns An object with the properties `promise`, `resolve`, and `reject`.
29
+ *
30
+ * ```ts
31
+ * const { promise, resolve, reject } = Promise.withResolvers<T>();
32
+ * ```
33
+ */
34
+ withResolvers<T>(): PromiseWithResolvers<T>;
35
+ }
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-dev.20231129`;
21
+ var version = `${versionMajorMinor}.0-dev.20231130`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -33897,7 +33897,7 @@ var libEntries = [
33897
33897
  ["esnext.disposable", "lib.esnext.disposable.d.ts"],
33898
33898
  ["esnext.bigint", "lib.es2020.bigint.d.ts"],
33899
33899
  ["esnext.string", "lib.es2022.string.d.ts"],
33900
- ["esnext.promise", "lib.es2021.promise.d.ts"],
33900
+ ["esnext.promise", "lib.esnext.promise.d.ts"],
33901
33901
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
33902
33902
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
33903
33903
  ["decorators", "lib.decorators.d.ts"],
@@ -41785,7 +41785,7 @@ function createBinder() {
41785
41785
  }
41786
41786
  function bindSpecialPropertyAssignment(node) {
41787
41787
  var _a;
41788
- const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer);
41788
+ const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer) || lookupSymbolForPropertyAccess(node.left.expression, container);
41789
41789
  if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
41790
41790
  return;
41791
41791
  }
@@ -41883,7 +41883,7 @@ function createBinder() {
41883
41883
  return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 312 /* SourceFile */ : propertyAccess.parent.parent.kind === 312 /* SourceFile */;
41884
41884
  }
41885
41885
  function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) {
41886
- let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer);
41886
+ let namespaceSymbol = lookupSymbolForPropertyAccess(name, blockScopeContainer) || lookupSymbolForPropertyAccess(name, container);
41887
41887
  const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
41888
41888
  namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
41889
41889
  bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
@@ -54471,7 +54471,12 @@ function createTypeChecker(host) {
54471
54471
  for (const current of type.types) {
54472
54472
  for (const prop of getPropertiesOfType(current)) {
54473
54473
  if (!members.has(prop.escapedName)) {
54474
- const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName);
54474
+ const combinedProp = getPropertyOfUnionOrIntersectionType(
54475
+ type,
54476
+ prop.escapedName,
54477
+ /*skipObjectFunctionPropertyAugment*/
54478
+ !!(type.flags & 2097152 /* Intersection */)
54479
+ );
54475
54480
  if (combinedProp) {
54476
54481
  members.set(prop.escapedName, combinedProp);
54477
54482
  }
@@ -54961,13 +54966,17 @@ function createTypeChecker(host) {
54961
54966
  return result;
54962
54967
  }
54963
54968
  function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
54964
- var _a, _b;
54969
+ var _a, _b, _c;
54965
54970
  let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0;
54966
54971
  if (!property) {
54967
54972
  property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
54968
54973
  if (property) {
54969
54974
  const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
54970
54975
  properties.set(name, property);
54976
+ if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
54977
+ const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
54978
+ properties2.set(name, property);
54979
+ }
54971
54980
  }
54972
54981
  }
54973
54982
  return property;
@@ -55077,7 +55086,22 @@ function createTypeChecker(host) {
55077
55086
  }
55078
55087
  return getPropertyOfObjectType(globalObjectType, name);
55079
55088
  }
55080
- if (type.flags & 3145728 /* UnionOrIntersection */) {
55089
+ if (type.flags & 2097152 /* Intersection */) {
55090
+ const prop = getPropertyOfUnionOrIntersectionType(
55091
+ type,
55092
+ name,
55093
+ /*skipObjectFunctionPropertyAugment*/
55094
+ true
55095
+ );
55096
+ if (prop) {
55097
+ return prop;
55098
+ }
55099
+ if (!skipObjectFunctionPropertyAugment) {
55100
+ return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
55101
+ }
55102
+ return void 0;
55103
+ }
55104
+ if (type.flags & 1048576 /* Union */) {
55081
55105
  return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
55082
55106
  }
55083
55107
  return void 0;
@@ -63930,12 +63954,12 @@ function createTypeChecker(host) {
63930
63954
  return false;
63931
63955
  }
63932
63956
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
63933
- if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
63934
- return true;
63935
- }
63936
63957
  if (target.flags & 2097152 /* Intersection */) {
63937
63958
  return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
63938
63959
  }
63960
+ if (target.flags & 4 /* String */ || isTypeAssignableTo(source, target)) {
63961
+ return true;
63962
+ }
63939
63963
  if (source.flags & 128 /* StringLiteral */) {
63940
63964
  const value = source.value;
63941
63965
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -63952,7 +63976,7 @@ function createTypeChecker(host) {
63952
63976
  const texts = source.texts;
63953
63977
  return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
63954
63978
  }
63955
- return isTypeAssignableTo(source, target);
63979
+ return false;
63956
63980
  }
63957
63981
  function inferTypesFromTemplateLiteralType(source, target) {
63958
63982
  return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, getStringLikeTypeForType) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
@@ -71091,19 +71115,9 @@ function createTypeChecker(host) {
71091
71115
  return Debug.fail();
71092
71116
  }
71093
71117
  }
71094
- function getDiagnosticSpanForCallNode(node, doNotIncludeArguments) {
71095
- let start;
71096
- let length2;
71118
+ function getDiagnosticSpanForCallNode(node) {
71097
71119
  const sourceFile = getSourceFileOfNode(node);
71098
- if (isPropertyAccessExpression(node.expression)) {
71099
- const nameSpan = getErrorSpanForNode(sourceFile, node.expression.name);
71100
- start = nameSpan.start;
71101
- length2 = doNotIncludeArguments ? nameSpan.length : node.end - start;
71102
- } else {
71103
- const expressionSpan = getErrorSpanForNode(sourceFile, node.expression);
71104
- start = expressionSpan.start;
71105
- length2 = doNotIncludeArguments ? expressionSpan.length : node.end - start;
71106
- }
71120
+ const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression);
71107
71121
  return { start, length: length2, sourceFile };
71108
71122
  }
71109
71123
  function getDiagnosticForCallNode(node, message, ...args) {
@@ -71120,6 +71134,18 @@ function createTypeChecker(host) {
71120
71134
  return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
71121
71135
  }
71122
71136
  }
71137
+ function getErrorNodeForCallNode(callLike) {
71138
+ if (isCallOrNewExpression(callLike)) {
71139
+ return isPropertyAccessExpression(callLike.expression) ? callLike.expression.name : callLike.expression;
71140
+ }
71141
+ if (isTaggedTemplateExpression(callLike)) {
71142
+ return isPropertyAccessExpression(callLike.tag) ? callLike.tag.name : callLike.tag;
71143
+ }
71144
+ if (isJsxOpeningLikeElement(callLike)) {
71145
+ return callLike.tagName;
71146
+ }
71147
+ return callLike;
71148
+ }
71123
71149
  function isPromiseResolveArityError(node) {
71124
71150
  if (!isCallExpression(node) || !isIdentifier(node.expression))
71125
71151
  return false;
@@ -71421,7 +71447,7 @@ function createTypeChecker(host) {
71421
71447
  const { file, start, length: length2 } = diags[0];
71422
71448
  diag2 = { file, start, length: length2, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related };
71423
71449
  } else {
71424
- diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, chain, related);
71450
+ diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), getErrorNodeForCallNode(node), chain, related);
71425
71451
  }
71426
71452
  addImplementationSuccessElaboration(candidatesForArgumentError[0], diag2);
71427
71453
  diagnostics.add(diag2);
@@ -71949,11 +71975,7 @@ function createTypeChecker(host) {
71949
71975
  addRelatedInfo(diagnostic, createDiagnosticForNode(errorTarget, relatedInfo));
71950
71976
  }
71951
71977
  if (isCallExpression(errorTarget.parent)) {
71952
- const { start, length: length2 } = getDiagnosticSpanForCallNode(
71953
- errorTarget.parent,
71954
- /*doNotIncludeArguments*/
71955
- true
71956
- );
71978
+ const { start, length: length2 } = getDiagnosticSpanForCallNode(errorTarget.parent);
71957
71979
  diagnostic.start = start;
71958
71980
  diagnostic.length = length2;
71959
71981
  }
@@ -75323,16 +75345,19 @@ function createTypeChecker(host) {
75323
75345
  }
75324
75346
  }
75325
75347
  }
75326
- function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
75348
+ function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
75327
75349
  const signature = getSingleCallSignature(funcType);
75328
- if (signature && !signature.typeParameters) {
75329
- return getReturnTypeOfSignature(signature);
75350
+ if (signature) {
75351
+ const returnType = getReturnTypeOfSignature(signature);
75352
+ if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
75353
+ return returnType;
75354
+ }
75330
75355
  }
75331
75356
  }
75332
75357
  function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
75333
75358
  const funcType = checkExpression(expr.expression);
75334
75359
  const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
75335
- const returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
75360
+ const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
75336
75361
  return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
75337
75362
  }
75338
75363
  function getTypeOfExpression(node) {
@@ -75377,7 +75402,7 @@ function createTypeChecker(host) {
75377
75402
  /*requireStringLiteralLikeArgument*/
75378
75403
  true
75379
75404
  ) && !isSymbolOrSymbolForCall(expr)) {
75380
- return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
75405
+ return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
75381
75406
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
75382
75407
  return getTypeFromTypeNode(expr.type);
75383
75408
  } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
package/lib/tsserver.js CHANGED
@@ -2332,7 +2332,7 @@ module.exports = __toCommonJS(server_exports);
2332
2332
 
2333
2333
  // src/compiler/corePublic.ts
2334
2334
  var versionMajorMinor = "5.4";
2335
- var version = `${versionMajorMinor}.0-dev.20231129`;
2335
+ var version = `${versionMajorMinor}.0-dev.20231130`;
2336
2336
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2337
2337
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2338
2338
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -38324,7 +38324,7 @@ var libEntries = [
38324
38324
  ["esnext.disposable", "lib.esnext.disposable.d.ts"],
38325
38325
  ["esnext.bigint", "lib.es2020.bigint.d.ts"],
38326
38326
  ["esnext.string", "lib.es2022.string.d.ts"],
38327
- ["esnext.promise", "lib.es2021.promise.d.ts"],
38327
+ ["esnext.promise", "lib.esnext.promise.d.ts"],
38328
38328
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
38329
38329
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
38330
38330
  ["decorators", "lib.decorators.d.ts"],
@@ -46467,7 +46467,7 @@ function createBinder() {
46467
46467
  }
46468
46468
  function bindSpecialPropertyAssignment(node) {
46469
46469
  var _a;
46470
- const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer);
46470
+ const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer) || lookupSymbolForPropertyAccess(node.left.expression, container);
46471
46471
  if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
46472
46472
  return;
46473
46473
  }
@@ -46565,7 +46565,7 @@ function createBinder() {
46565
46565
  return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 312 /* SourceFile */ : propertyAccess.parent.parent.kind === 312 /* SourceFile */;
46566
46566
  }
46567
46567
  function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) {
46568
- let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer);
46568
+ let namespaceSymbol = lookupSymbolForPropertyAccess(name, blockScopeContainer) || lookupSymbolForPropertyAccess(name, container);
46569
46569
  const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
46570
46570
  namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
46571
46571
  bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
@@ -59198,7 +59198,12 @@ function createTypeChecker(host) {
59198
59198
  for (const current of type.types) {
59199
59199
  for (const prop of getPropertiesOfType(current)) {
59200
59200
  if (!members.has(prop.escapedName)) {
59201
- const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName);
59201
+ const combinedProp = getPropertyOfUnionOrIntersectionType(
59202
+ type,
59203
+ prop.escapedName,
59204
+ /*skipObjectFunctionPropertyAugment*/
59205
+ !!(type.flags & 2097152 /* Intersection */)
59206
+ );
59202
59207
  if (combinedProp) {
59203
59208
  members.set(prop.escapedName, combinedProp);
59204
59209
  }
@@ -59688,13 +59693,17 @@ function createTypeChecker(host) {
59688
59693
  return result;
59689
59694
  }
59690
59695
  function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
59691
- var _a, _b;
59696
+ var _a, _b, _c;
59692
59697
  let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0;
59693
59698
  if (!property) {
59694
59699
  property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
59695
59700
  if (property) {
59696
59701
  const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
59697
59702
  properties.set(name, property);
59703
+ if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
59704
+ const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
59705
+ properties2.set(name, property);
59706
+ }
59698
59707
  }
59699
59708
  }
59700
59709
  return property;
@@ -59804,7 +59813,22 @@ function createTypeChecker(host) {
59804
59813
  }
59805
59814
  return getPropertyOfObjectType(globalObjectType, name);
59806
59815
  }
59807
- if (type.flags & 3145728 /* UnionOrIntersection */) {
59816
+ if (type.flags & 2097152 /* Intersection */) {
59817
+ const prop = getPropertyOfUnionOrIntersectionType(
59818
+ type,
59819
+ name,
59820
+ /*skipObjectFunctionPropertyAugment*/
59821
+ true
59822
+ );
59823
+ if (prop) {
59824
+ return prop;
59825
+ }
59826
+ if (!skipObjectFunctionPropertyAugment) {
59827
+ return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
59828
+ }
59829
+ return void 0;
59830
+ }
59831
+ if (type.flags & 1048576 /* Union */) {
59808
59832
  return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
59809
59833
  }
59810
59834
  return void 0;
@@ -68657,12 +68681,12 @@ function createTypeChecker(host) {
68657
68681
  return false;
68658
68682
  }
68659
68683
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
68660
- if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
68661
- return true;
68662
- }
68663
68684
  if (target.flags & 2097152 /* Intersection */) {
68664
68685
  return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
68665
68686
  }
68687
+ if (target.flags & 4 /* String */ || isTypeAssignableTo(source, target)) {
68688
+ return true;
68689
+ }
68666
68690
  if (source.flags & 128 /* StringLiteral */) {
68667
68691
  const value = source.value;
68668
68692
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -68679,7 +68703,7 @@ function createTypeChecker(host) {
68679
68703
  const texts = source.texts;
68680
68704
  return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
68681
68705
  }
68682
- return isTypeAssignableTo(source, target);
68706
+ return false;
68683
68707
  }
68684
68708
  function inferTypesFromTemplateLiteralType(source, target) {
68685
68709
  return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, getStringLikeTypeForType) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
@@ -75818,19 +75842,9 @@ function createTypeChecker(host) {
75818
75842
  return Debug.fail();
75819
75843
  }
75820
75844
  }
75821
- function getDiagnosticSpanForCallNode(node, doNotIncludeArguments) {
75822
- let start2;
75823
- let length2;
75845
+ function getDiagnosticSpanForCallNode(node) {
75824
75846
  const sourceFile = getSourceFileOfNode(node);
75825
- if (isPropertyAccessExpression(node.expression)) {
75826
- const nameSpan = getErrorSpanForNode(sourceFile, node.expression.name);
75827
- start2 = nameSpan.start;
75828
- length2 = doNotIncludeArguments ? nameSpan.length : node.end - start2;
75829
- } else {
75830
- const expressionSpan = getErrorSpanForNode(sourceFile, node.expression);
75831
- start2 = expressionSpan.start;
75832
- length2 = doNotIncludeArguments ? expressionSpan.length : node.end - start2;
75833
- }
75847
+ const { start: start2, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression);
75834
75848
  return { start: start2, length: length2, sourceFile };
75835
75849
  }
75836
75850
  function getDiagnosticForCallNode(node, message, ...args) {
@@ -75847,6 +75861,18 @@ function createTypeChecker(host) {
75847
75861
  return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
75848
75862
  }
75849
75863
  }
75864
+ function getErrorNodeForCallNode(callLike) {
75865
+ if (isCallOrNewExpression(callLike)) {
75866
+ return isPropertyAccessExpression(callLike.expression) ? callLike.expression.name : callLike.expression;
75867
+ }
75868
+ if (isTaggedTemplateExpression(callLike)) {
75869
+ return isPropertyAccessExpression(callLike.tag) ? callLike.tag.name : callLike.tag;
75870
+ }
75871
+ if (isJsxOpeningLikeElement(callLike)) {
75872
+ return callLike.tagName;
75873
+ }
75874
+ return callLike;
75875
+ }
75850
75876
  function isPromiseResolveArityError(node) {
75851
75877
  if (!isCallExpression(node) || !isIdentifier(node.expression))
75852
75878
  return false;
@@ -76148,7 +76174,7 @@ function createTypeChecker(host) {
76148
76174
  const { file, start: start2, length: length2 } = diags[0];
76149
76175
  diag2 = { file, start: start2, length: length2, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related };
76150
76176
  } else {
76151
- diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, chain, related);
76177
+ diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), getErrorNodeForCallNode(node), chain, related);
76152
76178
  }
76153
76179
  addImplementationSuccessElaboration(candidatesForArgumentError[0], diag2);
76154
76180
  diagnostics.add(diag2);
@@ -76676,11 +76702,7 @@ function createTypeChecker(host) {
76676
76702
  addRelatedInfo(diagnostic, createDiagnosticForNode(errorTarget, relatedInfo));
76677
76703
  }
76678
76704
  if (isCallExpression(errorTarget.parent)) {
76679
- const { start: start2, length: length2 } = getDiagnosticSpanForCallNode(
76680
- errorTarget.parent,
76681
- /*doNotIncludeArguments*/
76682
- true
76683
- );
76705
+ const { start: start2, length: length2 } = getDiagnosticSpanForCallNode(errorTarget.parent);
76684
76706
  diagnostic.start = start2;
76685
76707
  diagnostic.length = length2;
76686
76708
  }
@@ -80050,16 +80072,19 @@ function createTypeChecker(host) {
80050
80072
  }
80051
80073
  }
80052
80074
  }
80053
- function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
80075
+ function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
80054
80076
  const signature = getSingleCallSignature(funcType);
80055
- if (signature && !signature.typeParameters) {
80056
- return getReturnTypeOfSignature(signature);
80077
+ if (signature) {
80078
+ const returnType = getReturnTypeOfSignature(signature);
80079
+ if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
80080
+ return returnType;
80081
+ }
80057
80082
  }
80058
80083
  }
80059
80084
  function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
80060
80085
  const funcType = checkExpression(expr.expression);
80061
80086
  const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
80062
- const returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
80087
+ const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
80063
80088
  return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
80064
80089
  }
80065
80090
  function getTypeOfExpression(node) {
@@ -80104,7 +80129,7 @@ function createTypeChecker(host) {
80104
80129
  /*requireStringLiteralLikeArgument*/
80105
80130
  true
80106
80131
  ) && !isSymbolOrSymbolForCall(expr)) {
80107
- return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
80132
+ return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
80108
80133
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
80109
80134
  return getTypeFromTypeNode(expr.type);
80110
80135
  } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
@@ -165805,6 +165830,17 @@ function provideInlayHints(context) {
165805
165830
  visitForDisplayParts(node.type);
165806
165831
  }
165807
165832
  break;
165833
+ case 181 /* IndexSignature */:
165834
+ Debug.assertNode(node, isIndexSignatureDeclaration);
165835
+ Debug.assertEqual(node.parameters.length, 1);
165836
+ parts.push({ text: "[" });
165837
+ visitForDisplayParts(node.parameters[0]);
165838
+ parts.push({ text: "]" });
165839
+ if (node.type) {
165840
+ parts.push({ text: ": " });
165841
+ visitForDisplayParts(node.type);
165842
+ }
165843
+ break;
165808
165844
  case 173 /* MethodSignature */:
165809
165845
  Debug.assertNode(node, isMethodSignature);
165810
165846
  if ((_b = node.modifiers) == null ? void 0 : _b.length) {
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-dev.20231129`;
38
+ version = `${versionMajorMinor}.0-dev.20231130`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -37814,7 +37814,7 @@ ${lanes.join("\n")}
37814
37814
  ["esnext.disposable", "lib.esnext.disposable.d.ts"],
37815
37815
  ["esnext.bigint", "lib.es2020.bigint.d.ts"],
37816
37816
  ["esnext.string", "lib.es2022.string.d.ts"],
37817
- ["esnext.promise", "lib.es2021.promise.d.ts"],
37817
+ ["esnext.promise", "lib.esnext.promise.d.ts"],
37818
37818
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
37819
37819
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
37820
37820
  ["decorators", "lib.decorators.d.ts"],
@@ -44310,7 +44310,7 @@ ${lanes.join("\n")}
44310
44310
  }
44311
44311
  function bindSpecialPropertyAssignment(node) {
44312
44312
  var _a;
44313
- const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer);
44313
+ const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer) || lookupSymbolForPropertyAccess(node.left.expression, container);
44314
44314
  if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
44315
44315
  return;
44316
44316
  }
@@ -44408,7 +44408,7 @@ ${lanes.join("\n")}
44408
44408
  return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 312 /* SourceFile */ : propertyAccess.parent.parent.kind === 312 /* SourceFile */;
44409
44409
  }
44410
44410
  function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) {
44411
- let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer);
44411
+ let namespaceSymbol = lookupSymbolForPropertyAccess(name, blockScopeContainer) || lookupSymbolForPropertyAccess(name, container);
44412
44412
  const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
44413
44413
  namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
44414
44414
  bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
@@ -56961,7 +56961,12 @@ ${lanes.join("\n")}
56961
56961
  for (const current of type.types) {
56962
56962
  for (const prop of getPropertiesOfType(current)) {
56963
56963
  if (!members.has(prop.escapedName)) {
56964
- const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName);
56964
+ const combinedProp = getPropertyOfUnionOrIntersectionType(
56965
+ type,
56966
+ prop.escapedName,
56967
+ /*skipObjectFunctionPropertyAugment*/
56968
+ !!(type.flags & 2097152 /* Intersection */)
56969
+ );
56965
56970
  if (combinedProp) {
56966
56971
  members.set(prop.escapedName, combinedProp);
56967
56972
  }
@@ -57451,13 +57456,17 @@ ${lanes.join("\n")}
57451
57456
  return result;
57452
57457
  }
57453
57458
  function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
57454
- var _a, _b;
57459
+ var _a, _b, _c;
57455
57460
  let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0;
57456
57461
  if (!property) {
57457
57462
  property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
57458
57463
  if (property) {
57459
57464
  const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
57460
57465
  properties.set(name, property);
57466
+ if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
57467
+ const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
57468
+ properties2.set(name, property);
57469
+ }
57461
57470
  }
57462
57471
  }
57463
57472
  return property;
@@ -57567,7 +57576,22 @@ ${lanes.join("\n")}
57567
57576
  }
57568
57577
  return getPropertyOfObjectType(globalObjectType, name);
57569
57578
  }
57570
- if (type.flags & 3145728 /* UnionOrIntersection */) {
57579
+ if (type.flags & 2097152 /* Intersection */) {
57580
+ const prop = getPropertyOfUnionOrIntersectionType(
57581
+ type,
57582
+ name,
57583
+ /*skipObjectFunctionPropertyAugment*/
57584
+ true
57585
+ );
57586
+ if (prop) {
57587
+ return prop;
57588
+ }
57589
+ if (!skipObjectFunctionPropertyAugment) {
57590
+ return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
57591
+ }
57592
+ return void 0;
57593
+ }
57594
+ if (type.flags & 1048576 /* Union */) {
57571
57595
  return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
57572
57596
  }
57573
57597
  return void 0;
@@ -66420,12 +66444,12 @@ ${lanes.join("\n")}
66420
66444
  return false;
66421
66445
  }
66422
66446
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
66423
- if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
66424
- return true;
66425
- }
66426
66447
  if (target.flags & 2097152 /* Intersection */) {
66427
66448
  return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
66428
66449
  }
66450
+ if (target.flags & 4 /* String */ || isTypeAssignableTo(source, target)) {
66451
+ return true;
66452
+ }
66429
66453
  if (source.flags & 128 /* StringLiteral */) {
66430
66454
  const value = source.value;
66431
66455
  return !!(target.flags & 8 /* Number */ && isValidNumberString(
@@ -66442,7 +66466,7 @@ ${lanes.join("\n")}
66442
66466
  const texts = source.texts;
66443
66467
  return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
66444
66468
  }
66445
- return isTypeAssignableTo(source, target);
66469
+ return false;
66446
66470
  }
66447
66471
  function inferTypesFromTemplateLiteralType(source, target) {
66448
66472
  return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, getStringLikeTypeForType) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
@@ -73581,19 +73605,9 @@ ${lanes.join("\n")}
73581
73605
  return Debug.fail();
73582
73606
  }
73583
73607
  }
73584
- function getDiagnosticSpanForCallNode(node, doNotIncludeArguments) {
73585
- let start;
73586
- let length2;
73608
+ function getDiagnosticSpanForCallNode(node) {
73587
73609
  const sourceFile = getSourceFileOfNode(node);
73588
- if (isPropertyAccessExpression(node.expression)) {
73589
- const nameSpan = getErrorSpanForNode(sourceFile, node.expression.name);
73590
- start = nameSpan.start;
73591
- length2 = doNotIncludeArguments ? nameSpan.length : node.end - start;
73592
- } else {
73593
- const expressionSpan = getErrorSpanForNode(sourceFile, node.expression);
73594
- start = expressionSpan.start;
73595
- length2 = doNotIncludeArguments ? expressionSpan.length : node.end - start;
73596
- }
73610
+ const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression);
73597
73611
  return { start, length: length2, sourceFile };
73598
73612
  }
73599
73613
  function getDiagnosticForCallNode(node, message, ...args) {
@@ -73610,6 +73624,18 @@ ${lanes.join("\n")}
73610
73624
  return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
73611
73625
  }
73612
73626
  }
73627
+ function getErrorNodeForCallNode(callLike) {
73628
+ if (isCallOrNewExpression(callLike)) {
73629
+ return isPropertyAccessExpression(callLike.expression) ? callLike.expression.name : callLike.expression;
73630
+ }
73631
+ if (isTaggedTemplateExpression(callLike)) {
73632
+ return isPropertyAccessExpression(callLike.tag) ? callLike.tag.name : callLike.tag;
73633
+ }
73634
+ if (isJsxOpeningLikeElement(callLike)) {
73635
+ return callLike.tagName;
73636
+ }
73637
+ return callLike;
73638
+ }
73613
73639
  function isPromiseResolveArityError(node) {
73614
73640
  if (!isCallExpression(node) || !isIdentifier(node.expression))
73615
73641
  return false;
@@ -73911,7 +73937,7 @@ ${lanes.join("\n")}
73911
73937
  const { file, start, length: length2 } = diags[0];
73912
73938
  diag2 = { file, start, length: length2, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related };
73913
73939
  } else {
73914
- diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, chain, related);
73940
+ diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), getErrorNodeForCallNode(node), chain, related);
73915
73941
  }
73916
73942
  addImplementationSuccessElaboration(candidatesForArgumentError[0], diag2);
73917
73943
  diagnostics.add(diag2);
@@ -74439,11 +74465,7 @@ ${lanes.join("\n")}
74439
74465
  addRelatedInfo(diagnostic, createDiagnosticForNode(errorTarget, relatedInfo));
74440
74466
  }
74441
74467
  if (isCallExpression(errorTarget.parent)) {
74442
- const { start, length: length2 } = getDiagnosticSpanForCallNode(
74443
- errorTarget.parent,
74444
- /*doNotIncludeArguments*/
74445
- true
74446
- );
74468
+ const { start, length: length2 } = getDiagnosticSpanForCallNode(errorTarget.parent);
74447
74469
  diagnostic.start = start;
74448
74470
  diagnostic.length = length2;
74449
74471
  }
@@ -77813,16 +77835,19 @@ ${lanes.join("\n")}
77813
77835
  }
77814
77836
  }
77815
77837
  }
77816
- function getReturnTypeOfSingleNonGenericCallSignature(funcType) {
77838
+ function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
77817
77839
  const signature = getSingleCallSignature(funcType);
77818
- if (signature && !signature.typeParameters) {
77819
- return getReturnTypeOfSignature(signature);
77840
+ if (signature) {
77841
+ const returnType = getReturnTypeOfSignature(signature);
77842
+ if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
77843
+ return returnType;
77844
+ }
77820
77845
  }
77821
77846
  }
77822
77847
  function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
77823
77848
  const funcType = checkExpression(expr.expression);
77824
77849
  const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
77825
- const returnType = getReturnTypeOfSingleNonGenericCallSignature(funcType);
77850
+ const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
77826
77851
  return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
77827
77852
  }
77828
77853
  function getTypeOfExpression(node) {
@@ -77867,7 +77892,7 @@ ${lanes.join("\n")}
77867
77892
  /*requireStringLiteralLikeArgument*/
77868
77893
  true
77869
77894
  ) && !isSymbolOrSymbolForCall(expr)) {
77870
- return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
77895
+ return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
77871
77896
  } else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
77872
77897
  return getTypeFromTypeNode(expr.type);
77873
77898
  } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
@@ -165147,6 +165172,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
165147
165172
  visitForDisplayParts(node.type);
165148
165173
  }
165149
165174
  break;
165175
+ case 181 /* IndexSignature */:
165176
+ Debug.assertNode(node, isIndexSignatureDeclaration);
165177
+ Debug.assertEqual(node.parameters.length, 1);
165178
+ parts.push({ text: "[" });
165179
+ visitForDisplayParts(node.parameters[0]);
165180
+ parts.push({ text: "]" });
165181
+ if (node.type) {
165182
+ parts.push({ text: ": " });
165183
+ visitForDisplayParts(node.type);
165184
+ }
165185
+ break;
165150
165186
  case 173 /* MethodSignature */:
165151
165187
  Debug.assertNode(node, isMethodSignature);
165152
165188
  if ((_b = node.modifiers) == null ? void 0 : _b.length) {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-dev.20231129`;
57
+ var version = `${versionMajorMinor}.0-dev.20231130`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -25706,7 +25706,7 @@ var libEntries = [
25706
25706
  ["esnext.disposable", "lib.esnext.disposable.d.ts"],
25707
25707
  ["esnext.bigint", "lib.es2020.bigint.d.ts"],
25708
25708
  ["esnext.string", "lib.es2022.string.d.ts"],
25709
- ["esnext.promise", "lib.es2021.promise.d.ts"],
25709
+ ["esnext.promise", "lib.esnext.promise.d.ts"],
25710
25710
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
25711
25711
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
25712
25712
  ["decorators", "lib.decorators.d.ts"],
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-dev.20231129",
5
+ "version": "5.4.0-dev.20231130",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "2869579b2cad770ae20617e4148741c2ce35ffdc"
117
+ "gitHead": "7216ee0bb821b4b565d54c52dcbf788a3fdf7062"
118
118
  }