diff --git a/lib/lib.d.ts b/lib/lib.d.ts
index 9152c4dfcef7e..b6bb44b2cafff 100644
--- a/lib/lib.d.ts
+++ b/lib/lib.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.decorators.d.ts b/lib/lib.decorators.d.ts
index d2b6b29a63ce1..2d2b4ee2af880 100644
--- a/lib/lib.decorators.d.ts
+++ b/lib/lib.decorators.d.ts
@@ -14,12 +14,10 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/**
- * The decorator context types provided to class member decorators.
+ * The decorator context types provided to class element decorators.
*/
type ClassMemberDecoratorContext =
| ClassMethodDecoratorContext
@@ -80,34 +78,37 @@ interface ClassMethodDecoratorContext<
This = unknown,
Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
> {
- /** The kind of class member that was decorated. */
+ /** The kind of class element that was decorated. */
readonly kind: "method";
- /** The name of the decorated class member. */
+ /** The name of the decorated class element. */
readonly name: string | symbol;
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
- /** A value indicating whether the class member has a private name. */
+ /** A value indicating whether the class element has a private name. */
readonly private: boolean;
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
- // /** An object that can be used to access the current value of the class member at runtime. */
- // readonly access: {
- // /**
- // * Gets the current value of the method from the provided receiver.
- // *
- // * @example
- // * let fn = context.access.get.call(instance);
- // */
- // get(this: This): Value;
- // };
+ /** An object that can be used to access the current value of the class element at runtime. */
+ readonly access: {
+ /**
+ * Determines whether an object has a property with the same name as the decorated element.
+ */
+ has(object: This): boolean;
+ /**
+ * Gets the current value of the method from the provided object.
+ *
+ * @example
+ * let fn = context.access.get(instance);
+ */
+ get(object: This): Value;
+ };
/**
* Adds a callback to be invoked either before static initializers are run (when
- * decorating a `static` member), or before instance initializers are run (when
- * decorating a non-`static` member).
+ * decorating a `static` element), or before instance initializers are run (when
+ * decorating a non-`static` element).
*
* @example
* ```ts
@@ -141,34 +142,37 @@ interface ClassGetterDecoratorContext<
This = unknown,
Value = unknown,
> {
- /** The kind of class member that was decorated. */
+ /** The kind of class element that was decorated. */
readonly kind: "getter";
- /** The name of the decorated class member. */
+ /** The name of the decorated class element. */
readonly name: string | symbol;
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
- /** A value indicating whether the class member has a private name. */
+ /** A value indicating whether the class element has a private name. */
readonly private: boolean;
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
- // /** An object that can be used to access the current value of the class member at runtime. */
- // readonly access: {
- // /**
- // * Invokes the getter on the provided receiver.
- // *
- // * @example
- // * let value = context.access.get.call(instance);
- // */
- // get(this: This): Value;
- // };
+ /** An object that can be used to access the current value of the class element at runtime. */
+ readonly access: {
+ /**
+ * Determines whether an object has a property with the same name as the decorated element.
+ */
+ has(object: This): boolean;
+ /**
+ * Invokes the getter on the provided object.
+ *
+ * @example
+ * let value = context.access.get(instance);
+ */
+ get(object: This): Value;
+ };
/**
* Adds a callback to be invoked either before static initializers are run (when
- * decorating a `static` member), or before instance initializers are run (when
- * decorating a non-`static` member).
+ * decorating a `static` element), or before instance initializers are run (when
+ * decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
@@ -183,34 +187,37 @@ interface ClassSetterDecoratorContext<
This = unknown,
Value = unknown,
> {
- /** The kind of class member that was decorated. */
+ /** The kind of class element that was decorated. */
readonly kind: "setter";
- /** The name of the decorated class member. */
+ /** The name of the decorated class element. */
readonly name: string | symbol;
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
- /** A value indicating whether the class member has a private name. */
+ /** A value indicating whether the class element has a private name. */
readonly private: boolean;
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
- /** An object that can be used to access the current value of the class member at runtime. */
- // readonly access: {
- // /**
- // * Invokes the setter on the provided receiver.
- // *
- // * @example
- // * context.access.set.call(instance, value);
- // */
- // set(this: This, value: Value): void;
- // };
+ /** An object that can be used to access the current value of the class element at runtime. */
+ readonly access: {
+ /**
+ * Determines whether an object has a property with the same name as the decorated element.
+ */
+ has(object: This): boolean;
+ /**
+ * Invokes the setter on the provided object.
+ *
+ * @example
+ * context.access.set(instance, value);
+ */
+ set(object: This, value: Value): void;
+ };
/**
* Adds a callback to be invoked either before static initializers are run (when
- * decorating a `static` member), or before instance initializers are run (when
- * decorating a non-`static` member).
+ * decorating a `static` element), or before instance initializers are run (when
+ * decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
@@ -225,42 +232,46 @@ interface ClassAccessorDecoratorContext<
This = unknown,
Value = unknown,
> {
- /** The kind of class member that was decorated. */
+ /** The kind of class element that was decorated. */
readonly kind: "accessor";
- /** The name of the decorated class member. */
+ /** The name of the decorated class element. */
readonly name: string | symbol;
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
- /** A value indicating whether the class member has a private name. */
+ /** A value indicating whether the class element has a private name. */
readonly private: boolean;
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
- // /** An object that can be used to access the current value of the class member at runtime. */
- // readonly access: {
- // /**
- // * Invokes the getter on the provided receiver.
- // *
- // * @example
- // * let value = context.access.get.call(instance);
- // */
- // get(this: This): Value;
-
- // /**
- // * Invokes the setter on the provided receiver.
- // *
- // * @example
- // * context.access.set.call(instance, value);
- // */
- // set(this: This, value: Value): void;
- // };
+ /** An object that can be used to access the current value of the class element at runtime. */
+ readonly access: {
+ /**
+ * Determines whether an object has a property with the same name as the decorated element.
+ */
+ has(object: This): boolean;
+
+ /**
+ * Invokes the getter on the provided object.
+ *
+ * @example
+ * let value = context.access.get(instance);
+ */
+ get(object: This): Value;
+
+ /**
+ * Invokes the setter on the provided object.
+ *
+ * @example
+ * context.access.set(instance, value);
+ */
+ set(object: This, value: Value): void;
+ };
/**
* Adds a callback to be invoked either before static initializers are run (when
- * decorating a `static` member), or before instance initializers are run (when
- * decorating a non-`static` member).
+ * decorating a `static` element), or before instance initializers are run (when
+ * decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
@@ -322,36 +333,40 @@ interface ClassFieldDecoratorContext<
This = unknown,
Value = unknown,
> {
- /** The kind of class member that was decorated. */
+ /** The kind of class element that was decorated. */
readonly kind: "field";
- /** The name of the decorated class member. */
+ /** The name of the decorated class element. */
readonly name: string | symbol;
- /** A value indicating whether the class member is a static (`true`) or instance (`false`) member. */
+ /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
- /** A value indicating whether the class member has a private name. */
+ /** A value indicating whether the class element has a private name. */
readonly private: boolean;
- // NOTE: Disabled, pending the outcome of https://github.com/tc39/proposal-decorators/issues/494
- // /** An object that can be used to access the current value of the class member at runtime. */
- // readonly access: {
- // /**
- // * Gets the value of the field on the provided receiver.
- // */
- // get(this: This): Value;
+ /** An object that can be used to access the current value of the class element at runtime. */
+ readonly access: {
+ /**
+ * Determines whether an object has a property with the same name as the decorated element.
+ */
+ has(object: This): boolean;
+
+ /**
+ * Gets the value of the field on the provided object.
+ */
+ get(object: This): Value;
- // /**
- // * Sets the value of the field on the provided receiver.
- // */
- // set(this: This, value: Value): void;
- // };
+ /**
+ * Sets the value of the field on the provided object.
+ */
+ set(object: This, value: Value): void;
+ };
/**
* Adds a callback to be invoked either before static initializers are run (when
- * decorating a `static` member), or before instance initializers are run (when
- * decorating a non-`static` member).
+ * decorating a `static` element), or before instance initializers are run (when
+ * decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
diff --git a/lib/lib.decorators.legacy.d.ts b/lib/lib.decorators.legacy.d.ts
index e8783bef48a15..39bf2413e2baa 100644
--- a/lib/lib.decorators.legacy.d.ts
+++ b/lib/lib.decorators.legacy.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare type ClassDecorator = (target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void;
diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts
index a1bc18a50cb5b..4a1be1170b5f3 100644
--- a/lib/lib.dom.d.ts
+++ b/lib/lib.dom.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/////////////////////////////
/// Window APIs
/////////////////////////////
diff --git a/lib/lib.dom.iterable.d.ts b/lib/lib.dom.iterable.d.ts
index 3e0340d61ea38..56d6fdcbcd63d 100644
--- a/lib/lib.dom.iterable.d.ts
+++ b/lib/lib.dom.iterable.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/////////////////////////////
/// Window Iterable APIs
/////////////////////////////
diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts
index c2e7733ae54b4..8528c77251c3d 100644
--- a/lib/lib.es2015.collection.d.ts
+++ b/lib/lib.es2015.collection.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Map {
clear(): void;
diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts
index c585d071b1ff6..ecd2e029ef0f8 100644
--- a/lib/lib.es2015.core.d.ts
+++ b/lib/lib.es2015.core.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Array {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
diff --git a/lib/lib.es2015.d.ts b/lib/lib.es2015.d.ts
index 791284b6dad0b..74b440fd8b132 100644
--- a/lib/lib.es2015.d.ts
+++ b/lib/lib.es2015.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2015.generator.d.ts b/lib/lib.es2015.generator.d.ts
index 78f9fd5bd430a..716bac29c1966 100644
--- a/lib/lib.es2015.generator.d.ts
+++ b/lib/lib.es2015.generator.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface Generator extends Iterator {
diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts
index 8a7292383442d..31be935fea29c 100644
--- a/lib/lib.es2015.iterable.d.ts
+++ b/lib/lib.es2015.iterable.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface SymbolConstructor {
diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts
index 685f7164f5d61..cd2adb675b736 100644
--- a/lib/lib.es2015.promise.d.ts
+++ b/lib/lib.es2015.promise.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface PromiseConstructor {
/**
* A reference to the prototype.
diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts
index 8c465ab06a0e2..22a0c174600b0 100644
--- a/lib/lib.es2015.proxy.d.ts
+++ b/lib/lib.es2015.proxy.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface ProxyHandler {
/**
* A trap method for a function call.
diff --git a/lib/lib.es2015.reflect.d.ts b/lib/lib.es2015.reflect.d.ts
index 2e2b3893d4d51..3ee27b5250b6a 100644
--- a/lib/lib.es2015.reflect.d.ts
+++ b/lib/lib.es2015.reflect.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Reflect {
/**
* Calls the function with the specified object as the this value
diff --git a/lib/lib.es2015.symbol.d.ts b/lib/lib.es2015.symbol.d.ts
index 253d2806ce7b0..4b529a53539aa 100644
--- a/lib/lib.es2015.symbol.d.ts
+++ b/lib/lib.es2015.symbol.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface SymbolConstructor {
/**
* A reference to the prototype.
diff --git a/lib/lib.es2015.symbol.wellknown.d.ts b/lib/lib.es2015.symbol.wellknown.d.ts
index 81e052bf26d27..f2d9b4f0a0973 100644
--- a/lib/lib.es2015.symbol.wellknown.d.ts
+++ b/lib/lib.es2015.symbol.wellknown.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface SymbolConstructor {
@@ -76,7 +74,7 @@ interface SymbolConstructor {
readonly toStringTag: unique symbol;
/**
- * An Object whose own property names are property names that are excluded from the 'with'
+ * An Object whose truthy properties are properties that are excluded from the 'with'
* environment bindings of the associated objects.
*/
readonly unscopables: unique symbol;
@@ -93,17 +91,21 @@ interface Symbol {
interface Array {
/**
- * Returns an object whose properties have the value 'true'
+ * Is an object whose properties have the value 'true'
+ * when they will be absent when used in a 'with' statement.
+ */
+ readonly [Symbol.unscopables]: {
+ [K in keyof any[]]?: boolean;
+ };
+}
+
+interface ReadonlyArray {
+ /**
+ * Is an object whose properties have the value 'true'
* when they will be absent when used in a 'with' statement.
*/
- [Symbol.unscopables](): {
- copyWithin: boolean;
- entries: boolean;
- fill: boolean;
- find: boolean;
- findIndex: boolean;
- keys: boolean;
- values: boolean;
+ readonly [Symbol.unscopables]: {
+ [K in keyof readonly any[]]?: boolean;
};
}
diff --git a/lib/lib.es2016.array.include.d.ts b/lib/lib.es2016.array.include.d.ts
index 6bc6ef30e7e42..8acbe4aeb38fd 100644
--- a/lib/lib.es2016.array.include.d.ts
+++ b/lib/lib.es2016.array.include.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Array {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
diff --git a/lib/lib.es2016.d.ts b/lib/lib.es2016.d.ts
index ade8175f52cd1..795703948bac4 100644
--- a/lib/lib.es2016.d.ts
+++ b/lib/lib.es2016.d.ts
@@ -14,9 +14,7 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
\ No newline at end of file
diff --git a/lib/lib.es2016.full.d.ts b/lib/lib.es2016.full.d.ts
index ad61d232522c1..d50bde9dd02b6 100644
--- a/lib/lib.es2016.full.d.ts
+++ b/lib/lib.es2016.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2017.d.ts b/lib/lib.es2017.d.ts
index d89f58071b0cb..bbeabf42255ff 100644
--- a/lib/lib.es2017.d.ts
+++ b/lib/lib.es2017.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2017.full.d.ts b/lib/lib.es2017.full.d.ts
index f57c645c5c76f..07a98db084c64 100644
--- a/lib/lib.es2017.full.d.ts
+++ b/lib/lib.es2017.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2017.intl.d.ts b/lib/lib.es2017.intl.d.ts
index c2ab43e8fc304..628d7f5339b9f 100644
--- a/lib/lib.es2017.intl.d.ts
+++ b/lib/lib.es2017.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
diff --git a/lib/lib.es2017.object.d.ts b/lib/lib.es2017.object.d.ts
index 4900d9261e2f0..fd7dd4d926c3c 100644
--- a/lib/lib.es2017.object.d.ts
+++ b/lib/lib.es2017.object.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface ObjectConstructor {
/**
* Returns an array of values of the enumerable properties of an object
diff --git a/lib/lib.es2017.sharedmemory.d.ts b/lib/lib.es2017.sharedmemory.d.ts
index 3a4ea26bd49be..a46c5ccb13d7d 100644
--- a/lib/lib.es2017.sharedmemory.d.ts
+++ b/lib/lib.es2017.sharedmemory.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
diff --git a/lib/lib.es2017.string.d.ts b/lib/lib.es2017.string.d.ts
index 4b219e6c5c570..e3a3c1a375eab 100644
--- a/lib/lib.es2017.string.d.ts
+++ b/lib/lib.es2017.string.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface String {
/**
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
diff --git a/lib/lib.es2017.typedarrays.d.ts b/lib/lib.es2017.typedarrays.d.ts
index ac6984100f5c3..2182ec12f8884 100644
--- a/lib/lib.es2017.typedarrays.d.ts
+++ b/lib/lib.es2017.typedarrays.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Int8ArrayConstructor {
new (): Int8Array;
}
diff --git a/lib/lib.es2018.asyncgenerator.d.ts b/lib/lib.es2018.asyncgenerator.d.ts
index 546a8c2e99613..092a34f010149 100644
--- a/lib/lib.es2018.asyncgenerator.d.ts
+++ b/lib/lib.es2018.asyncgenerator.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface AsyncGenerator extends AsyncIterator {
diff --git a/lib/lib.es2018.asynciterable.d.ts b/lib/lib.es2018.asynciterable.d.ts
index 88f9d8fbab16e..6d2e226def595 100644
--- a/lib/lib.es2018.asynciterable.d.ts
+++ b/lib/lib.es2018.asynciterable.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
diff --git a/lib/lib.es2018.d.ts b/lib/lib.es2018.d.ts
index db0a3d1b027cf..7751029910020 100644
--- a/lib/lib.es2018.d.ts
+++ b/lib/lib.es2018.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2018.full.d.ts b/lib/lib.es2018.full.d.ts
index b517dc59003f5..7bc5e011c5e11 100644
--- a/lib/lib.es2018.full.d.ts
+++ b/lib/lib.es2018.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2018.intl.d.ts b/lib/lib.es2018.intl.d.ts
index 97c0eedb069f5..56eb9228996f9 100644
--- a/lib/lib.es2018.intl.d.ts
+++ b/lib/lib.es2018.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Intl {
// http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories
diff --git a/lib/lib.es2018.promise.d.ts b/lib/lib.es2018.promise.d.ts
index 1a95d7c87c053..e5044b766aac2 100644
--- a/lib/lib.es2018.promise.d.ts
+++ b/lib/lib.es2018.promise.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/**
* Represents the completion of an asynchronous operation
*/
diff --git a/lib/lib.es2018.regexp.d.ts b/lib/lib.es2018.regexp.d.ts
index 9cb3710b5d354..9464390a97557 100644
--- a/lib/lib.es2018.regexp.d.ts
+++ b/lib/lib.es2018.regexp.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface RegExpMatchArray {
groups?: {
[key: string]: string
diff --git a/lib/lib.es2019.array.d.ts b/lib/lib.es2019.array.d.ts
index 1607483465a27..a293248d8c381 100644
--- a/lib/lib.es2019.array.d.ts
+++ b/lib/lib.es2019.array.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
type FlatArray = {
"done": Arr,
"recur": Arr extends ReadonlyArray
diff --git a/lib/lib.es2019.d.ts b/lib/lib.es2019.d.ts
index 77d3d6b5f093f..8a26e9fd19018 100644
--- a/lib/lib.es2019.d.ts
+++ b/lib/lib.es2019.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2019.full.d.ts b/lib/lib.es2019.full.d.ts
index 1ebdb1fe0be8c..e3ae1a6a13f88 100644
--- a/lib/lib.es2019.full.d.ts
+++ b/lib/lib.es2019.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2019.intl.d.ts b/lib/lib.es2019.intl.d.ts
index fe17c7cd7194d..1018481898e3c 100644
--- a/lib/lib.es2019.intl.d.ts
+++ b/lib/lib.es2019.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
unknown: any
diff --git a/lib/lib.es2019.object.d.ts b/lib/lib.es2019.object.d.ts
index 09b937af044f8..fdfab8ecbe775 100644
--- a/lib/lib.es2019.object.d.ts
+++ b/lib/lib.es2019.object.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface ObjectConstructor {
diff --git a/lib/lib.es2019.string.d.ts b/lib/lib.es2019.string.d.ts
index c7150833bc69a..8011c9fcf78c6 100644
--- a/lib/lib.es2019.string.d.ts
+++ b/lib/lib.es2019.string.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface String {
/** Removes the trailing white space and line terminator characters from a string. */
trimEnd(): string;
diff --git a/lib/lib.es2019.symbol.d.ts b/lib/lib.es2019.symbol.d.ts
index 58b38d5f9db20..4b4bdb82f0a1f 100644
--- a/lib/lib.es2019.symbol.d.ts
+++ b/lib/lib.es2019.symbol.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Symbol {
/**
* Expose the [[Description]] internal slot of a symbol directly.
diff --git a/lib/lib.es2020.bigint.d.ts b/lib/lib.es2020.bigint.d.ts
index a0ebccaf9ca77..73df22e21ebf7 100644
--- a/lib/lib.es2020.bigint.d.ts
+++ b/lib/lib.es2020.bigint.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface BigIntToLocaleStringOptions {
diff --git a/lib/lib.es2020.d.ts b/lib/lib.es2020.d.ts
index ae81c40b46a3d..937da6bcad093 100644
--- a/lib/lib.es2020.d.ts
+++ b/lib/lib.es2020.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2020.date.d.ts b/lib/lib.es2020.date.d.ts
index 8eeb6b981dd39..1e0470aa690fe 100644
--- a/lib/lib.es2020.date.d.ts
+++ b/lib/lib.es2020.date.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface Date {
diff --git a/lib/lib.es2020.full.d.ts b/lib/lib.es2020.full.d.ts
index 165b566d24f6f..5fa8b55c52806 100644
--- a/lib/lib.es2020.full.d.ts
+++ b/lib/lib.es2020.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2020.intl.d.ts b/lib/lib.es2020.intl.d.ts
index 5ee8e4cdc414b..71093d30f13d1 100644
--- a/lib/lib.es2020.intl.d.ts
+++ b/lib/lib.es2020.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
declare namespace Intl {
diff --git a/lib/lib.es2020.number.d.ts b/lib/lib.es2020.number.d.ts
index 89f6a2723d365..f1a01bae03ef6 100644
--- a/lib/lib.es2020.number.d.ts
+++ b/lib/lib.es2020.number.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface Number {
diff --git a/lib/lib.es2020.promise.d.ts b/lib/lib.es2020.promise.d.ts
index 8107144efe00c..1a05d75c008e3 100644
--- a/lib/lib.es2020.promise.d.ts
+++ b/lib/lib.es2020.promise.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface PromiseFulfilledResult {
status: "fulfilled";
value: T;
diff --git a/lib/lib.es2020.sharedmemory.d.ts b/lib/lib.es2020.sharedmemory.d.ts
index f86c5ad50b488..3c7c14f4bdf76 100644
--- a/lib/lib.es2020.sharedmemory.d.ts
+++ b/lib/lib.es2020.sharedmemory.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Atomics {
/**
* Adds a value to the value at the given position in the array, returning the original value.
diff --git a/lib/lib.es2020.string.d.ts b/lib/lib.es2020.string.d.ts
index 19c730752fbb3..ed6a7ff4e279a 100644
--- a/lib/lib.es2020.string.d.ts
+++ b/lib/lib.es2020.string.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
interface String {
diff --git a/lib/lib.es2020.symbol.wellknown.d.ts b/lib/lib.es2020.symbol.wellknown.d.ts
index 7df0a2f45774a..89262b74c98fc 100644
--- a/lib/lib.es2020.symbol.wellknown.d.ts
+++ b/lib/lib.es2020.symbol.wellknown.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
diff --git a/lib/lib.es2021.d.ts b/lib/lib.es2021.d.ts
index 74b5288d103b4..0d1ffaa63500b 100644
--- a/lib/lib.es2021.d.ts
+++ b/lib/lib.es2021.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2021.full.d.ts b/lib/lib.es2021.full.d.ts
index 53488737712c8..dd10e3ef1b744 100644
--- a/lib/lib.es2021.full.d.ts
+++ b/lib/lib.es2021.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2021.intl.d.ts b/lib/lib.es2021.intl.d.ts
index 9a8ac5593b56b..ac9ffdb7e746d 100644
--- a/lib/lib.es2021.intl.d.ts
+++ b/lib/lib.es2021.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
diff --git a/lib/lib.es2021.promise.d.ts b/lib/lib.es2021.promise.d.ts
index e3db43ffafd45..6ef98b6383ab2 100644
--- a/lib/lib.es2021.promise.d.ts
+++ b/lib/lib.es2021.promise.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface AggregateError extends Error {
errors: any[]
}
diff --git a/lib/lib.es2021.string.d.ts b/lib/lib.es2021.string.d.ts
index 89b27e2fe9094..563ee82d2dacc 100644
--- a/lib/lib.es2021.string.d.ts
+++ b/lib/lib.es2021.string.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface String {
/**
* Replace all instances of a substring in a string, using a regular expression or search string.
diff --git a/lib/lib.es2021.weakref.d.ts b/lib/lib.es2021.weakref.d.ts
index eb7764242d7b9..9ff32d0ddad05 100644
--- a/lib/lib.es2021.weakref.d.ts
+++ b/lib/lib.es2021.weakref.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface WeakRef {
readonly [Symbol.toStringTag]: "WeakRef";
diff --git a/lib/lib.es2022.array.d.ts b/lib/lib.es2022.array.d.ts
index 1c117c530af89..621857ba0878c 100644
--- a/lib/lib.es2022.array.d.ts
+++ b/lib/lib.es2022.array.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Array {
/**
* Returns the item located at the specified index.
diff --git a/lib/lib.es2022.d.ts b/lib/lib.es2022.d.ts
index baf7b0b344e64..2ae78aba3f6b6 100644
--- a/lib/lib.es2022.d.ts
+++ b/lib/lib.es2022.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2022.error.d.ts b/lib/lib.es2022.error.d.ts
index 4b16e09121d45..1888f3079fb22 100644
--- a/lib/lib.es2022.error.d.ts
+++ b/lib/lib.es2022.error.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface ErrorOptions {
cause?: unknown;
}
diff --git a/lib/lib.es2022.full.d.ts b/lib/lib.es2022.full.d.ts
index 19e78d48de5f6..12c8d73777a46 100644
--- a/lib/lib.es2022.full.d.ts
+++ b/lib/lib.es2022.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es2022.intl.d.ts b/lib/lib.es2022.intl.d.ts
index ff487a11c955c..96200eff93f86 100644
--- a/lib/lib.es2022.intl.d.ts
+++ b/lib/lib.es2022.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Intl {
/**
diff --git a/lib/lib.es2022.object.d.ts b/lib/lib.es2022.object.d.ts
index 2fe2a1917f15e..25b64c97c1081 100644
--- a/lib/lib.es2022.object.d.ts
+++ b/lib/lib.es2022.object.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface ObjectConstructor {
/**
* Determines whether an object has a property with the specified name.
diff --git a/lib/lib.es2022.regexp.d.ts b/lib/lib.es2022.regexp.d.ts
index fdb0ea6007aa3..88ebbce9b6b31 100644
--- a/lib/lib.es2022.regexp.d.ts
+++ b/lib/lib.es2022.regexp.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface RegExpMatchArray {
indices?: RegExpIndicesArray;
}
diff --git a/lib/lib.es2022.sharedmemory.d.ts b/lib/lib.es2022.sharedmemory.d.ts
index f3661cf87923e..5126a4b58e6eb 100644
--- a/lib/lib.es2022.sharedmemory.d.ts
+++ b/lib/lib.es2022.sharedmemory.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Atomics {
/**
* A non-blocking, asynchronous version of wait which is usable on the main thread.
diff --git a/lib/lib.es2022.string.d.ts b/lib/lib.es2022.string.d.ts
index fbfc17f16d8d0..a7868f178eec8 100644
--- a/lib/lib.es2022.string.d.ts
+++ b/lib/lib.es2022.string.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface String {
/**
* Returns a new String consisting of the single UTF-16 code unit located at the specified index.
diff --git a/lib/lib.es2023.array.d.ts b/lib/lib.es2023.array.d.ts
index cd6dee2825211..9b01b26bdeb16 100644
--- a/lib/lib.es2023.array.d.ts
+++ b/lib/lib.es2023.array.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
interface Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
diff --git a/lib/lib.es2023.d.ts b/lib/lib.es2023.d.ts
index 3cd069499be71..d8e06577462c3 100644
--- a/lib/lib.es2023.d.ts
+++ b/lib/lib.es2023.d.ts
@@ -14,9 +14,7 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
diff --git a/lib/lib.es2023.full.d.ts b/lib/lib.es2023.full.d.ts
index 66ee8a719a072..5cdfd5ca80246 100644
--- a/lib/lib.es2023.full.d.ts
+++ b/lib/lib.es2023.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts
index 7ce8e4a1b179c..e1fc0f44535da 100644
--- a/lib/lib.es5.d.ts
+++ b/lib/lib.es5.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts
index fabf4386173ae..36c71160fb5fd 100644
--- a/lib/lib.es6.d.ts
+++ b/lib/lib.es6.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.esnext.d.ts b/lib/lib.esnext.d.ts
index 822b0182f17a4..e04d1f8b73626 100644
--- a/lib/lib.esnext.d.ts
+++ b/lib/lib.esnext.d.ts
@@ -14,9 +14,7 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
diff --git a/lib/lib.esnext.full.d.ts b/lib/lib.esnext.full.d.ts
index be12ba8e47718..d5308f3b89897 100644
--- a/lib/lib.esnext.full.d.ts
+++ b/lib/lib.esnext.full.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
///
///
///
diff --git a/lib/lib.esnext.intl.d.ts b/lib/lib.esnext.intl.d.ts
index 0eaac02b97688..4f1cee2f54d8a 100644
--- a/lib/lib.esnext.intl.d.ts
+++ b/lib/lib.esnext.intl.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
declare namespace Intl {
interface NumberRangeFormatPart extends NumberFormatPart {
source: "startRange" | "endRange" | "shared"
diff --git a/lib/lib.scripthost.d.ts b/lib/lib.scripthost.d.ts
index 8ac760bab4735..14cebb5314f77 100644
--- a/lib/lib.scripthost.d.ts
+++ b/lib/lib.scripthost.d.ts
@@ -14,12 +14,10 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/////////////////////////////
/// Windows Script Host APIS
/////////////////////////////
diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts
index 2329afedbc247..6b995a42c17b7 100644
--- a/lib/lib.webworker.d.ts
+++ b/lib/lib.webworker.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/////////////////////////////
/// Worker APIs
/////////////////////////////
diff --git a/lib/lib.webworker.importscripts.d.ts b/lib/lib.webworker.importscripts.d.ts
index 73bd281664b04..5ca328c567cee 100644
--- a/lib/lib.webworker.importscripts.d.ts
+++ b/lib/lib.webworker.importscripts.d.ts
@@ -14,11 +14,9 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/////////////////////////////
/// WorkerGlobalScope APIs
/////////////////////////////
diff --git a/lib/lib.webworker.iterable.d.ts b/lib/lib.webworker.iterable.d.ts
index b8035985329ab..e84c89d49b00f 100644
--- a/lib/lib.webworker.iterable.d.ts
+++ b/lib/lib.webworker.iterable.d.ts
@@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
-
///
-
/////////////////////////////
/// Worker Iterable APIs
/////////////////////////////
diff --git a/lib/tsc.js b/lib/tsc.js
index 26516cd868574..92bf3cf998750 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -23,7 +23,7 @@ var __export = (target, all) => {
// src/compiler/corePublic.ts
var versionMajorMinor = "5.0";
-var version = `${versionMajorMinor}.0-beta`;
+var version = `${versionMajorMinor}.1-rc`;
// src/compiler/core.ts
var emptyArray = [];
@@ -614,6 +614,12 @@ function first(array) {
Debug.assert(array.length !== 0);
return array[0];
}
+function firstIterator(iter) {
+ for (const value of iter) {
+ return value;
+ }
+ Debug.fail("iterator is empty");
+}
function lastOrUndefined(array) {
return array === void 0 || array.length === 0 ? void 0 : array[array.length - 1];
}
@@ -2676,7 +2682,7 @@ var nativePerformance = nativePerformanceHooks == null ? void 0 : nativePerforma
function tryGetNativePerformanceHooks() {
return nativePerformanceHooks;
}
-var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +new Date();
+var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +/* @__PURE__ */ new Date();
// src/compiler/perfLogger.ts
var nullLogger = {
@@ -2769,6 +2775,9 @@ function mark(markName) {
counts.set(markName, count + 1);
marks.set(markName, timestamp());
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
+ if (typeof onProfilerEvent === "function") {
+ onProfilerEvent(markName);
+ }
}
}
function measure(measureName, startMarkName, endMarkName) {
@@ -3739,13 +3748,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -4028,7 +4038,7 @@ var PollingInterval = /* @__PURE__ */ ((PollingInterval3) => {
PollingInterval3[PollingInterval3["Low"] = 250] = "Low";
return PollingInterval3;
})(PollingInterval || {});
-var missingFileModifiedTime = new Date(0);
+var missingFileModifiedTime = /* @__PURE__ */ new Date(0);
function getModifiedTime(host, fileName) {
return host.getModifiedTime(fileName) || missingFileModifiedTime;
}
@@ -4253,7 +4263,7 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
const watcher = fsWatch(
dirName,
- FileSystemEntryKind.Directory,
+ 1 /* Directory */,
(_eventName, relativeFileName, modifiedTime) => {
if (!isString(relativeFileName))
return;
@@ -4453,7 +4463,7 @@ function createDirectoryWatcherSupportingRecursive({
}
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
const parentWatcher = cache.get(dirPath);
- if (parentWatcher && fileSystemEntryExists(dirName, FileSystemEntryKind.Directory)) {
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
return;
}
@@ -4518,7 +4528,7 @@ function createDirectoryWatcherSupportingRecursive({
return false;
let newChildWatches;
const hasChanges = enumerateInsertsAndDeletes(
- fileSystemEntryExists(parentDir, FileSystemEntryKind.Directory) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
+ fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
const childFullName = getNormalizedAbsolutePath(child, parentDir);
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
}) : emptyArray,
@@ -4549,11 +4559,6 @@ function createDirectoryWatcherSupportingRecursive({
return stringContains(toCanonicalFilePath(path), searchPath);
}
}
-var FileSystemEntryKind = /* @__PURE__ */ ((FileSystemEntryKind2) => {
- FileSystemEntryKind2[FileSystemEntryKind2["File"] = 0] = "File";
- FileSystemEntryKind2[FileSystemEntryKind2["Directory"] = 1] = "Directory";
- return FileSystemEntryKind2;
-})(FileSystemEntryKind || {});
function createFileWatcherCallback(callback) {
return (_fileName, eventKind, modifiedTime) => callback(eventKind === 1 /* Changed */ ? "change" : "rename", "", modifiedTime);
}
@@ -5123,7 +5128,7 @@ var sys = (() => {
if (!err) {
try {
if ((_a2 = statSync(profilePath)) == null ? void 0 : _a2.isDirectory()) {
- profilePath = _path.join(profilePath, `${new Date().toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
+ profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
}
} catch (e) {
}
@@ -6048,7 +6053,6 @@ var Diagnostics = {
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* 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."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* 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}')'?"),
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* 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'."),
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -6177,6 +6181,7 @@ var Diagnostics = {
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, 3 /* Message */, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),
_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
+ Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -6570,7 +6575,6 @@ var Diagnostics = {
Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -6694,7 +6698,7 @@ var Diagnostics = {
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -6886,13 +6890,11 @@ var Diagnostics = {
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
- Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
+ Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
- Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
- Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
- Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify 'ignoreDeprecations: "{2}"' to silence this error.`),
+ Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
@@ -6980,7 +6982,7 @@ var Diagnostics = {
Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
- File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
+ File_0_exists_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exists_use_it_as_a_name_resolution_result_6097", "File '{0}' exists - use it as a name resolution result."),
Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
@@ -7270,6 +7272,11 @@ var Diagnostics = {
Use_the_package_json_imports_field_when_resolving_imports: diag(6409, 3 /* Message */, "Use_the_package_json_imports_field_when_resolving_imports_6409", "Use the package.json 'imports' field when resolving imports."),
Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -7431,6 +7438,7 @@ var Diagnostics = {
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
+ This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
@@ -7528,7 +7536,7 @@ var Diagnostics = {
You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
- Decorators_must_come_after_export_or_export_default_in_JavaScript_files: diag(8038, 1 /* Error */, "Decorators_must_come_after_export_or_export_default_in_JavaScript_files_8038", "Decorators must come after 'export' or 'export default' in JavaScript files."),
+ Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -8457,18 +8465,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
return true;
}
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start, length2) {
- let text = textInitial;
- let pos;
- let end;
- let startPos;
- let tokenPos;
- let token;
- let tokenValue;
- let tokenFlags;
- let commentDirectives;
- let inJSDocType = 0;
+ var text = textInitial;
+ var pos;
+ var end;
+ var startPos;
+ var tokenPos;
+ var token;
+ var tokenValue;
+ var tokenFlags;
+ var commentDirectives;
+ var inJSDocType = 0;
setText(text, start, length2);
- const scanner = {
+ var scanner = {
getStartPos: () => startPos,
getTextPos: () => pos,
getToken: () => token,
@@ -10707,6 +10715,9 @@ function isFunctionLikeOrClassStaticBlockDeclaration(node) {
function isFunctionLikeDeclaration(node) {
return node && isFunctionLikeDeclarationKind(node.kind);
}
+function isBooleanLiteral(node) {
+ return node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */;
+}
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
case 259 /* FunctionDeclaration */:
@@ -11316,7 +11327,7 @@ function isTransientSymbol(symbol) {
}
var stringWriter = createSingleLineStringWriter();
function createSingleLineStringWriter() {
- let str = "";
+ var str = "";
const writeText = (text) => str += text;
return {
getText: () => str,
@@ -11645,101 +11656,400 @@ function getInternalEmitFlags(node) {
return emitNode && emitNode.internalFlags || 0;
}
function getScriptTargetFeatures() {
- return {
- es2015: {
- Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"],
- RegExp: ["flags", "sticky", "unicode"],
- Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"],
- ArrayConstructor: ["from", "of"],
- ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"],
- NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"],
- Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"],
- Map: ["entries", "keys", "values"],
- Set: ["entries", "keys", "values"],
- Promise: emptyArray,
- PromiseConstructor: ["all", "race", "reject", "resolve"],
- Symbol: ["for", "keyFor"],
- WeakMap: ["entries", "keys", "values"],
- WeakSet: ["entries", "keys", "values"],
- Iterator: emptyArray,
- AsyncIterator: emptyArray,
- String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"],
- StringConstructor: ["fromCodePoint", "raw"]
- },
- es2016: {
- Array: ["includes"]
- },
- es2017: {
- Atomics: emptyArray,
- SharedArrayBuffer: emptyArray,
- String: ["padStart", "padEnd"],
- ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"],
- DateTimeFormat: ["formatToParts"]
- },
- es2018: {
- Promise: ["finally"],
- RegExpMatchArray: ["groups"],
- RegExpExecArray: ["groups"],
- RegExp: ["dotAll"],
- Intl: ["PluralRules"],
- AsyncIterable: emptyArray,
- AsyncIterableIterator: emptyArray,
- AsyncGenerator: emptyArray,
- AsyncGeneratorFunction: emptyArray,
- NumberFormat: ["formatToParts"]
- },
- es2019: {
- Array: ["flat", "flatMap"],
- ObjectConstructor: ["fromEntries"],
- String: ["trimStart", "trimEnd", "trimLeft", "trimRight"],
- Symbol: ["description"]
- },
- es2020: {
- BigInt: emptyArray,
- BigInt64Array: emptyArray,
- BigUint64Array: emptyArray,
- PromiseConstructor: ["allSettled"],
- SymbolConstructor: ["matchAll"],
- String: ["matchAll"],
- DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"],
- RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"]
- },
- es2021: {
- PromiseConstructor: ["any"],
- String: ["replaceAll"]
- },
- es2022: {
- Array: ["at"],
- String: ["at"],
- Int8Array: ["at"],
- Uint8Array: ["at"],
- Uint8ClampedArray: ["at"],
- Int16Array: ["at"],
- Uint16Array: ["at"],
- Int32Array: ["at"],
- Uint32Array: ["at"],
- Float32Array: ["at"],
- Float64Array: ["at"],
- BigInt64Array: ["at"],
- BigUint64Array: ["at"],
- ObjectConstructor: ["hasOwn"],
- Error: ["cause"]
- },
- es2023: {
- Array: ["findLastIndex", "findLast"],
- Int8Array: ["findLastIndex", "findLast"],
- Uint8Array: ["findLastIndex", "findLast"],
- Uint8ClampedArray: ["findLastIndex", "findLast"],
- Int16Array: ["findLastIndex", "findLast"],
- Uint16Array: ["findLastIndex", "findLast"],
- Int32Array: ["findLastIndex", "findLast"],
- Uint32Array: ["findLastIndex", "findLast"],
- Float32Array: ["findLastIndex", "findLast"],
- Float64Array: ["findLastIndex", "findLast"],
- BigInt64Array: ["findLastIndex", "findLast"],
- BigUint64Array: ["findLastIndex", "findLast"]
- }
- };
+ return new Map(Object.entries({
+ Array: new Map(Object.entries({
+ es2015: [
+ "find",
+ "findIndex",
+ "fill",
+ "copyWithin",
+ "entries",
+ "keys",
+ "values"
+ ],
+ es2016: [
+ "includes"
+ ],
+ es2019: [
+ "flat",
+ "flatMap"
+ ],
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Iterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ AsyncIterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ Atomics: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ SharedArrayBuffer: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ AsyncIterable: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncIterableIterator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGenerator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGeneratorFunction: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ RegExp: new Map(Object.entries({
+ es2015: [
+ "flags",
+ "sticky",
+ "unicode"
+ ],
+ es2018: [
+ "dotAll"
+ ]
+ })),
+ Reflect: new Map(Object.entries({
+ es2015: [
+ "apply",
+ "construct",
+ "defineProperty",
+ "deleteProperty",
+ "get",
+ " getOwnPropertyDescriptor",
+ "getPrototypeOf",
+ "has",
+ "isExtensible",
+ "ownKeys",
+ "preventExtensions",
+ "set",
+ "setPrototypeOf"
+ ]
+ })),
+ ArrayConstructor: new Map(Object.entries({
+ es2015: [
+ "from",
+ "of"
+ ]
+ })),
+ ObjectConstructor: new Map(Object.entries({
+ es2015: [
+ "assign",
+ "getOwnPropertySymbols",
+ "keys",
+ "is",
+ "setPrototypeOf"
+ ],
+ es2017: [
+ "values",
+ "entries",
+ "getOwnPropertyDescriptors"
+ ],
+ es2019: [
+ "fromEntries"
+ ],
+ es2022: [
+ "hasOwn"
+ ]
+ })),
+ NumberConstructor: new Map(Object.entries({
+ es2015: [
+ "isFinite",
+ "isInteger",
+ "isNaN",
+ "isSafeInteger",
+ "parseFloat",
+ "parseInt"
+ ]
+ })),
+ Math: new Map(Object.entries({
+ es2015: [
+ "clz32",
+ "imul",
+ "sign",
+ "log10",
+ "log2",
+ "log1p",
+ "expm1",
+ "cosh",
+ "sinh",
+ "tanh",
+ "acosh",
+ "asinh",
+ "atanh",
+ "hypot",
+ "trunc",
+ "fround",
+ "cbrt"
+ ]
+ })),
+ Map: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ Set: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ PromiseConstructor: new Map(Object.entries({
+ es2015: [
+ "all",
+ "race",
+ "reject",
+ "resolve"
+ ],
+ es2020: [
+ "allSettled"
+ ],
+ es2021: [
+ "any"
+ ]
+ })),
+ Symbol: new Map(Object.entries({
+ es2015: [
+ "for",
+ "keyFor"
+ ],
+ es2019: [
+ "description"
+ ]
+ })),
+ WeakMap: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ WeakSet: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ String: new Map(Object.entries({
+ es2015: [
+ "codePointAt",
+ "includes",
+ "endsWith",
+ "normalize",
+ "repeat",
+ "startsWith",
+ "anchor",
+ "big",
+ "blink",
+ "bold",
+ "fixed",
+ "fontcolor",
+ "fontsize",
+ "italics",
+ "link",
+ "small",
+ "strike",
+ "sub",
+ "sup"
+ ],
+ es2017: [
+ "padStart",
+ "padEnd"
+ ],
+ es2019: [
+ "trimStart",
+ "trimEnd",
+ "trimLeft",
+ "trimRight"
+ ],
+ es2020: [
+ "matchAll"
+ ],
+ es2021: [
+ "replaceAll"
+ ],
+ es2022: [
+ "at"
+ ]
+ })),
+ StringConstructor: new Map(Object.entries({
+ es2015: [
+ "fromCodePoint",
+ "raw"
+ ]
+ })),
+ DateTimeFormat: new Map(Object.entries({
+ es2017: [
+ "formatToParts"
+ ]
+ })),
+ Promise: new Map(Object.entries({
+ es2015: emptyArray,
+ es2018: [
+ "finally"
+ ]
+ })),
+ RegExpMatchArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ RegExpExecArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ Intl: new Map(Object.entries({
+ es2018: [
+ "PluralRules"
+ ]
+ })),
+ NumberFormat: new Map(Object.entries({
+ es2018: [
+ "formatToParts"
+ ]
+ })),
+ SymbolConstructor: new Map(Object.entries({
+ es2020: [
+ "matchAll"
+ ]
+ })),
+ DataView: new Map(Object.entries({
+ es2020: [
+ "setBigInt64",
+ "setBigUint64",
+ "getBigInt64",
+ "getBigUint64"
+ ]
+ })),
+ BigInt: new Map(Object.entries({
+ es2020: emptyArray
+ })),
+ RelativeTimeFormat: new Map(Object.entries({
+ es2020: [
+ "format",
+ "formatToParts",
+ "resolvedOptions"
+ ]
+ })),
+ Int8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8ClampedArray: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float64Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigInt64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigUint64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Error: new Map(Object.entries({
+ es2022: [
+ "cause"
+ ]
+ }))
+ }));
}
function getLiteralText(node, sourceFile, flags) {
var _a2;
@@ -11847,7 +12157,7 @@ function isCommonJSContainingModuleKind(kind) {
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
}
function isEffectiveExternalModule(node, compilerOptions) {
- return isExternalModule(node) || compilerOptions.isolatedModules || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
+ return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
}
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
switch (node.scriptKind) {
@@ -11868,7 +12178,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
if (startsWithUseStrict(node.statements)) {
return true;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
return true;
}
@@ -14293,12 +14603,12 @@ function isNightly() {
return stringContains(version, "-dev") || stringContains(version, "-insiders");
}
function createTextWriter(newLine) {
- let output;
- let indent2;
- let lineStart;
- let lineCount;
- let linePos;
- let hasTrailingComment = false;
+ var output;
+ var indent2;
+ var lineStart;
+ var lineCount;
+ var linePos;
+ var hasTrailingComment = false;
function updateLineCountAndPosFor(s) {
const lineStartsOfS = computeLineStarts(s);
if (lineStartsOfS.length > 1) {
@@ -15335,17 +15645,11 @@ function getCombinedLocalAndExportSymbolFlags(symbol) {
return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
}
function isWriteOnlyAccess(node) {
- return accessKind(node) === AccessKind.Write;
+ return accessKind(node) === 1 /* Write */;
}
function isWriteAccess(node) {
- return accessKind(node) !== AccessKind.Read;
-}
-var AccessKind = /* @__PURE__ */ ((AccessKind2) => {
- AccessKind2[AccessKind2["Read"] = 0] = "Read";
- AccessKind2[AccessKind2["Write"] = 1] = "Write";
- AccessKind2[AccessKind2["ReadWrite"] = 2] = "ReadWrite";
- return AccessKind2;
-})(AccessKind || {});
+ return accessKind(node) !== 0 /* Read */;
+}
function accessKind(node) {
const { parent } = node;
if (!parent)
@@ -15438,9 +15742,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
function getObjectFlags(type) {
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
}
-function typeHasCallOrConstructSignatures(type, checker) {
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
-}
function isUMDExportSymbol(symbol) {
return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
}
@@ -15904,6 +16205,22 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
}
+function getResolvePackageJsonExports(compilerOptions) {
+ const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
+ if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
+ return false;
+ }
+ if (compilerOptions.resolvePackageJsonExports !== void 0) {
+ return compilerOptions.resolvePackageJsonExports;
+ }
+ switch (moduleResolution) {
+ case 3 /* Node16 */:
+ case 99 /* NodeNext */:
+ case 100 /* Bundler */:
+ return true;
+ }
+ return false;
+}
function getResolveJsonModule(compilerOptions) {
if (compilerOptions.resolveJsonModule !== void 0) {
return compilerOptions.resolveJsonModule;
@@ -15914,7 +16231,7 @@ function getEmitDeclarations(compilerOptions) {
return !!(compilerOptions.declaration || compilerOptions.composite);
}
function shouldPreserveConstEnums(compilerOptions) {
- return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
+ return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
}
function isIncrementalCompilation(options) {
return !!(options.incremental || options.composite);
@@ -16479,7 +16796,7 @@ function rangeOfNode(node) {
}
function rangeOfTypeParameters(sourceFile, typeParameters) {
const pos = typeParameters.pos - 1;
- const end = skipTrivia(sourceFile.text, typeParameters.end) + 1;
+ const end = Math.min(sourceFile.text.length, skipTrivia(sourceFile.text, typeParameters.end) + 1);
return { pos, end };
}
function skipTypeChecking(sourceFile, options, host) {
@@ -19517,24 +19834,7 @@ function createNodeFactory(flags, baseFactory2) {
return node;
}
function propagateAssignmentPatternFlags(node) {
- if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
- return 65536 /* ContainsObjectRestOrSpread */;
- if (node.transformFlags & 128 /* ContainsES2018 */) {
- for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
- const target = getTargetOfBindingOrAssignmentElement(element);
- if (target && isAssignmentPattern(target)) {
- if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
- return 65536 /* ContainsObjectRestOrSpread */;
- }
- if (target.transformFlags & 128 /* ContainsES2018 */) {
- const flags2 = propagateAssignmentPatternFlags(target);
- if (flags2)
- return flags2;
- }
- }
- }
- }
- return 0 /* None */;
+ return containsObjectRestOrSpread(node) ? 65536 /* ContainsObjectRestOrSpread */ : 0 /* None */;
}
function updateBinaryExpression(node, left, operator, right) {
return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node;
@@ -22486,14 +22786,114 @@ function createEmitHelperFactory(context) {
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name)
]);
}
+ function createESDecorateClassElementAccessGetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "get",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ accessor
+ )
+ );
+ }
+ function createESDecorateClassElementAccessSetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "set",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ ),
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("value")
+ )
+ ],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBlock([
+ factory2.createExpressionStatement(
+ factory2.createAssignment(
+ accessor,
+ factory2.createIdentifier("value")
+ )
+ )
+ ])
+ )
+ );
+ }
+ function createESDecorateClassElementAccessHasMethod(elementName) {
+ const propertyName = elementName.computed ? elementName.name : isIdentifier(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name;
+ return factory2.createPropertyAssignment(
+ "has",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBinaryExpression(
+ propertyName,
+ 101 /* InKeyword */,
+ factory2.createIdentifier("obj")
+ )
+ )
+ );
+ }
+ function createESDecorateClassElementAccessObject(name, access) {
+ const properties = [];
+ properties.push(createESDecorateClassElementAccessHasMethod(name));
+ if (access.get)
+ properties.push(createESDecorateClassElementAccessGetMethod(name));
+ if (access.set)
+ properties.push(createESDecorateClassElementAccessSetMethod(name));
+ return factory2.createObjectLiteralExpression(properties);
+ }
function createESDecorateClassElementContextObject(contextIn) {
return factory2.createObjectLiteralExpression([
factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral(contextIn.kind)),
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory2.createStringLiteralFromNode(contextIn.name.name)),
factory2.createPropertyAssignment(factory2.createIdentifier("static"), contextIn.static ? factory2.createTrue() : factory2.createFalse()),
- factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse())
- // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494
- // factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
+ factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse()),
+ factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
]);
}
function createESDecorateContextObject(contextIn) {
@@ -24566,7 +24966,7 @@ function canHaveIllegalDecorators(node) {
}
function canHaveIllegalModifiers(node) {
const kind = node.kind;
- return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 181 /* FunctionType */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
+ return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
}
function isQuestionOrExclamationToken(node) {
return isQuestionToken(node) || isExclamationToken(node);
@@ -24931,6 +25331,25 @@ function flattenCommaList(node) {
flattenCommaListWorker(node, expressions);
return expressions;
}
+function containsObjectRestOrSpread(node) {
+ if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
+ return true;
+ if (node.transformFlags & 128 /* ContainsES2018 */) {
+ for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
+ const target = getTargetOfBindingOrAssignmentElement(element);
+ if (target && isAssignmentPattern(target)) {
+ if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ return true;
+ }
+ if (target.transformFlags & 128 /* ContainsES2018 */) {
+ if (containsObjectRestOrSpread(target))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
// src/compiler/factory/utilitiesPublic.ts
function setTextRange(range, location) {
@@ -25586,22 +26005,22 @@ function isExternalModule(file) {
}
var Parser;
((Parser2) => {
- const scanner = createScanner(
+ var scanner = createScanner(
99 /* Latest */,
/*skipTrivia*/
true
);
- const disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
- let NodeConstructor2;
- let TokenConstructor2;
- let IdentifierConstructor2;
- let PrivateIdentifierConstructor2;
- let SourceFileConstructor2;
+ var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
+ var NodeConstructor2;
+ var TokenConstructor2;
+ var IdentifierConstructor2;
+ var PrivateIdentifierConstructor2;
+ var SourceFileConstructor2;
function countNode(node) {
nodeCount++;
return node;
}
- const baseNodeFactory = {
+ var baseNodeFactory = {
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
kind,
/*pos*/
@@ -25638,25 +26057,53 @@ var Parser;
0
))
};
- const factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
- let fileName;
- let sourceFlags;
- let sourceText;
- let languageVersion;
- let scriptKind;
- let languageVariant;
- let parseDiagnostics;
- let jsDocDiagnostics;
- let syntaxCursor;
- let currentToken;
- let nodeCount;
- let identifiers;
- let identifierCount;
- let parsingContext;
- let notParenthesizedArrow;
- let contextFlags;
- let topLevel = true;
- let parseErrorBeforeNextFinishedNode = false;
+ var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
+ var {
+ createNodeArray: factoryCreateNodeArray,
+ createNumericLiteral: factoryCreateNumericLiteral,
+ createStringLiteral: factoryCreateStringLiteral,
+ createLiteralLikeNode: factoryCreateLiteralLikeNode,
+ createIdentifier: factoryCreateIdentifier,
+ createPrivateIdentifier: factoryCreatePrivateIdentifier,
+ createToken: factoryCreateToken,
+ createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
+ createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
+ createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
+ createPropertyAccessChain: factoryCreatePropertyAccessChain,
+ createElementAccessExpression: factoryCreateElementAccessExpression,
+ createElementAccessChain: factoryCreateElementAccessChain,
+ createCallExpression: factoryCreateCallExpression,
+ createCallChain: factoryCreateCallChain,
+ createNewExpression: factoryCreateNewExpression,
+ createParenthesizedExpression: factoryCreateParenthesizedExpression,
+ createBlock: factoryCreateBlock,
+ createVariableStatement: factoryCreateVariableStatement,
+ createExpressionStatement: factoryCreateExpressionStatement,
+ createIfStatement: factoryCreateIfStatement,
+ createWhileStatement: factoryCreateWhileStatement,
+ createForStatement: factoryCreateForStatement,
+ createForOfStatement: factoryCreateForOfStatement,
+ createVariableDeclaration: factoryCreateVariableDeclaration,
+ createVariableDeclarationList: factoryCreateVariableDeclarationList
+ } = factory2;
+ var fileName;
+ var sourceFlags;
+ var sourceText;
+ var languageVersion;
+ var scriptKind;
+ var languageVariant;
+ var parseDiagnostics;
+ var jsDocDiagnostics;
+ var syntaxCursor;
+ var currentToken;
+ var nodeCount;
+ var identifiers;
+ var identifierCount;
+ var parsingContext;
+ var notParenthesizedArrow;
+ var contextFlags;
+ var topLevel = true;
+ var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
var _a2;
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
@@ -25756,8 +26203,8 @@ var Parser;
}
}
}
- const expression = isArray(expressions) ? finishNode(factory2.createArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
- const statement = factory2.createExpressionStatement(expression);
+ const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
+ const statement = factoryCreateExpressionStatement(expression);
finishNode(statement, pos);
statements = createNodeArray([statement], pos);
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
@@ -25849,7 +26296,7 @@ var Parser;
}
sourceFlags = contextFlags;
nextToken();
- const statements = parseList(ParsingContext.SourceElements, parseStatement);
+ const statements = parseList(0 /* SourceElements */, parseStatement);
Debug.assert(token() === 1 /* EndOfFileToken */);
const endOfFileToken = addJSDocComment(parseTokenNode());
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
@@ -25912,7 +26359,7 @@ var Parser;
nextToken();
while (token() !== 1 /* EndOfFileToken */) {
const startPos = scanner.getStartPos();
- const statement = parseListElement(ParsingContext.SourceElements, parseStatement);
+ const statement = parseListElement(0 /* SourceElements */, parseStatement);
statements.push(statement);
if (startPos === scanner.getStartPos()) {
nextToken();
@@ -25940,7 +26387,7 @@ var Parser;
}
}
syntaxCursor = savedSyntaxCursor;
- return factory2.updateSourceFile(sourceFile, setTextRange(factory2.createNodeArray(statements), sourceFile.statements));
+ return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
function containsPossibleTopLevelAwait(node) {
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
}
@@ -26381,13 +26828,13 @@ var Parser;
const pos = getNodePos();
const kind = token();
nextToken();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseTokenNodeJSDoc() {
const pos = getNodePos();
const kind = token();
nextTokenJSDoc();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function canParseSemicolon() {
if (token() === 26 /* SemicolonToken */) {
@@ -26408,7 +26855,7 @@ var Parser;
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
}
function createNodeArray(elements, pos, end, hasTrailingComma) {
- const array = factory2.createNodeArray(elements, hasTrailingComma);
+ const array = factoryCreateNodeArray(elements, hasTrailingComma);
setTextRangePosEnd(array, pos, end != null ? end : scanner.getStartPos());
return array;
}
@@ -26430,7 +26877,7 @@ var Parser;
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
const pos = getNodePos();
- const result = kind === 79 /* Identifier */ ? factory2.createIdentifier(
+ const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
"",
/*originalKeywordKind*/
void 0
@@ -26440,15 +26887,15 @@ var Parser;
"",
/*templateFlags*/
void 0
- ) : kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(
+ ) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
"",
/*numericLiteralFlags*/
void 0
- ) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ ) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
"",
/*isSingleQuote*/
void 0
- ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factory2.createToken(kind);
+ ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
return finishNode(result, pos);
}
function internIdentifier(text) {
@@ -26466,7 +26913,7 @@ var Parser;
const text = internIdentifier(scanner.getTokenValue());
const hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
nextTokenWithoutCheck();
- return finishNode(factory2.createIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
+ return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
}
if (token() === 80 /* PrivateIdentifier */) {
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -26537,7 +26984,7 @@ var Parser;
}
function parsePrivateIdentifier() {
const pos = getNodePos();
- const node = factory2.createPrivateIdentifier(internIdentifier(scanner.getTokenValue()));
+ const node = factoryCreatePrivateIdentifier(internIdentifier(scanner.getTokenValue()));
nextToken();
return finishNode(node, pos);
}
@@ -26566,7 +27013,6 @@ var Parser;
return canFollowExportModifier();
case 88 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 127 /* AccessorKeyword */:
case 124 /* StaticKeyword */:
case 137 /* GetKeyword */:
case 151 /* SetKeyword */:
@@ -26599,19 +27045,19 @@ var Parser;
return true;
}
switch (parsingContext2) {
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return lookAhead(isClassMemberStart) || token() === 26 /* SemicolonToken */ && !inErrorRecovery;
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return token() === 22 /* OpenBracketToken */ || isLiteralPropertyName();
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
switch (token()) {
case 22 /* OpenBracketToken */:
case 41 /* AsteriskToken */:
@@ -26621,13 +27067,13 @@ var Parser;
default:
return isLiteralPropertyName();
}
- case ParsingContext.RestProperties:
+ case 18 /* RestProperties */:
return isLiteralPropertyName();
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return token() === 22 /* OpenBracketToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName();
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return isAssertionKey2();
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
if (token() === 18 /* OpenBraceToken */) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
@@ -26636,40 +27082,40 @@ var Parser;
} else {
return isIdentifier2() && !isHeritageClauseExtendsOrImplementsKeyword();
}
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
switch (token()) {
case 27 /* CommaToken */:
case 24 /* DotToken */:
return true;
}
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 25 /* DotDotDotToken */ || isStartOfExpression();
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isStartOfParameter(
/*isJSDocParameter*/
false
);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return isStartOfParameter(
/*isJSDocParameter*/
true
);
- case ParsingContext.TypeArguments:
- case ParsingContext.TupleElementTypes:
+ case 20 /* TypeArguments */:
+ case 21 /* TupleElementTypes */:
return token() === 27 /* CommaToken */ || isStartOfType();
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return isHeritageClause2();
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return tokenIsIdentifierOrKeyword(token());
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return true;
}
return Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -26713,41 +27159,41 @@ var Parser;
return true;
}
switch (kind) {
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauses:
- case ParsingContext.TypeMembers:
- case ParsingContext.ClassMembers:
- case ParsingContext.EnumMembers:
- case ParsingContext.ObjectLiteralMembers:
- case ParsingContext.ObjectBindingElements:
- case ParsingContext.ImportOrExportSpecifiers:
- case ParsingContext.AssertEntries:
+ case 1 /* BlockStatements */:
+ case 2 /* SwitchClauses */:
+ case 4 /* TypeMembers */:
+ case 5 /* ClassMembers */:
+ case 6 /* EnumMembers */:
+ case 12 /* ObjectLiteralMembers */:
+ case 9 /* ObjectBindingElements */:
+ case 23 /* ImportOrExportSpecifiers */:
+ case 24 /* AssertEntries */:
return token() === 19 /* CloseBraceToken */;
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return token() === 19 /* CloseBraceToken */ || token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 31 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
- case ParsingContext.ArrayLiteralMembers:
- case ParsingContext.TupleElementTypes:
- case ParsingContext.ArrayBindingElements:
+ case 15 /* ArrayLiteralMembers */:
+ case 21 /* TupleElementTypes */:
+ case 10 /* ArrayBindingElements */:
return token() === 23 /* CloseBracketToken */;
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
- case ParsingContext.RestProperties:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
+ case 18 /* RestProperties */:
return token() === 21 /* CloseParenToken */ || token() === 23 /* CloseBracketToken */;
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return token() !== 27 /* CommaToken */;
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return token() === 18 /* OpenBraceToken */ || token() === 19 /* CloseBraceToken */;
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return token() === 31 /* GreaterThanToken */ || token() === 43 /* SlashToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
default:
return false;
@@ -26766,7 +27212,7 @@ var Parser;
return false;
}
function isInSomeParsingContext() {
- for (let kind = 0; kind < ParsingContext.Count; kind++) {
+ for (let kind = 0; kind < 25 /* Count */; kind++) {
if (parsingContext & 1 << kind) {
if (isListElement(
kind,
@@ -26835,38 +27281,38 @@ var Parser;
}
function isReusableParsingContext(parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
- case ParsingContext.SwitchClauses:
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
- case ParsingContext.EnumMembers:
- case ParsingContext.TypeMembers:
- case ParsingContext.VariableDeclarations:
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 5 /* ClassMembers */:
+ case 2 /* SwitchClauses */:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
+ case 6 /* EnumMembers */:
+ case 4 /* TypeMembers */:
+ case 8 /* VariableDeclarations */:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return true;
}
return false;
}
function canReuseNode(node, parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return isReusableClassMember(node);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return isReusableSwitchClause(node);
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return isReusableStatement(node);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return isReusableEnumMember(node);
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return isReusableTypeMember(node);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isReusableVariableDeclaration(node);
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return isReusableParameter(node);
}
return false;
@@ -26976,56 +27422,56 @@ var Parser;
}
function parsingContextErrors(context) {
switch (context) {
- case ParsingContext.SourceElements:
+ case 0 /* SourceElements */:
return token() === 88 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(93 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.BlockStatements:
+ case 1 /* BlockStatements */:
return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return parseErrorAtCurrentToken(Diagnostics.case_or_default_expected);
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
- case ParsingContext.RestProperties:
- case ParsingContext.TypeMembers:
+ case 18 /* RestProperties */:
+ case 4 /* TypeMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return parseErrorAtCurrentToken(Diagnostics.Enum_member_expected);
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return parseErrorAtCurrentToken(Diagnostics.Expression_expected);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Variable_declaration_expected);
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Property_destructuring_pattern_expected);
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Array_element_destructuring_pattern_expected);
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return parseErrorAtCurrentToken(Diagnostics.Argument_expression_expected);
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
- case ParsingContext.TupleElementTypes:
+ case 21 /* TupleElementTypes */:
return parseErrorAtCurrentToken(Diagnostics.Type_expected);
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_expected);
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
- case ParsingContext.Count:
+ case 25 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(context);
@@ -27084,7 +27530,7 @@ var Parser;
);
}
function getExpectedCommaDiagnostic(kind) {
- return kind === ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
+ return kind === 6 /* EnumMembers */ ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
}
function createMissingList() {
const list = createNodeArray([], getNodePos());
@@ -27253,12 +27699,12 @@ var Parser;
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
// We also do not need to check for negatives because any prefix operator would be part of a
// parent unary expression.
- kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
scanner.getTokenValue(),
/*isSingleQuote*/
void 0,
scanner.hasExtendedUnicodeEscape()
- ) : isLiteralKind(kind) ? factory2.createLiteralLikeNode(kind, scanner.getTokenValue()) : Debug.fail()
+ ) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner.getTokenValue()) : Debug.fail()
);
if (scanner.hasExtendedUnicodeEscape()) {
node.hasExtendedUnicodeEscape = true;
@@ -27278,7 +27724,7 @@ var Parser;
}
function parseTypeArgumentsOfTypeReference() {
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function parseTypeReference() {
@@ -27460,7 +27906,7 @@ var Parser;
}
function parseTypeParameters() {
if (token() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeParameters, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function isStartOfParameter(isJSDocParameter) {
@@ -27566,7 +28012,7 @@ var Parser;
const savedAwaitContext = inAwaitContext();
setYieldContext(!!(flags & 1 /* Yield */));
setAwaitContext(!!(flags & 2 /* Await */));
- const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
+ const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) : parseDelimitedList(16 /* Parameters */, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
return parameters;
@@ -27634,7 +28080,7 @@ var Parser;
return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers) {
- const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(
+ const parameters = parseBracketedList(16 /* Parameters */, () => parseParameter(
/*inOuterAwaitContext*/
false
), 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
@@ -27733,7 +28179,7 @@ var Parser;
function parseObjectTypeMembers() {
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -27787,7 +28233,7 @@ var Parser;
}
const type = parseTypeAnnotation();
parseSemicolon();
- const members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ const members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
}
@@ -27832,7 +28278,7 @@ var Parser;
const pos = getNodePos();
return finishNode(
factory2.createTupleTypeNode(
- parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
+ parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
),
pos
);
@@ -27849,7 +28295,7 @@ var Parser;
if (token() === 126 /* AbstractKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(126 /* AbstractKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -27859,6 +28305,7 @@ var Parser;
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiersForConstructorType();
const isConstructorType = parseOptional(103 /* NewKeyword */);
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
const typeParameters = parseTypeParameters();
const parameters = parseParameters(4 /* Type */);
const type = parseReturnType(
@@ -27867,8 +28314,6 @@ var Parser;
false
);
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
- if (!isConstructorType)
- node.modifiers = modifiers;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseKeywordAndNoDot() {
@@ -28460,10 +28905,10 @@ var Parser;
}
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
const triState = isParenthesizedArrowFunctionExpression();
- if (triState === Tristate.False) {
+ if (triState === 0 /* False */) {
return void 0;
}
- return triState === Tristate.True ? parseParenthesizedArrowFunctionExpression(
+ return triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpression(
/*allowAmbiguity*/
true,
/*allowReturnTypeInArrowFunction*/
@@ -28475,18 +28920,18 @@ var Parser;
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
- return Tristate.False;
+ return 0 /* False */;
}
if (token() !== 20 /* OpenParenToken */ && token() !== 29 /* LessThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
}
const first2 = token();
@@ -28498,45 +28943,45 @@ var Parser;
case 38 /* EqualsGreaterThanToken */:
case 58 /* ColonToken */:
case 18 /* OpenBraceToken */:
- return Tristate.True;
+ return 1 /* True */;
default:
- return Tristate.False;
+ return 0 /* False */;
}
}
if (second === 22 /* OpenBracketToken */ || second === 18 /* OpenBraceToken */) {
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
if (second === 25 /* DotDotDotToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
if (isModifierKind(second) && second !== 132 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
if (nextToken() === 128 /* AsKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.True;
+ return 1 /* True */;
}
if (!isIdentifier2() && second !== 108 /* ThisKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
switch (nextToken()) {
case 58 /* ColonToken */:
- return Tristate.True;
+ return 1 /* True */;
case 57 /* QuestionToken */:
nextToken();
if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 63 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
case 27 /* CommaToken */:
case 63 /* EqualsToken */:
case 21 /* CloseParenToken */:
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
- return Tristate.False;
+ return 0 /* False */;
} else {
Debug.assert(first2 === 29 /* LessThanToken */);
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
if (languageVariant === 1 /* JSX */) {
const isArrowFunctionInJsx = lookAhead(() => {
@@ -28547,6 +28992,7 @@ var Parser;
switch (fourth) {
case 63 /* EqualsToken */:
case 31 /* GreaterThanToken */:
+ case 43 /* SlashToken */:
return false;
default:
return true;
@@ -28557,11 +29003,11 @@ var Parser;
return false;
});
if (isArrowFunctionInJsx) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
}
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
@@ -28581,7 +29027,7 @@ var Parser;
}
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) {
if (token() === 132 /* AsyncKeyword */) {
- if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === Tristate.True) {
+ if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
const pos = getNodePos();
const asyncModifier = parseModifiersForArrowFunction();
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
@@ -28594,14 +29040,14 @@ var Parser;
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak() || token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
if (!scanner.hasPrecedingLineBreak() && expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
}
- return Tristate.False;
+ return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) {
const pos = getNodePos();
@@ -28806,6 +29252,12 @@ var Parser;
case 114 /* VoidKeyword */:
return parseVoidExpression();
case 29 /* LessThanToken */:
+ if (languageVariant === 1 /* JSX */) {
+ return parseJsxElementOrSelfClosingElementOrFragment(
+ /*inExpressionContext*/
+ true
+ );
+ }
return parseTypeAssertion();
case 133 /* AwaitKeyword */:
if (isAwaitExpression2()) {
@@ -28900,7 +29352,7 @@ var Parser;
return expression;
}
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
- return finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -28921,7 +29373,7 @@ var Parser;
factory2.createJsxElement(
lastChild.openingElement,
lastChild.children,
- finishNode(factory2.createJsxClosingElement(finishNode(factory2.createIdentifier(""), end, end)), end, end)
+ finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
),
lastChild.openingElement.pos,
end
@@ -29009,7 +29461,7 @@ var Parser;
const list = [];
const listPos = getNodePos();
const saveParsingContext = parsingContext;
- parsingContext |= 1 << ParsingContext.JsxChildren;
+ parsingContext |= 1 << 14 /* JsxChildren */;
while (true) {
const child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken());
if (!child)
@@ -29024,7 +29476,7 @@ var Parser;
}
function parseJsxAttributes() {
const pos = getNodePos();
- return finishNode(factory2.createJsxAttributes(parseList(ParsingContext.JsxAttributes, parseJsxAttribute)), pos);
+ return finishNode(factory2.createJsxAttributes(parseList(13 /* JsxAttributes */, parseJsxAttribute)), pos);
}
function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
const pos = getNodePos();
@@ -29064,7 +29516,7 @@ var Parser;
scanJsxIdentifier();
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- expression = finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -29158,13 +29610,9 @@ var Parser;
function parseJsxClosingFragment(inExpressionContext) {
const pos = getNodePos();
parseExpected(30 /* LessThanSlashToken */);
- if (tokenIsIdentifierOrKeyword(token())) {
- parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
- }
if (parseExpected(
31 /* GreaterThanToken */,
- /*diagnostic*/
- void 0,
+ Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
/*shouldAdvance*/
false
)) {
@@ -29177,6 +29625,7 @@ var Parser;
return finishNode(factory2.createJsxJsxClosingFragment(), pos);
}
function parseTypeAssertion() {
+ Debug.assert(languageVariant !== 1 /* JSX */, "Type assertions should never be parsed in JSX; they should be parsed as comparisons or JSX elements/fragments.");
const pos = getNodePos();
parseExpected(29 /* LessThanToken */);
const type = parseType();
@@ -29218,7 +29667,7 @@ var Parser;
true
);
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
- const propertyAccess = isOptionalChain2 ? factory2.createPropertyAccessChain(expression, questionDotToken, name) : factory2.createPropertyAccessExpression(expression, name);
+ const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
}
@@ -29246,7 +29695,7 @@ var Parser;
argumentExpression = argument;
}
parseExpected(23 /* CloseBracketToken */);
- const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createElementAccessChain(expression, questionDotToken, argumentExpression) : factory2.createElementAccessExpression(expression, argumentExpression);
+ const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
return finishNode(indexedAccess, pos);
}
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
@@ -29333,7 +29782,7 @@ var Parser;
expression = expression.expression;
}
const argumentList = parseArgumentList();
- const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createCallChain(expression, questionDotToken, typeArguments, argumentList) : factory2.createCallExpression(expression, typeArguments, argumentList);
+ const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
}
@@ -29344,7 +29793,7 @@ var Parser;
false,
Diagnostics.Identifier_expected
);
- expression = finishNode(factory2.createPropertyAccessChain(expression, questionDotToken, name), pos);
+ expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
}
@@ -29352,7 +29801,7 @@ var Parser;
}
function parseArgumentList() {
parseExpected(20 /* OpenParenToken */);
- const result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression);
+ const result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);
parseExpected(21 /* CloseParenToken */);
return result;
}
@@ -29364,7 +29813,7 @@ var Parser;
return void 0;
}
nextToken();
- const typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType);
+ const typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
return void 0;
}
@@ -29439,7 +29888,7 @@ var Parser;
parseExpected(20 /* OpenParenToken */);
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- return withJSDoc(finishNode(factory2.createParenthesizedExpression(expression), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
}
function parseSpreadElement() {
const pos = getNodePos();
@@ -29464,9 +29913,9 @@ var Parser;
const openBracketPosition = scanner.getTokenPos();
const openBracketParsed = parseExpected(22 /* OpenBracketToken */);
const multiLine = scanner.hasPrecedingLineBreak();
- const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
+ const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
- return finishNode(factory2.createArrayLiteralExpression(elements, multiLine), pos);
+ return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
}
function parseObjectLiteralElement() {
const pos = getNodePos();
@@ -29525,13 +29974,13 @@ var Parser;
const openBraceParsed = parseExpected(18 /* OpenBraceToken */);
const multiLine = scanner.hasPrecedingLineBreak();
const properties = parseDelimitedList(
- ParsingContext.ObjectLiteralMembers,
+ 12 /* ObjectLiteralMembers */,
parseObjectLiteralElement,
/*considerSemicolonAsDelimiter*/
true
);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- return finishNode(factory2.createObjectLiteralExpression(properties, multiLine), pos);
+ return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
}
function parseFunctionExpression() {
const savedDecoratorContext = inDecoratorContext();
@@ -29588,7 +30037,7 @@ var Parser;
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
}
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
- return finishNode(factory2.createNewExpression(expression, typeArguments, argumentList), pos);
+ return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
const pos = getNodePos();
@@ -29597,17 +30046,17 @@ var Parser;
const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
if (openBraceParsed || ignoreMissingOpenBrace) {
const multiLine = scanner.hasPrecedingLineBreak();
- const statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ const statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
+ const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
if (token() === 63 /* EqualsToken */) {
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
nextToken();
}
return result;
} else {
const statements = createMissingList();
- return withJSDoc(finishNode(factory2.createBlock(
+ return withJSDoc(finishNode(factoryCreateBlock(
statements,
/*multiLine*/
void 0
@@ -29656,7 +30105,7 @@ var Parser;
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const thenStatement = parseStatement();
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
- return withJSDoc(finishNode(factory2.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
}
function parseDoStatement() {
const pos = getNodePos();
@@ -29680,7 +30129,7 @@ var Parser;
const expression = allowInAnd(parseExpression);
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const statement = parseStatement();
- return withJSDoc(finishNode(factory2.createWhileStatement(expression, statement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
}
function parseForOrForInOrForOfStatement() {
const pos = getNodePos();
@@ -29706,7 +30155,7 @@ var Parser;
true
));
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForOfStatement(awaitToken, initializer, expression, parseStatement());
+ node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
} else if (parseOptional(101 /* InKeyword */)) {
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -29717,7 +30166,7 @@ var Parser;
parseExpected(26 /* SemicolonToken */);
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForStatement(initializer, condition, incrementor, parseStatement());
+ node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
}
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -29755,14 +30204,14 @@ var Parser;
parseExpected(82 /* CaseKeyword */);
const expression = allowInAnd(parseExpression);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return withJSDoc(finishNode(factory2.createCaseClause(expression, statements), pos), hasJSDoc);
}
function parseDefaultClause() {
const pos = getNodePos();
parseExpected(88 /* DefaultKeyword */);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(factory2.createDefaultClause(statements), pos);
}
function parseCaseOrDefaultClause() {
@@ -29771,7 +30220,7 @@ var Parser;
function parseCaseBlock() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const clauses = parseList(ParsingContext.SwitchClauses, parseCaseOrDefaultClause);
+ const clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createCaseBlock(clauses), pos);
}
@@ -29792,7 +30241,7 @@ var Parser;
let expression = scanner.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
if (expression === void 0) {
identifierCount++;
- expression = finishNode(factory2.createIdentifier(""), getNodePos());
+ expression = finishNode(factoryCreateIdentifier(""), getNodePos());
}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
@@ -29853,7 +30302,7 @@ var Parser;
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
}
- node = factory2.createExpressionStatement(expression);
+ node = factoryCreateExpressionStatement(expression);
if (hasParen) {
hasJSDoc = false;
}
@@ -30212,14 +30661,14 @@ var Parser;
function parseObjectBindingPattern() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement);
+ const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createObjectBindingPattern(elements), pos);
}
function parseArrayBindingPattern() {
const pos = getNodePos();
parseExpected(22 /* OpenBracketToken */);
- const elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement);
+ const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
return finishNode(factory2.createArrayBindingPattern(elements), pos);
}
@@ -30251,7 +30700,7 @@ var Parser;
}
const type = parseTypeAnnotation();
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
- const node = factory2.createVariableDeclaration(name, exclamationToken, type, initializer);
+ const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseVariableDeclarationList(inForStatementInitializer) {
@@ -30277,12 +30726,12 @@ var Parser;
const savedDisallowIn = inDisallowInContext();
setDisallowInContext(inForStatementInitializer);
declarations = parseDelimitedList(
- ParsingContext.VariableDeclarations,
+ 8 /* VariableDeclarations */,
inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation
);
setDisallowInContext(savedDisallowIn);
}
- return finishNode(factory2.createVariableDeclarationList(declarations, flags), pos);
+ return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
}
function canFollowContextualOfKeyword() {
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
@@ -30293,7 +30742,7 @@ var Parser;
false
);
parseSemicolon();
- const node = factory2.createVariableStatement(modifiers, declarationList);
+ const node = factoryCreateVariableStatement(modifiers, declarationList);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
@@ -30522,22 +30971,30 @@ var Parser;
return void 0;
}
}
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
const pos = getNodePos();
let list;
- let modifier, hasSeenStaticModifier = false;
+ let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false;
+ if (allowDecorators && token() === 59 /* AtToken */) {
+ while (decorator = tryParseDecorator()) {
+ list = append(list, decorator);
+ }
+ }
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
list = append(list, modifier);
+ hasLeadingModifier = true;
}
- if (allowDecorators && token() === 59 /* AtToken */) {
- let decorator;
+ if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) {
while (decorator = tryParseDecorator()) {
list = append(list, decorator);
+ hasTrailingDecorator = true;
}
+ }
+ if (hasTrailingDecorator) {
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
@@ -30551,7 +31008,7 @@ var Parser;
if (token() === 132 /* AsyncKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(132 /* AsyncKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -30680,7 +31137,7 @@ var Parser;
}
function parseHeritageClauses() {
if (isHeritageClause2()) {
- return parseList(ParsingContext.HeritageClauses, parseHeritageClause);
+ return parseList(22 /* HeritageClauses */, parseHeritageClause);
}
return void 0;
}
@@ -30689,7 +31146,7 @@ var Parser;
const tok = token();
Debug.assert(tok === 94 /* ExtendsKeyword */ || tok === 117 /* ImplementsKeyword */);
nextToken();
- const types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
+ const types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(factory2.createHeritageClause(tok, types), pos);
}
function parseExpressionWithTypeArguments() {
@@ -30702,13 +31159,13 @@ var Parser;
return finishNode(factory2.createExpressionWithTypeArguments(expression, typeArguments), pos);
}
function tryParseTypeArguments() {
- return token() === 29 /* LessThanToken */ ? parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
+ return token() === 29 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
}
function isHeritageClause2() {
return token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
}
function parseClassMembers() {
- return parseList(ParsingContext.ClassMembers, parseClassElement);
+ return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(pos, hasJSDoc, modifiers) {
parseExpected(118 /* InterfaceKeyword */);
@@ -30741,7 +31198,7 @@ var Parser;
const name = parseIdentifier();
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember));
+ members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(6 /* EnumMembers */, parseEnumMember));
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -30753,7 +31210,7 @@ var Parser;
const pos = getNodePos();
let statements;
if (parseExpected(18 /* OpenBraceToken */)) {
- statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
} else {
statements = createMissingList();
@@ -30878,7 +31335,7 @@ var Parser;
if (parseExpected(18 /* OpenBraceToken */)) {
const multiLine = scanner.hasPrecedingLineBreak();
const elements = parseDelimitedList(
- ParsingContext.AssertEntries,
+ 24 /* AssertEntries */,
parseAssertEntry,
/*considerSemicolonAsDelimiter*/
true
@@ -30962,7 +31419,7 @@ var Parser;
}
function parseNamedImportsOrExports(kind) {
const pos = getNodePos();
- const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
+ const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
return finishNode(node, pos);
}
function parseExportSpecifier() {
@@ -31138,7 +31595,7 @@ var Parser;
/*isDeclarationFile*/
false,
[],
- factory2.createToken(1 /* EndOfFileToken */),
+ factoryCreateToken(1 /* EndOfFileToken */),
0 /* None */,
noop
);
@@ -31799,7 +32256,7 @@ var Parser;
let node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
const name = parseJSDocIdentifierName();
- node = finishNode(factory2.createPropertyAccessExpression(node, name), pos);
+ node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
}
return node;
}
@@ -32090,7 +32547,7 @@ var Parser;
const end2 = scanner.getTextPos();
const originalKeywordKind = token();
const text = internIdentifier(scanner.getTokenValue());
- const result = finishNode(factory2.createIdentifier(text, originalKeywordKind), pos, end2);
+ const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
nextTokenJSDoc();
return result;
}
@@ -32412,7 +32869,7 @@ var IncrementalParser;
let currentArrayIndex = 0;
Debug.assert(currentArrayIndex < currentArray.length);
let current = currentArray[currentArrayIndex];
- let lastQueriedPosition = InvalidPosition.Value;
+ let lastQueriedPosition = -1 /* Value */;
return {
currentNode(position) {
if (position !== lastQueriedPosition) {
@@ -32431,7 +32888,7 @@ var IncrementalParser;
};
function findHighestListElementThatStartsAtPosition(position) {
currentArray = void 0;
- currentArrayIndex = InvalidPosition.Value;
+ currentArrayIndex = -1 /* Value */;
current = void 0;
forEachChild(sourceFile, visitNode3, visitArray2);
return;
@@ -33745,7 +34202,7 @@ var commandOptionsWithoutBuild = [
{
name: "allowArbitraryExtensions",
type: "boolean",
- affectsModuleResolution: true,
+ affectsProgramStructure: true,
category: Diagnostics.Modules,
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
defaultValueDescription: false
@@ -35931,6 +36388,22 @@ function resolvedTypeScriptOnly(resolved) {
Debug.assert(extensionIsTS(resolved.extension));
return { fileName: resolved.path, packageId: resolved.packageId };
}
+function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
+ if (originalPath)
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
+ }
+ return createResolvedModuleWithFailedLookupLocations(
+ resolved,
+ isExternalLibraryImport,
+ failedLookupLocations,
+ affectingLocations,
+ diagnostics,
+ state.resultFromCache,
+ legacyResult
+ );
+}
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
if (resultFromCache) {
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -36091,6 +36564,15 @@ function arePathsEqual(path1, path2, host) {
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
}
+function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ return {
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
+ originalPath: pathsAreEqual ? void 0 : fileName
+ };
+}
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
const traceEnabled = isTraceEnabled(options, host);
@@ -36135,9 +36617,9 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
const affectingLocations = [];
let features = getNodeResolutionFeatures(options);
if (resolutionMode === 99 /* ESNext */ && (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */)) {
- features |= NodeResolutionFeatures.EsmMode;
+ features |= 32 /* EsmMode */;
}
- const conditions = features & NodeResolutionFeatures.Exports ? getConditions(options, !!(features & NodeResolutionFeatures.EsmMode)) : [];
+ const conditions = features & 8 /* Exports */ ? getConditions(options, !!(features & 32 /* EsmMode */)) : [];
const diagnostics = [];
const moduleResolutionState = {
compilerOptions: options,
@@ -36162,13 +36644,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
let resolvedTypeReferenceDirective;
if (resolved) {
const { fileName, packageId } = resolved;
- const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ let resolvedFileName = fileName, originalPath;
+ if (!options.preserveSymlinks)
+ ({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
resolvedTypeReferenceDirective = {
primary,
- // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
- resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
- originalPath: pathsAreEqual ? void 0 : fileName,
+ resolvedFileName,
+ originalPath,
packageId,
isExternalLibraryImport: pathContainsNodeModules(fileName)
};
@@ -36270,35 +36752,38 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
}
}
function getNodeResolutionFeatures(options) {
- let features = NodeResolutionFeatures.None;
+ let features = 0 /* None */;
switch (getEmitModuleResolutionKind(options)) {
case 3 /* Node16 */:
- features = NodeResolutionFeatures.Node16Default;
+ features = 30 /* Node16Default */;
break;
case 99 /* NodeNext */:
- features = NodeResolutionFeatures.NodeNextDefault;
+ features = 30 /* NodeNextDefault */;
break;
case 100 /* Bundler */:
- features = NodeResolutionFeatures.BundlerDefault;
+ features = 30 /* BundlerDefault */;
break;
}
if (options.resolvePackageJsonExports) {
- features |= NodeResolutionFeatures.Exports;
+ features |= 8 /* Exports */;
} else if (options.resolvePackageJsonExports === false) {
- features &= ~NodeResolutionFeatures.Exports;
+ features &= ~8 /* Exports */;
}
if (options.resolvePackageJsonImports) {
- features |= NodeResolutionFeatures.Imports;
+ features |= 2 /* Imports */;
} else if (options.resolvePackageJsonImports === false) {
- features &= ~NodeResolutionFeatures.Imports;
+ features &= ~2 /* Imports */;
}
return features;
}
function getConditions(options, esmMode) {
- const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["node", "import"] : ["node", "require"];
+ const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
if (!options.noDtsResolution) {
conditions.push("types");
}
+ if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
+ conditions.push("node");
+ }
return concatenate(conditions, options.customConditions);
}
function getAutomaticTypeDirectiveNames(options, host) {
@@ -36858,19 +37343,6 @@ function resolveJSModule(moduleName, initialDir, host) {
}
return resolvedModule.resolvedFileName;
}
-var NodeResolutionFeatures = /* @__PURE__ */ ((NodeResolutionFeatures2) => {
- NodeResolutionFeatures2[NodeResolutionFeatures2["None"] = 0] = "None";
- NodeResolutionFeatures2[NodeResolutionFeatures2["Imports"] = 2] = "Imports";
- NodeResolutionFeatures2[NodeResolutionFeatures2["SelfName"] = 4] = "SelfName";
- NodeResolutionFeatures2[NodeResolutionFeatures2["Exports"] = 8] = "Exports";
- NodeResolutionFeatures2[NodeResolutionFeatures2["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
- NodeResolutionFeatures2[NodeResolutionFeatures2["AllFeatures"] = 30] = "AllFeatures";
- NodeResolutionFeatures2[NodeResolutionFeatures2["Node16Default"] = 30] = "Node16Default";
- NodeResolutionFeatures2[NodeResolutionFeatures2["NodeNextDefault"] = 30 /* AllFeatures */] = "NodeNextDefault";
- NodeResolutionFeatures2[NodeResolutionFeatures2["BundlerDefault"] = 30] = "BundlerDefault";
- NodeResolutionFeatures2[NodeResolutionFeatures2["EsmMode"] = 32] = "EsmMode";
- return NodeResolutionFeatures2;
-})(NodeResolutionFeatures || {});
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
return nodeNextModuleNameResolverWorker(
30 /* Node16Default */,
@@ -37000,7 +37472,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
isConfigLookup,
candidateIsFromPackageJsonField: false
};
- if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
+ if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
}
let result;
@@ -37026,13 +37498,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
legacyResult = diagnosticResult.value.resolved.path;
}
}
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache,
+ state,
legacyResult
);
function tryResolve(extensions2, state2) {
@@ -37062,16 +37535,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
}
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
}
- if (!resolved2)
- return void 0;
- let resolvedValue = resolved2.value;
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
- const path = realPath(resolvedValue.path, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
- }
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
} else {
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
const resolved2 = nodeLoadModuleByRelativeName(
@@ -37254,7 +37718,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
if (!onlyRecordFailures) {
if (state.host.fileExists(fileName)) {
if (state.traceEnabled) {
- trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
+ trace(state.host, Diagnostics.File_0_exists_use_it_as_a_name_resolution_result, fileName);
}
return fileName;
} else {
@@ -37748,18 +38212,24 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
)));
} else if (typeof target === "object" && target !== null) {
if (!Array.isArray(target)) {
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
for (const condition of getOwnKeys(target)) {
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
const subTarget = target[condition];
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
if (result) {
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return result;
+ } else {
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
}
} else {
traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
}
}
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return void 0;
} else {
if (!length(target)) {
@@ -38126,13 +38596,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
candidateIsFromPackageJsonField: false
};
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
resolved && resolved.value,
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache
+ state
);
function tryResolve(extensions) {
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -38366,35 +38837,36 @@ function bindSourceFile(file, options) {
measure("Bind", "beforeBind", "afterBind");
}
function createBinder() {
- let file;
- let options;
- let languageVersion;
- let parent;
- let container;
- let thisParentContainer;
- let blockScopeContainer;
- let lastContainer;
- let delayedTypeAliases;
- let seenThisKeyword;
- let currentFlow;
- let currentBreakTarget;
- let currentContinueTarget;
- let currentReturnTarget;
- let currentTrueTarget;
- let currentFalseTarget;
- let currentExceptionTarget;
- let preSwitchCaseFlow;
- let activeLabelList;
- let hasExplicitReturn;
- let emitFlags;
- let inStrictMode;
- let inAssignmentPattern = false;
- let symbolCount = 0;
- let Symbol12;
- let classifiableNames;
- const unreachableFlow = { flags: 1 /* Unreachable */ };
- const reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
- const bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ var file;
+ var options;
+ var languageVersion;
+ var parent;
+ var container;
+ var thisParentContainer;
+ var blockScopeContainer;
+ var lastContainer;
+ var delayedTypeAliases;
+ var seenThisKeyword;
+ var currentFlow;
+ var currentBreakTarget;
+ var currentContinueTarget;
+ var currentReturnTarget;
+ var currentTrueTarget;
+ var currentFalseTarget;
+ var currentExceptionTarget;
+ var preSwitchCaseFlow;
+ var activeLabelList;
+ var hasExplicitReturn;
+ var emitFlags;
+ var inStrictMode;
+ var inAssignmentPattern = false;
+ var symbolCount = 0;
+ var Symbol12;
+ var classifiableNames;
+ var unreachableFlow = { flags: 1 /* Unreachable */ };
+ var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
+ var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ return bindSourceFile2;
function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
}
@@ -38445,7 +38917,6 @@ function createBinder() {
inAssignmentPattern = false;
emitFlags = 0 /* None */;
}
- return bindSourceFile2;
function bindInStrictMode(file2, opts) {
if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) {
return true;
@@ -41388,7 +41859,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
let redirectPathsSpecifiers;
let relativeSpecifiers;
for (const modulePath of modulePaths) {
- const specifier = tryGetModuleNameAsNodeModule(
+ const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
modulePath,
info,
importingSourceFile,
@@ -41398,7 +41869,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
/*packageNameOnly*/
void 0,
options.overrideImportMode
- );
+ ) : void 0;
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
if (specifier && modulePath.isRedirect) {
return nodeModulesSpecifiers;
@@ -41810,9 +42281,11 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
- if (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */) {
- const conditions = ["node", importMode === 99 /* ESNext */ ? "import" : "require", "types"];
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
+ if (getResolvePackageJsonExports(options)) {
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
+ const conditions = getConditions(options, importMode === 99 /* ESNext */);
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
if (fromExports) {
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
return { ...withJsExtension, verbatimFromExports: true };
@@ -42069,6 +42542,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
return SignatureCheckMode3;
})(SignatureCheckMode || {});
@@ -42103,8 +42577,8 @@ function isInstantiatedModule(node, preserveConstEnums) {
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
}
function createTypeChecker(host) {
- const getPackagesMap = memoize(() => {
- const map2 = /* @__PURE__ */ new Map();
+ var getPackagesMap = memoize(() => {
+ var map2 = /* @__PURE__ */ new Map();
host.getSourceFiles().forEach((sf) => {
if (!sf.resolvedModules)
return;
@@ -42115,57 +42589,58 @@ function createTypeChecker(host) {
});
return map2;
});
- let deferredDiagnosticsCallbacks = [];
- let addLazyDiagnostic = (arg) => {
+ var deferredDiagnosticsCallbacks = [];
+ var addLazyDiagnostic = (arg) => {
deferredDiagnosticsCallbacks.push(arg);
};
- let cancellationToken;
- const requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
- let requestedExternalEmitHelpers;
- let externalHelpersModule;
- const Symbol12 = objectAllocator.getSymbolConstructor();
- const Type7 = objectAllocator.getTypeConstructor();
- const Signature5 = objectAllocator.getSignatureConstructor();
- let typeCount = 0;
- let symbolCount = 0;
- let totalInstantiationCount = 0;
- let instantiationCount = 0;
- let instantiationDepth = 0;
- let inlineLevel = 0;
- let currentNode;
- let varianceTypeParameter;
- const emptySymbols = createSymbolTable();
- const arrayVariances = [1 /* Covariant */];
- const compilerOptions = host.getCompilerOptions();
- const languageVersion = getEmitScriptTarget(compilerOptions);
- const moduleKind = getEmitModuleKind(compilerOptions);
- const legacyDecorators = !!compilerOptions.experimentalDecorators;
- const useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
- const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
- const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
- const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
- const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
- const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
- const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
- const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
- const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
- const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
- const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
- const exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
- const checkBinaryExpression = createCheckBinaryExpression();
- const emitResolver = createResolver();
- const nodeBuilder = createNodeBuilder();
- const globals = createSymbolTable();
- const undefinedSymbol = createSymbol(4 /* Property */, "undefined");
+ var cancellationToken;
+ var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
+ var requestedExternalEmitHelpers;
+ var externalHelpersModule;
+ var Symbol12 = objectAllocator.getSymbolConstructor();
+ var Type7 = objectAllocator.getTypeConstructor();
+ var Signature5 = objectAllocator.getSignatureConstructor();
+ var typeCount = 0;
+ var symbolCount = 0;
+ var totalInstantiationCount = 0;
+ var instantiationCount = 0;
+ var instantiationDepth = 0;
+ var inlineLevel = 0;
+ var currentNode;
+ var varianceTypeParameter;
+ var isInferencePartiallyBlocked = false;
+ var emptySymbols = createSymbolTable();
+ var arrayVariances = [1 /* Covariant */];
+ var compilerOptions = host.getCompilerOptions();
+ var languageVersion = getEmitScriptTarget(compilerOptions);
+ var moduleKind = getEmitModuleKind(compilerOptions);
+ var legacyDecorators = !!compilerOptions.experimentalDecorators;
+ var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
+ var allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
+ var strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
+ var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
+ var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
+ var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
+ var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
+ var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
+ var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
+ var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
+ var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
+ var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
+ var checkBinaryExpression = createCheckBinaryExpression();
+ var emitResolver = createResolver();
+ var nodeBuilder = createNodeBuilder();
+ var globals = createSymbolTable();
+ var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
undefinedSymbol.declarations = [];
- const globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
+ var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
globalThisSymbol.declarations = [];
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
- const argumentsSymbol = createSymbol(4 /* Property */, "arguments");
- const requireSymbol = createSymbol(4 /* Property */, "require");
- const isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
- let apparentArgumentCount;
+ var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
+ var requireSymbol = createSymbol(4 /* Property */, "require");
+ var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
+ var apparentArgumentCount;
const checker = {
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -42343,15 +42818,14 @@ function createTypeChecker(host) {
getTypeOfPropertyOfContextualType,
getFullyQualifiedName,
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
call,
candidatesOutArray,
/*argumentCount*/
void 0,
- 32 /* IsForStringLiteralArgumentCompletions */,
- editingArgument
- ),
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
+ 32 /* IsForStringLiteralArgumentCompletions */
+ )),
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
getExpandedParameters,
hasEffectiveRestParameter,
containsArgumentsReference,
@@ -42456,6 +42930,7 @@ function createTypeChecker(host) {
isArrayType,
isTupleType,
isArrayLikeType,
+ isEmptyAnonymousObjectType,
isTypeInvalidDueToUnionDiscriminant,
getExactOptionalProperties,
getAllPossiblePropertiesOfTypes,
@@ -42542,81 +43017,93 @@ function createTypeChecker(host) {
isPropertyAccessible,
getTypeOnlyAliasDeclaration,
getMemberOverrideModifierStatus,
- isTypeParameterPossiblyReferenced
+ isTypeParameterPossiblyReferenced,
+ typeHasCallOrConstructSignatures
};
- function runWithInferenceBlockedFromSourceNode(node, fn) {
+ function runWithoutResolvedSignatureCaching(node, fn) {
const containingCall = findAncestor(node, isCallLikeExpression);
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = void 0;
+ }
+ const result = fn();
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
+ }
+ return result;
+ }
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
+ const containingCall = findAncestor(node, isCallLikeExpression);
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = true;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = void 0;
}
- const result = fn();
+ isInferencePartiallyBlocked = true;
+ const result = runWithoutResolvedSignatureCaching(node, fn);
+ isInferencePartiallyBlocked = false;
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
}
return result;
}
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
apparentArgumentCount = argumentCount;
- const res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignature(node, candidatesOutArray, checkMode)) : getResolvedSignature(node, candidatesOutArray, checkMode);
+ const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
apparentArgumentCount = void 0;
return res;
}
- const tupleTypes = /* @__PURE__ */ new Map();
- const unionTypes = /* @__PURE__ */ new Map();
- const intersectionTypes = /* @__PURE__ */ new Map();
- const stringLiteralTypes = /* @__PURE__ */ new Map();
- const numberLiteralTypes = /* @__PURE__ */ new Map();
- const bigIntLiteralTypes = /* @__PURE__ */ new Map();
- const enumLiteralTypes = /* @__PURE__ */ new Map();
- const indexedAccessTypes = /* @__PURE__ */ new Map();
- const templateLiteralTypes = /* @__PURE__ */ new Map();
- const stringMappingTypes = /* @__PURE__ */ new Map();
- const substitutionTypes = /* @__PURE__ */ new Map();
- const subtypeReductionCache = /* @__PURE__ */ new Map();
- const decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
- const cachedTypes = /* @__PURE__ */ new Map();
- const evolvingArrayTypes = [];
- const undefinedProperties = /* @__PURE__ */ new Map();
- const markerTypes = /* @__PURE__ */ new Set();
- const unknownSymbol = createSymbol(4 /* Property */, "unknown");
- const resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
- const unresolvedSymbols = /* @__PURE__ */ new Map();
- const errorTypes = /* @__PURE__ */ new Map();
- const anyType = createIntrinsicType(1 /* Any */, "any");
- const autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
- const wildcardType = createIntrinsicType(1 /* Any */, "any");
- const errorType = createIntrinsicType(1 /* Any */, "error");
- const unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
- const nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
- const intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
- const unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
- const missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
- const optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const nullType = createIntrinsicType(65536 /* Null */, "null");
- const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
- const stringType = createIntrinsicType(4 /* String */, "string");
- const numberType = createIntrinsicType(8 /* Number */, "number");
- const bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
- const falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
- const regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var tupleTypes = /* @__PURE__ */ new Map();
+ var unionTypes = /* @__PURE__ */ new Map();
+ var intersectionTypes = /* @__PURE__ */ new Map();
+ var stringLiteralTypes = /* @__PURE__ */ new Map();
+ var numberLiteralTypes = /* @__PURE__ */ new Map();
+ var bigIntLiteralTypes = /* @__PURE__ */ new Map();
+ var enumLiteralTypes = /* @__PURE__ */ new Map();
+ var indexedAccessTypes = /* @__PURE__ */ new Map();
+ var templateLiteralTypes = /* @__PURE__ */ new Map();
+ var stringMappingTypes = /* @__PURE__ */ new Map();
+ var substitutionTypes = /* @__PURE__ */ new Map();
+ var subtypeReductionCache = /* @__PURE__ */ new Map();
+ var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
+ var cachedTypes = /* @__PURE__ */ new Map();
+ var evolvingArrayTypes = [];
+ var undefinedProperties = /* @__PURE__ */ new Map();
+ var markerTypes = /* @__PURE__ */ new Set();
+ var unknownSymbol = createSymbol(4 /* Property */, "unknown");
+ var resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
+ var unresolvedSymbols = /* @__PURE__ */ new Map();
+ var errorTypes = /* @__PURE__ */ new Map();
+ var anyType = createIntrinsicType(1 /* Any */, "any");
+ var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
+ var wildcardType = createIntrinsicType(1 /* Any */, "any");
+ var errorType = createIntrinsicType(1 /* Any */, "error");
+ var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
+ var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
+ var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
+ var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
+ var missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
+ var optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var nullType = createIntrinsicType(65536 /* Null */, "null");
+ var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
+ var stringType = createIntrinsicType(4 /* String */, "string");
+ var numberType = createIntrinsicType(8 /* Number */, "number");
+ var bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
+ var falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
trueType.regularType = regularTrueType;
trueType.freshType = trueType;
regularTrueType.regularType = regularTrueType;
@@ -42625,26 +43112,26 @@ function createTypeChecker(host) {
falseType.freshType = falseType;
regularFalseType.regularType = regularFalseType;
regularFalseType.freshType = falseType;
- const booleanType = getUnionType([regularFalseType, regularTrueType]);
- const esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
- const voidType = createIntrinsicType(16384 /* Void */, "void");
- const neverType = createIntrinsicType(131072 /* Never */, "never");
- const silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
- const implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
- const unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
- const nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
- const stringOrNumberType = getUnionType([stringType, numberType]);
- const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
- const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
- const numberOrBigIntType = getUnionType([numberType, bigintType]);
- const templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
- const numericStringType = getTemplateLiteralType(["", ""], [numberType]);
- const restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
- const permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
- const uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
- const uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
- let outofbandVarianceMarkerHandler;
- const reportUnreliableMapper = makeFunctionTypeMapper((t) => {
+ var booleanType = getUnionType([regularFalseType, regularTrueType]);
+ var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
+ var voidType = createIntrinsicType(16384 /* Void */, "void");
+ var neverType = createIntrinsicType(131072 /* Never */, "never");
+ var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
+ var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
+ var stringOrNumberType = getUnionType([stringType, numberType]);
+ var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
+ var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
+ var numberOrBigIntType = getUnionType([numberType, bigintType]);
+ var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
+ var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
+ var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
+ var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
+ var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
+ var outofbandVarianceMarkerHandler;
+ var reportUnreliableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -42653,7 +43140,7 @@ function createTypeChecker(host) {
}
return t;
}, () => "(unmeasurable reporter)");
- const reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
+ var reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -42662,30 +43149,30 @@ function createTypeChecker(host) {
}
return t;
}, () => "(unreliable reporter)");
- const emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
- const emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
+ var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
emptyTypeLiteralSymbol.members = createSymbolTable();
- const emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
- const emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
+ var emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyGenericType.instantiations = /* @__PURE__ */ new Map();
- const anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
anyFunctionType.objectFlags |= 262144 /* NonInferrableType */;
- const noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const markerSuperType = createTypeParameter();
- const markerSubType = createTypeParameter();
+ var noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var markerSuperType = createTypeParameter();
+ var markerSubType = createTypeParameter();
markerSubType.constraint = markerSuperType;
- const markerOtherType = createTypeParameter();
- const markerSuperTypeForCheck = createTypeParameter();
- const markerSubTypeForCheck = createTypeParameter();
+ var markerOtherType = createTypeParameter();
+ var markerSuperTypeForCheck = createTypeParameter();
+ var markerSubTypeForCheck = createTypeParameter();
markerSubTypeForCheck.constraint = markerSuperTypeForCheck;
- const noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
- const anySignature = createSignature(
+ var noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
+ var anySignature = createSignature(
void 0,
void 0,
void 0,
@@ -42696,7 +43183,7 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const unknownSignature = createSignature(
+ var unknownSignature = createSignature(
void 0,
void 0,
void 0,
@@ -42707,7 +43194,7 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const resolvingSignature = createSignature(
+ var resolvingSignature = createSignature(
void 0,
void 0,
void 0,
@@ -42718,7 +43205,7 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const silentNeverSignature = createSignature(
+ var silentNeverSignature = createSignature(
void 0,
void 0,
void 0,
@@ -42729,14 +43216,14 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const enumNumberIndexInfo = createIndexInfo(
+ var enumNumberIndexInfo = createIndexInfo(
numberType,
stringType,
/*isReadonly*/
true
);
- const iterationTypesCache = /* @__PURE__ */ new Map();
- const noIterationTypes = {
+ var iterationTypesCache = /* @__PURE__ */ new Map();
+ var noIterationTypes = {
get yieldType() {
return Debug.fail("Not supported");
},
@@ -42747,10 +43234,10 @@ function createTypeChecker(host) {
return Debug.fail("Not supported");
}
};
- const anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
- const anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
- const defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
- const asyncIterationTypesResolver = {
+ var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
+ var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
+ var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
+ var asyncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfAsyncIterable",
iteratorCacheKey: "iterationTypesOfAsyncIterator",
iteratorSymbolName: "asyncIterator",
@@ -42763,7 +43250,7 @@ function createTypeChecker(host) {
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
};
- const syncIterationTypesResolver = {
+ var syncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfIterable",
iteratorCacheKey: "iterationTypesOfIterator",
iteratorSymbolName: "iterator",
@@ -42776,117 +43263,118 @@ function createTypeChecker(host) {
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property
};
- let amalgamatedDuplicates;
- const reverseMappedCache = /* @__PURE__ */ new Map();
- let inInferTypeForHomomorphicMappedType = false;
- let ambientModulesCache;
- let patternAmbientModules;
- let patternAmbientModuleAugmentations;
- let globalObjectType;
- let globalFunctionType;
- let globalCallableFunctionType;
- let globalNewableFunctionType;
- let globalArrayType;
- let globalReadonlyArrayType;
- let globalStringType;
- let globalNumberType;
- let globalBooleanType;
- let globalRegExpType;
- let globalThisType;
- let anyArrayType;
- let autoArrayType;
- let anyReadonlyArrayType;
- let deferredGlobalNonNullableTypeAlias;
- let deferredGlobalESSymbolConstructorSymbol;
- let deferredGlobalESSymbolConstructorTypeSymbol;
- let deferredGlobalESSymbolType;
- let deferredGlobalTypedPropertyDescriptorType;
- let deferredGlobalPromiseType;
- let deferredGlobalPromiseLikeType;
- let deferredGlobalPromiseConstructorSymbol;
- let deferredGlobalPromiseConstructorLikeType;
- let deferredGlobalIterableType;
- let deferredGlobalIteratorType;
- let deferredGlobalIterableIteratorType;
- let deferredGlobalGeneratorType;
- let deferredGlobalIteratorYieldResultType;
- let deferredGlobalIteratorReturnResultType;
- let deferredGlobalAsyncIterableType;
- let deferredGlobalAsyncIteratorType;
- let deferredGlobalAsyncIterableIteratorType;
- let deferredGlobalAsyncGeneratorType;
- let deferredGlobalTemplateStringsArrayType;
- let deferredGlobalImportMetaType;
- let deferredGlobalImportMetaExpressionType;
- let deferredGlobalImportCallOptionsType;
- let deferredGlobalExtractSymbol;
- let deferredGlobalOmitSymbol;
- let deferredGlobalAwaitedSymbol;
- let deferredGlobalBigIntType;
- let deferredGlobalNaNSymbol;
- let deferredGlobalRecordSymbol;
- let deferredGlobalClassDecoratorContextType;
- let deferredGlobalClassMethodDecoratorContextType;
- let deferredGlobalClassGetterDecoratorContextType;
- let deferredGlobalClassSetterDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorTargetType;
- let deferredGlobalClassAccessorDecoratorResultType;
- let deferredGlobalClassFieldDecoratorContextType;
- const allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
- let flowLoopStart = 0;
- let flowLoopCount = 0;
- let sharedFlowCount = 0;
- let flowAnalysisDisabled = false;
- let flowInvocationCount = 0;
- let lastFlowNode;
- let lastFlowNodeReachable;
- let flowTypeCache;
- const contextualTypeNodes = [];
- const contextualTypes = [];
- let contextualTypeCount = 0;
- const inferenceContextNodes = [];
- const inferenceContexts = [];
- let inferenceContextCount = 0;
- const emptyStringType = getStringLiteralType("");
- const zeroType = getNumberLiteralType(0);
- const zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
- const resolutionTargets = [];
- const resolutionResults = [];
- const resolutionPropertyNames = [];
- let suggestionCount = 0;
- const maximumSuggestionCount = 10;
- const mergedSymbols = [];
- const symbolLinks = [];
- const nodeLinks = [];
- const flowLoopCaches = [];
- const flowLoopNodes = [];
- const flowLoopKeys = [];
- const flowLoopTypes = [];
- const sharedFlowNodes = [];
- const sharedFlowTypes = [];
- const flowNodeReachable = [];
- const flowNodePostSuper = [];
- const potentialThisCollisions = [];
- const potentialNewTargetCollisions = [];
- const potentialWeakMapSetCollisions = [];
- const potentialReflectCollisions = [];
- const potentialUnusedRenamedBindingElementsInTypes = [];
- const awaitedTypeStack = [];
- const diagnostics = createDiagnosticCollection();
- const suggestionDiagnostics = createDiagnosticCollection();
- const typeofType = createTypeofType();
- let _jsxNamespace;
- let _jsxFactoryEntity;
- const subtypeRelation = /* @__PURE__ */ new Map();
- const strictSubtypeRelation = /* @__PURE__ */ new Map();
- const assignableRelation = /* @__PURE__ */ new Map();
- const comparableRelation = /* @__PURE__ */ new Map();
- const identityRelation = /* @__PURE__ */ new Map();
- const enumRelation = /* @__PURE__ */ new Map();
- const builtinGlobals = createSymbolTable();
+ var amalgamatedDuplicates;
+ var reverseMappedCache = /* @__PURE__ */ new Map();
+ var inInferTypeForHomomorphicMappedType = false;
+ var ambientModulesCache;
+ var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
+ var globalObjectType;
+ var globalFunctionType;
+ var globalCallableFunctionType;
+ var globalNewableFunctionType;
+ var globalArrayType;
+ var globalReadonlyArrayType;
+ var globalStringType;
+ var globalNumberType;
+ var globalBooleanType;
+ var globalRegExpType;
+ var globalThisType;
+ var anyArrayType;
+ var autoArrayType;
+ var anyReadonlyArrayType;
+ var deferredGlobalNonNullableTypeAlias;
+ var deferredGlobalESSymbolConstructorSymbol;
+ var deferredGlobalESSymbolConstructorTypeSymbol;
+ var deferredGlobalESSymbolType;
+ var deferredGlobalTypedPropertyDescriptorType;
+ var deferredGlobalPromiseType;
+ var deferredGlobalPromiseLikeType;
+ var deferredGlobalPromiseConstructorSymbol;
+ var deferredGlobalPromiseConstructorLikeType;
+ var deferredGlobalIterableType;
+ var deferredGlobalIteratorType;
+ var deferredGlobalIterableIteratorType;
+ var deferredGlobalGeneratorType;
+ var deferredGlobalIteratorYieldResultType;
+ var deferredGlobalIteratorReturnResultType;
+ var deferredGlobalAsyncIterableType;
+ var deferredGlobalAsyncIteratorType;
+ var deferredGlobalAsyncIterableIteratorType;
+ var deferredGlobalAsyncGeneratorType;
+ var deferredGlobalTemplateStringsArrayType;
+ var deferredGlobalImportMetaType;
+ var deferredGlobalImportMetaExpressionType;
+ var deferredGlobalImportCallOptionsType;
+ var deferredGlobalExtractSymbol;
+ var deferredGlobalOmitSymbol;
+ var deferredGlobalAwaitedSymbol;
+ var deferredGlobalBigIntType;
+ var deferredGlobalNaNSymbol;
+ var deferredGlobalRecordSymbol;
+ var deferredGlobalClassDecoratorContextType;
+ var deferredGlobalClassMethodDecoratorContextType;
+ var deferredGlobalClassGetterDecoratorContextType;
+ var deferredGlobalClassSetterDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorTargetType;
+ var deferredGlobalClassAccessorDecoratorResultType;
+ var deferredGlobalClassFieldDecoratorContextType;
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
+ var flowLoopStart = 0;
+ var flowLoopCount = 0;
+ var sharedFlowCount = 0;
+ var flowAnalysisDisabled = false;
+ var flowInvocationCount = 0;
+ var lastFlowNode;
+ var lastFlowNodeReachable;
+ var flowTypeCache;
+ var contextualTypeNodes = [];
+ var contextualTypes = [];
+ var contextualIsCache = [];
+ var contextualTypeCount = 0;
+ var inferenceContextNodes = [];
+ var inferenceContexts = [];
+ var inferenceContextCount = 0;
+ var emptyStringType = getStringLiteralType("");
+ var zeroType = getNumberLiteralType(0);
+ var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
+ var resolutionTargets = [];
+ var resolutionResults = [];
+ var resolutionPropertyNames = [];
+ var suggestionCount = 0;
+ var maximumSuggestionCount = 10;
+ var mergedSymbols = [];
+ var symbolLinks = [];
+ var nodeLinks = [];
+ var flowLoopCaches = [];
+ var flowLoopNodes = [];
+ var flowLoopKeys = [];
+ var flowLoopTypes = [];
+ var sharedFlowNodes = [];
+ var sharedFlowTypes = [];
+ var flowNodeReachable = [];
+ var flowNodePostSuper = [];
+ var potentialThisCollisions = [];
+ var potentialNewTargetCollisions = [];
+ var potentialWeakMapSetCollisions = [];
+ var potentialReflectCollisions = [];
+ var potentialUnusedRenamedBindingElementsInTypes = [];
+ var awaitedTypeStack = [];
+ var diagnostics = createDiagnosticCollection();
+ var suggestionDiagnostics = createDiagnosticCollection();
+ var typeofType = createTypeofType();
+ var _jsxNamespace;
+ var _jsxFactoryEntity;
+ var subtypeRelation = /* @__PURE__ */ new Map();
+ var strictSubtypeRelation = /* @__PURE__ */ new Map();
+ var assignableRelation = /* @__PURE__ */ new Map();
+ var comparableRelation = /* @__PURE__ */ new Map();
+ var identityRelation = /* @__PURE__ */ new Map();
+ var enumRelation = /* @__PURE__ */ new Map();
+ var builtinGlobals = createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- const suggestedExtensions = [
+ var suggestedExtensions = [
[".mts", ".mjs"],
[".ts", ".js"],
[".cts", ".cjs"],
@@ -44278,7 +44766,12 @@ function createTypeChecker(host) {
}
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
- const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
+ const exportSymbol = exportValue ? getPropertyOfType(
+ getTypeOfSymbol(exportValue),
+ name,
+ /*skipObjectFunctionPropertyAugment*/
+ true
+ ) : moduleSymbol.exports.get(name);
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
markSymbolOfAliasDeclarationIfTypeOnly(
sourceNode,
@@ -45313,12 +45806,9 @@ function createTypeChecker(host) {
if (resolutionDiagnostic) {
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
} else {
- const tsExtension = tryExtractTSExtension(moduleReference);
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
- if (tsExtension) {
- errorOnTSExtensionImport(tsExtension);
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -45338,14 +45828,12 @@ function createTypeChecker(host) {
}
}
return void 0;
- function errorOnTSExtensionImport(tsExtension) {
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
- }
function getSuggestedImportSource(tsExtension) {
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
- return importSourceWithoutExtension + (tsExtension === ".mts" /* Mts */ ? ".mjs" : tsExtension === ".cts" /* Cts */ ? ".cjs" : ".js");
+ const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
+ const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
+ return importSourceWithoutExtension + ext;
}
return importSourceWithoutExtension;
}
@@ -45532,7 +46020,7 @@ function createTypeChecker(host) {
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
}
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
- return !(resolvedExternalModuleType.flags & 131068 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
+ return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
}
function getExportsOfSymbol(symbol) {
@@ -46831,7 +47319,7 @@ function createTypeChecker(host) {
return result;
}
function createAnonymousTypeNode(type2) {
- var _a3;
+ var _a3, _b2;
const typeId = type2.id;
const symbol = type2.symbol;
if (symbol) {
@@ -46857,6 +47345,20 @@ function createTypeChecker(host) {
return visitAndTransformType(type2, createTypeNodeFromObjectType);
}
} else {
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
+ if (isInstantiationExpressionType) {
+ const instantiationExpressionType = type2;
+ if (isTypeQueryNode(instantiationExpressionType.node)) {
+ const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
+ if (typeNode) {
+ return typeNode;
+ }
+ }
+ if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
+ return createElidedInformationPlaceholder(context);
+ }
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
+ }
return createTypeNodeFromObjectType(type2);
}
function shouldWriteTypeOfFunctionSymbol() {
@@ -47365,7 +47867,7 @@ function createTypeChecker(host) {
);
}
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
- var _a2, _b, _c, _d;
+ var _a2, _b, _c, _d, _e;
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
if (suppressAny)
context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -47382,6 +47884,39 @@ function createTypeChecker(host) {
/*skipUnionExpanding*/
true
)[0];
+ let cleanup;
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
+ const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
+ let newLocals;
+ for (const param of expandedParams) {
+ if (!locals.has(param.escapedName)) {
+ newLocals = append(newLocals, param.escapedName);
+ locals.set(param.escapedName, param);
+ }
+ }
+ if (newLocals) {
+ let removeNewLocals2 = function() {
+ forEach(newLocals, (s) => locals.delete(s));
+ };
+ var removeNewLocals = removeNewLocals2;
+ if (existingFakeScope) {
+ cleanup = removeNewLocals2;
+ } else {
+ const fakeScope = parseNodeFactory.createBlock(emptyArray);
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
+ fakeScope.locals = locals;
+ const saveEnclosingDeclaration = context.enclosingDeclaration;
+ setParent(fakeScope, saveEnclosingDeclaration);
+ context.enclosingDeclaration = fakeScope;
+ cleanup = () => {
+ context.enclosingDeclaration = saveEnclosingDeclaration;
+ removeNewLocals2();
+ };
+ }
+ }
+ }
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
if (thisParameter) {
@@ -47407,11 +47942,11 @@ function createTypeChecker(host) {
const flags = modifiersToFlags(modifiers);
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
}
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
modifiers,
/*asteriskToken*/
void 0,
- (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
/*questionToken*/
void 0,
typeParameters,
@@ -47426,14 +47961,14 @@ function createTypeChecker(host) {
void 0
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
modifiers,
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
parameters,
returnTypeNode,
/*body*/
void 0
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
modifiers,
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
+ (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
parameters,
/*body*/
void 0
@@ -47468,13 +48003,14 @@ function createTypeChecker(host) {
if (typeArguments) {
node.typeArguments = factory.createNodeArray(typeArguments);
}
+ cleanup == null ? void 0 : cleanup();
return node;
}
function tryGetThisParameterDeclaration(signature, context) {
if (signature.thisParameter) {
return symbolToParameterDeclaration(signature.thisParameter, context);
}
- if (signature.declaration) {
+ if (signature.declaration && isInJSFile(signature.declaration)) {
const thisTag = getJSDocThisTag(signature.declaration);
if (thisTag && thisTag.typeExpression) {
return factory.createParameterDeclaration(
@@ -48082,9 +48618,12 @@ function createTypeChecker(host) {
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
}
+ function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
+ }
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
if (!isErrorType(type) && enclosingDeclaration) {
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -48116,7 +48655,8 @@ function createTypeChecker(host) {
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
if (!isErrorType(type) && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
- if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
+ const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
+ if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
const annotated = getTypeFromTypeNode(annotation);
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -49731,8 +50271,8 @@ function createTypeChecker(host) {
const t = types[i];
flags |= t.flags;
if (!(t.flags & 98304 /* Nullable */)) {
- if (t.flags & (512 /* BooleanLiteral */ | 1024 /* EnumLiteral */)) {
- const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLiteralType(t);
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
if (baseType.flags & 1048576 /* Union */) {
const count = baseType.types.length;
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -49987,7 +50527,7 @@ function createTypeChecker(host) {
}
function findResolutionCycleStartIndex(target, propertyName) {
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
return -1;
}
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -49996,7 +50536,7 @@ function createTypeChecker(host) {
}
return -1;
}
- function hasType2(target, propertyName) {
+ function resolutionTargetHasProperty(target, propertyName) {
switch (propertyName) {
case 0 /* Type */:
return !!getSymbolLinks(target).type;
@@ -50016,6 +50556,8 @@ function createTypeChecker(host) {
return !!target.baseTypesResolved;
case 8 /* WriteType */:
return !!getSymbolLinks(target).writeType;
+ case 9 /* ParameterInitializerContainsUndefined */:
+ return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
}
return Debug.assertNever(propertyName);
}
@@ -50455,7 +50997,7 @@ function createTypeChecker(host) {
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
- const tag = getJSDocTypeTag(container);
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
if (tag && tag.typeExpression) {
return getTypeFromTypeNode(tag.typeExpression);
}
@@ -51607,8 +52149,8 @@ function createTypeChecker(host) {
}
return links.declaredType;
}
- function getBaseTypeOfEnumLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
+ function getBaseTypeOfEnumLikeType(type) {
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
}
function getDeclaredTypeOfEnum(symbol) {
const links = getSymbolLinks(symbol);
@@ -51621,7 +52163,7 @@ function createTypeChecker(host) {
if (hasBindableName(member)) {
const memberSymbol = getSymbolOfDeclaration(member);
const value = getEnumMemberValue(member);
- const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
+ const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
getSymbolLinks(memberSymbol).declaredType = memberType;
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
}
@@ -51635,7 +52177,7 @@ function createTypeChecker(host) {
symbol,
/*aliasTypeArguments*/
void 0
- ) : createTypeWithSymbol(32 /* Enum */, symbol);
+ ) : createComputedEnumType(symbol);
if (enumType.flags & 1048576 /* Union */) {
enumType.flags |= 1024 /* EnumLiteral */;
enumType.symbol = symbol;
@@ -51644,6 +52186,15 @@ function createTypeChecker(host) {
}
return links.declaredType;
}
+ function createComputedEnumType(symbol) {
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
+ regularType.regularType = regularType;
+ regularType.freshType = freshType;
+ freshType.regularType = regularType;
+ freshType.freshType = freshType;
+ return regularType;
+ }
function getDeclaredTypeOfEnumMember(symbol) {
const links = getSymbolLinks(symbol);
if (!links.declaredType) {
@@ -52592,6 +53143,7 @@ function createTypeChecker(host) {
const typeParameter = getTypeParameterFromMappedType(type);
const constraintType = getConstraintTypeFromMappedType(type);
const nameType = getNameTypeFromMappedType(type.target || type);
+ const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
const templateType = getTemplateTypeFromMappedType(type.target || type);
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
const templateModifiers = getMappedTypeModifiers(type);
@@ -52629,7 +53181,7 @@ function createTypeChecker(host) {
prop.links.keyType = keyType;
if (modifiersProp) {
prop.links.syntheticOrigin = modifiersProp;
- prop.declarations = nameType ? void 0 : modifiersProp.declarations;
+ prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
}
members.set(propName, prop);
}
@@ -53573,6 +54125,12 @@ function createTypeChecker(host) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
+ if (isInJSFile(declaration)) {
+ const thisTag = getJSDocThisTag(declaration);
+ if (thisTag && thisTag.typeExpression) {
+ thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
+ }
+ }
const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0;
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
@@ -53686,7 +54244,11 @@ function createTypeChecker(host) {
if (node.tags) {
for (const tag of node.tags) {
if (isJSDocOverloadTag(tag)) {
- result.push(getSignatureFromDeclaration(tag.typeExpression));
+ const jsDocSignature = tag.typeExpression;
+ if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
+ reportImplicitAny(jsDocSignature, anyType);
+ }
+ result.push(getSignatureFromDeclaration(jsDocSignature));
hasJSDocOverloads = true;
}
}
@@ -53795,6 +54357,12 @@ function createTypeChecker(host) {
if (declaration.kind === 173 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
+ if (isJSDocSignature(declaration)) {
+ const root = getJSDocRoot(declaration);
+ if (root && isConstructorDeclaration(root.parent)) {
+ return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
+ }
+ }
if (isJSDocConstructSignature(declaration)) {
return getTypeFromTypeNode(declaration.parameters[0].type);
}
@@ -53973,7 +54541,7 @@ function createTypeChecker(host) {
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
if (grandParent.kind === 180 /* TypeReference */ && !omitTypeReferences) {
const typeReference = grandParent;
- const typeParameters = getTypeParametersForTypeReference(typeReference);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReference);
if (typeParameters) {
const index = typeReference.typeArguments.indexOf(childTypeParameter);
if (index < typeParameters.length) {
@@ -54323,7 +54891,7 @@ function createTypeChecker(host) {
return links.resolvedJSDocType;
}
function getSubstitutionType(baseType, constraint) {
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
return baseType;
}
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -55266,7 +55834,7 @@ function createTypeChecker(host) {
}
}
function removeStringLiteralsMatchedByTemplateLiterals(types) {
- const templates = filter(types, isPatternLiteralType);
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
if (templates.length) {
let i = types.length;
while (i > 0) {
@@ -55316,7 +55884,7 @@ function createTypeChecker(host) {
orderedRemoveItemAt(typeSet, 1);
}
}
- if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
}
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
@@ -55385,7 +55953,7 @@ function createTypeChecker(host) {
function typePredicateKindsMatch(a, b) {
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
}
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
if (types.length === 0) {
return neverType;
}
@@ -55397,7 +55965,7 @@ function createTypeChecker(host) {
let type = unionTypes.get(id);
if (!type) {
type = createType(1048576 /* Union */);
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
types,
/*excludeKinds*/
98304 /* Nullable */
@@ -55447,7 +56015,7 @@ function createTypeChecker(host) {
type = undefinedType;
}
if (!typeSet.has(type.id.toString())) {
- if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
includes |= 67108864 /* NonPrimitive */;
}
typeSet.set(type.id.toString(), type);
@@ -55723,7 +56291,7 @@ function createTypeChecker(host) {
const typeVariable = getTypeParameterFromMappedType(mappedType);
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
function isDistributive(type) {
- return type.flags & (3 /* AnyOrUnknown */ | 131068 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
+ return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
}
}
function getLiteralTypeFromPropertyName(name) {
@@ -56010,7 +56578,7 @@ function createTypeChecker(host) {
}
}
const propType = getTypeOfSymbol(prop);
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
}
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
const index = +propName;
@@ -56376,7 +56944,7 @@ function createTypeChecker(host) {
}
function getActualTypeVariable(type) {
if (type.flags & 33554432 /* Substitution */) {
- return type.baseType;
+ return getActualTypeVariable(type.baseType);
}
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -56574,11 +57142,6 @@ function createTypeChecker(host) {
var _a2;
const links = getNodeLinks(node);
if (!links.resolvedType) {
- if (node.isTypeOf && node.typeArguments) {
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
- links.resolvedSymbol = unknownSymbol;
- return links.resolvedType = errorType;
- }
if (!isLiteralImportTypeNode(node)) {
error(node.argument, Diagnostics.String_literal_expected);
links.resolvedSymbol = unknownSymbol;
@@ -56639,15 +57202,8 @@ function createTypeChecker(host) {
const resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
if (meaning === 111551 /* Value */) {
- return getTypeOfSymbol(symbol);
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
} else {
- const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
- const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
- if (node.typeArguments && typeParameters) {
- addLazyDiagnostic(() => {
- checkTypeArgumentConstraints(node, typeParameters);
- });
- }
return getTypeReferenceType(node, resolvedSymbol);
}
}
@@ -56825,7 +57381,7 @@ function createTypeChecker(host) {
return type;
}
function getFreshTypeOfLiteralType(type) {
- if (type.flags & 2944 /* Literal */) {
+ if (type.flags & 2976 /* Freshable */) {
if (!type.freshType) {
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
freshType.freshType = freshType;
@@ -56836,10 +57392,10 @@ function createTypeChecker(host) {
return type;
}
function getRegularTypeOfLiteralType(type) {
- return type.flags & 2944 /* Literal */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
}
function isFreshLiteralType(type) {
- return !!(type.flags & 2944 /* Literal */) && type.freshType === type;
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
}
function getStringLiteralType(value) {
let type;
@@ -57518,13 +58074,13 @@ function createTypeChecker(host) {
return type;
}
function getUniqueLiteralFilledInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
}
function getPermissiveInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
}
function getRestrictiveInstantiation(type) {
- if (type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
+ if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
return type;
}
if (type.restrictiveInstantiation) {
@@ -57796,7 +58352,12 @@ function createTypeChecker(host) {
}
}
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
- pushContextualType(next, sourcePropType);
+ pushContextualType(
+ next,
+ sourcePropType,
+ /*isCache*/
+ false
+ );
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
popContextualType();
return result;
@@ -58099,12 +58660,17 @@ function createTypeChecker(host) {
}
}
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
}
- pushContextualType(node, target);
+ pushContextualType(
+ node,
+ target,
+ /*isCache*/
+ false
+ );
const tupleizedType = checkArrayLiteral(
node,
1 /* Contextual */,
@@ -58143,7 +58709,7 @@ function createTypeChecker(host) {
}
}
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
}
@@ -58166,16 +58732,24 @@ function createTypeChecker(host) {
void 0
) !== 0 /* False */;
}
- function isAnySignature(s) {
- return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s));
+ function isTopSignature(s) {
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
+ const paramType = getTypeOfParameter(s.parameters[0]);
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
+ }
+ return false;
}
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
if (source === target) {
return -1 /* True */;
}
- if (isAnySignature(target)) {
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
return -1 /* True */;
}
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
+ return 0 /* False */;
+ }
const targetCount = getParameterCount(target);
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
if (sourceHasMoreParameters) {
@@ -58393,7 +58967,9 @@ function createTypeChecker(host) {
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
const s = source.flags;
const t = target.flags;
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
+ return true;
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
return true;
if (t & 131072 /* Never */)
return false;
@@ -58520,7 +59096,6 @@ function createTypeChecker(host) {
let overrideNextErrorInfo = 0;
let lastSkippedInfo;
let incompatibleStack;
- let inPropertyCheck = false;
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
const result = isRelatedTo(
source,
@@ -58717,7 +59292,8 @@ function createTypeChecker(host) {
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
}
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
const constraint = getBaseConstraintOfType(target2);
let needsOriginalSource;
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -58790,7 +59366,7 @@ function createTypeChecker(host) {
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
}
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
- if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) {
+ if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
return -1 /* True */;
}
@@ -58854,7 +59430,7 @@ function createTypeChecker(host) {
return 0 /* False */;
}
}
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
if (reportErrors2) {
@@ -58916,7 +59492,7 @@ function createTypeChecker(host) {
maybeSuppress = !!errorInfo;
}
}
- if (source2.flags & 524288 /* Object */ && target2.flags & 131068 /* Primitive */) {
+ if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
@@ -59062,15 +59638,15 @@ function createTypeChecker(host) {
}
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
if (source2.flags & 1048576 /* Union */) {
- return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState);
+ return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
}
if (target2.flags & 1048576 /* Union */) {
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */) && !(target2.flags & 131068 /* Primitive */));
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
}
if (target2.flags & 2097152 /* Intersection */) {
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
}
- if (relation === comparableRelation && target2.flags & 131068 /* Primitive */) {
+ if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
if (constraints !== source2.types) {
source2 = getIntersectionType(constraints);
@@ -59478,14 +60054,15 @@ function createTypeChecker(host) {
);
}
}
- if (result2 && !inPropertyCheck && (target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */)))) {
- inPropertyCheck = true;
+ if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
result2 &= propertiesRelatedTo(
source2,
target2,
reportErrors2,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2 && isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
@@ -59498,7 +60075,17 @@ function createTypeChecker(host) {
0 /* None */
);
}
- inPropertyCheck = false;
+ } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
+ result2 &= propertiesRelatedTo(
+ source2,
+ target2,
+ reportErrors2,
+ /*excludedProperties*/
+ void 0,
+ /*optionalsOnly*/
+ true,
+ intersectionState
+ );
}
}
if (result2) {
@@ -59952,7 +60539,7 @@ function createTypeChecker(host) {
}
return 0 /* False */;
}
- const sourceIsPrimitive = !!(sourceFlags & 131068 /* Primitive */);
+ const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
if (relation !== identityRelation) {
source2 = getApparentType(source2);
sourceFlags = source2.flags;
@@ -59988,12 +60575,14 @@ function createTypeChecker(host) {
reportStructuralErrors,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
intersectionState
);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
if (result2) {
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
}
@@ -60122,6 +60711,8 @@ function createTypeChecker(host) {
/*reportErrors*/
false,
excludedProperties,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2) {
@@ -60130,7 +60721,8 @@ function createTypeChecker(host) {
type,
0 /* Call */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2) {
result2 &= signaturesRelatedTo(
@@ -60138,7 +60730,8 @@ function createTypeChecker(host) {
type,
1 /* Construct */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
result2 &= indexSignaturesRelatedTo(
@@ -60316,7 +60909,7 @@ function createTypeChecker(host) {
}
}
}
- function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
+ function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source2, target2, excludedProperties);
}
@@ -60452,7 +61045,7 @@ function createTypeChecker(host) {
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
for (const targetProp of excludeProperties(properties, excludedProperties)) {
const name = targetProp.escapedName;
- if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
+ if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
const sourceProp = getPropertyOfType(source2, name);
if (sourceProp && sourceProp !== targetProp) {
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
@@ -60488,7 +61081,7 @@ function createTypeChecker(host) {
}
return result2;
}
- function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
+ function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
var _a3, _b;
if (relation === identityRelation) {
return signaturesIdenticalTo(source2, target2, kind);
@@ -60525,6 +61118,7 @@ function createTypeChecker(host) {
/*erase*/
true,
reportErrors2,
+ intersectionState,
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
);
if (!related) {
@@ -60536,7 +61130,7 @@ function createTypeChecker(host) {
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
const sourceSignature = first(sourceSignatures);
const targetSignature = first(targetSignatures);
- result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
+ result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
const constructSignatureToString = (signature) => signatureToString(
signature,
@@ -60561,6 +61155,7 @@ function createTypeChecker(host) {
/*erase*/
true,
shouldElaborateErrors,
+ intersectionState,
incompatibleReporter(s, t)
);
if (related) {
@@ -60613,17 +61208,29 @@ function createTypeChecker(host) {
}
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
}
- function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
+ function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
return compareSignaturesRelated(
erase ? getErasedSignature(source2) : source2,
erase ? getErasedSignature(target2) : target2,
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
+ checkMode,
reportErrors2,
reportError,
incompatibleReporter,
- isRelatedToWorker,
+ isRelatedToWorker2,
reportUnreliableMapper
);
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
+ return isRelatedTo(
+ source3,
+ target3,
+ 3 /* Both */,
+ reportErrors3,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
+ }
}
function signaturesIdenticalTo(source2, target2, kind) {
const sourceSignatures = getSignaturesOfType(source2, kind);
@@ -60682,7 +61289,7 @@ function createTypeChecker(host) {
}
for (const info of getIndexInfosOfType(source2)) {
if (isApplicableIndexType(info.keyType, keyType)) {
- const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
+ const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
if (!related) {
return 0 /* False */;
}
@@ -60691,8 +61298,16 @@ function createTypeChecker(host) {
}
return result2;
}
- function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
- const related = isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */, reportErrors2);
+ function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
+ const related = isRelatedTo(
+ sourceInfo.type,
+ targetInfo.type,
+ 3 /* Both */,
+ reportErrors2,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
if (!related && reportErrors2) {
if (sourceInfo.keyType === targetInfo.keyType) {
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -60721,9 +61336,9 @@ function createTypeChecker(host) {
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
if (sourceInfo) {
- return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
+ return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
}
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
}
if (reportErrors2) {
@@ -61012,12 +61627,15 @@ function createTypeChecker(host) {
}
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
if (depth >= maxDepth) {
+ if (type.flags & 2097152 /* Intersection */) {
+ return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
+ }
const identity2 = getRecursionIdentity(type);
let count = 0;
let lastTypeId = 0;
for (let i = 0; i < depth; i++) {
const t = stack[i];
- if (getRecursionIdentity(t) === identity2) {
+ if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
if (t.id >= lastTypeId) {
count++;
if (count >= maxDepth) {
@@ -61250,15 +61868,25 @@ function createTypeChecker(host) {
return propType;
}
if (everyType(type, isTupleType)) {
- return mapType(type, (t) => getRestTypeOfTupleType(t) || undefinedType);
+ return mapType(type, (t) => {
+ const tupleType = t;
+ const restType = getRestTypeOfTupleType(tupleType);
+ if (!restType) {
+ return undefinedType;
+ }
+ if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) {
+ return getUnionType([restType, undefinedType]);
+ }
+ return restType;
+ });
}
return void 0;
}
function isNeitherUnitTypeNorNever(type) {
- return !(type.flags & (109440 /* Unit */ | 131072 /* Never */));
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
}
function isUnitType(type) {
- return !!(type.flags & 109440 /* Unit */);
+ return !!(type.flags & 109472 /* Unit */);
}
function isUnitLikeType(type) {
const t = getBaseConstraintOrType(type);
@@ -61271,15 +61899,18 @@ function createTypeChecker(host) {
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
}
function getBaseTypeOfLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
+ return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
}
function getBaseTypeOfLiteralTypeUnion(type) {
var _a2;
const key = `B${getTypeId(type)}`;
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
}
+ function getBaseTypeOfLiteralTypeForComparison(type) {
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
+ }
function getWidenedLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
+ return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
}
function getWidenedUniqueESSymbolType(type) {
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
@@ -61320,7 +61951,7 @@ function createTypeChecker(host) {
const restType = getRestTypeOfTupleType(type);
return restType && createArrayType(restType);
}
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
const length2 = getTypeReferenceArity(type) - endSkipCount;
if (index < length2) {
const typeArguments = getTypeArguments(type);
@@ -61329,7 +61960,7 @@ function createTypeChecker(host) {
const t = typeArguments[i];
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
}
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
return void 0;
}
@@ -61397,7 +62028,7 @@ function createTypeChecker(host) {
}
function isObjectTypeWithInferableIndex(type) {
const objectFlags = getObjectFlags(type);
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
}
function createSymbolWithType(source, type) {
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -61635,6 +62266,11 @@ function createTypeChecker(host) {
case 320 /* JSDocFunctionType */:
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
+ case 326 /* JSDocSignature */:
+ if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
+ error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
+ }
+ return;
case 259 /* FunctionDeclaration */:
case 171 /* MethodDeclaration */:
case 170 /* MethodSignature */:
@@ -61807,8 +62443,8 @@ function createTypeChecker(host) {
}
return false;
}
- function isTypeParameterAtTopLevel(type, typeParameter) {
- return !!(type === typeParameter || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, typeParameter)) || type.flags & 16777216 /* Conditional */ && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
+ function isTypeParameterAtTopLevel(type, tp, depth = 0) {
+ return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
}
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
const typePredicate = getTypePredicateOfSignature(signature);
@@ -61902,7 +62538,7 @@ function createTypeChecker(host) {
yield targetProp;
} else if (matchDiscriminantProperties) {
const targetType = getTypeOfSymbol(targetProp);
- if (targetType.flags & 109440 /* Unit */) {
+ if (targetType.flags & 109472 /* Unit */) {
const sourceType = getTypeOfSymbol(sourceProp);
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
yield targetProp;
@@ -61963,10 +62599,10 @@ function createTypeChecker(host) {
return getBigIntLiteralType(parseValidBigInt(text));
}
function isMemberOfStringMapping(source, target) {
- if (target.flags & (4 /* String */ | 1 /* Any */)) {
+ if (target.flags & 1 /* Any */) {
return true;
}
- if (target.flags & 134217728 /* TemplateLiteral */) {
+ if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
return isTypeAssignableTo(source, target);
}
if (target.flags & 268435456 /* StringMapping */) {
@@ -62661,7 +63297,7 @@ function createTypeChecker(host) {
}
function hasPrimitiveConstraint(type) {
const constraint = getConstraintOfTypeParameter(type);
- return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
}
function isObjectLiteralType(type) {
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
@@ -63143,7 +63779,7 @@ function createTypeChecker(host) {
return 83886079 /* UnknownFacts */;
}
function getIntersectionTypeFacts(type) {
- const ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
+ const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
let oredFacts = 0 /* None */;
let andedFacts = 134217727 /* All */;
for (const t of type.types) {
@@ -63342,7 +63978,7 @@ function createTypeChecker(host) {
}
return true;
}
- if (source.flags & 1024 /* EnumLiteral */ && getBaseTypeOfEnumLiteralType(source) === target) {
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
return true;
}
return containsType(target.types, source);
@@ -63380,7 +64016,7 @@ function createTypeChecker(host) {
}
return getUnionTypeFromSortedList(
filtered,
- type.objectFlags,
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
/*aliasSymbol*/
void 0,
/*aliasTypeArguments*/
@@ -63738,10 +64374,12 @@ function createTypeChecker(host) {
}
function isConstantReference(node) {
switch (node.kind) {
- case 79 /* Identifier */: {
- const symbol = getResolvedSymbol(node);
- return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
- }
+ case 79 /* Identifier */:
+ if (!isThisInTypeQuery(node)) {
+ const symbol = getResolvedSymbol(node);
+ return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
+ }
+ break;
case 208 /* PropertyAccessExpression */:
case 209 /* ElementAccessExpression */:
return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
@@ -63887,7 +64525,7 @@ function createTypeChecker(host) {
}
return declaredType;
}
- if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) {
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
}
return void 0;
@@ -64404,7 +65042,7 @@ function createTypeChecker(host) {
}
if (assumeTrue) {
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
- if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
+ if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
return valueType;
}
if (valueType.flags & 524288 /* Object */) {
@@ -64437,7 +65075,7 @@ function createTypeChecker(host) {
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
}
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
- return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
+ return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getAdjustedTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
}
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
const everyClauseChecks = clauseStart !== clauseEnd && every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -64454,7 +65092,7 @@ function createTypeChecker(host) {
let groundClauseTypes;
for (let i = 0; i < clauseTypes.length; i += 1) {
const t = clauseTypes[i];
- if (t.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
+ if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
if (groundClauseTypes !== void 0) {
groundClauseTypes.push(t);
}
@@ -64573,52 +65211,58 @@ function createTypeChecker(host) {
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
return type;
}
- let targetType;
- const prototypeProperty = getPropertyOfType(rightType, "prototype");
- if (prototypeProperty) {
- const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
- if (!isTypeAny(prototypePropertyType)) {
- targetType = prototypePropertyType;
- }
- }
- if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
+ const instanceType = mapType(rightType, getInstanceType);
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
return type;
}
- if (!targetType) {
- const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
- targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
- }
- if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
- const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
- if (!nonConstructorTypeInUnion)
- return type;
- }
return getNarrowedType(
type,
- targetType,
+ instanceType,
assumeTrue,
/*checkDerived*/
true
);
}
+ function getInstanceType(constructorType) {
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
+ return prototypePropertyType;
+ }
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
+ if (constructSignatures.length) {
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
+ }
+ return emptyObjectType;
+ }
function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
var _a3;
const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
}
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
if (!assumeTrue) {
- return filterType(type, (t) => !isRelated(t, candidate));
+ if (checkDerived) {
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
+ }
+ const trueType2 = getNarrowedType(
+ type,
+ candidate,
+ /*assumeTrue*/
+ true,
+ /*checkDerived*/
+ false
+ );
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
}
if (type.flags & 3 /* AnyOrUnknown */) {
return candidate;
}
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
const narrowedType = mapType(candidate, (c) => {
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
+ const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
});
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -64722,7 +65366,7 @@ function createTypeChecker(host) {
}
}
function getTypeOfSymbolAtLocation(symbol, location) {
- symbol = symbol.exportSymbol || symbol;
+ symbol = getExportSymbolOfValueSymbolIfExported(symbol);
if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) {
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
@@ -64774,15 +65418,25 @@ function createTypeChecker(host) {
function isConstVariable(symbol) {
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
}
- function removeOptionalityFromDeclaredType(declaredType, declaration) {
- if (pushTypeResolution(declaration.symbol, 2 /* DeclaredType */)) {
- const annotationIncludesUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
- popTypeResolution();
- return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
- } else {
- reportCircularityError(declaration.symbol);
- return declaredType;
+ function parameterInitializerContainsUndefined(declaration) {
+ const links = getNodeLinks(declaration);
+ if (links.parameterInitializerContainsUndefined === void 0) {
+ if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
+ if (!popTypeResolution()) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ links.parameterInitializerContainsUndefined = containsUndefined;
}
+ return links.parameterInitializerContainsUndefined;
+ }
+ function removeOptionalityFromDeclaredType(declaredType, declaration) {
+ const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
+ return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
}
function isConstraintPosition(type, node) {
const parent = node.parent;
@@ -65893,9 +66547,18 @@ function createTypeChecker(host) {
if (prop) {
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
}
- if (isTupleType(t)) {
- const restType = getRestTypeOfTupleType(t);
- if (restType && isNumericLiteralName(name) && +name >= 0) {
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
+ const restType = getElementTypeOfSliceOfTupleType(
+ t,
+ t.target.fixedLength,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ );
+ if (restType) {
return restType;
}
}
@@ -65942,9 +66605,18 @@ function createTypeChecker(host) {
return void 0;
}
function getContextualTypeForElementExpression(arrayContextualType, index) {
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
arrayContextualType,
- (t) => getIteratedTypeOrElementType(
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
+ t,
+ 0,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ ) : getIteratedTypeOrElementType(
1 /* Element */,
t,
undefinedType,
@@ -66097,14 +66769,17 @@ function createTypeChecker(host) {
return type;
}
function getContextualType(node, contextFlags) {
+ var _a2, _b;
if (node.flags & 33554432 /* InWithStatement */) {
return void 0;
}
- const index = findContextualNode(node);
+ const index = findContextualNode(
+ node,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
- const cached = contextualTypes[index];
- if (cached || !contextFlags)
- return cached;
+ return contextualTypes[index];
}
const { parent } = node;
switch (parent.kind) {
@@ -66139,7 +66814,9 @@ function createTypeChecker(host) {
case 206 /* ArrayLiteralExpression */: {
const arrayLiteral = parent;
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
}
case 224 /* ConditionalExpression */:
return getContextualTypeForConditionalOperand(node, contextFlags);
@@ -66175,17 +66852,30 @@ function createTypeChecker(host) {
}
return void 0;
}
- function pushContextualType(node, type) {
+ function pushCachedContextualType(node) {
+ pushContextualType(
+ node,
+ getContextualType(
+ node,
+ /*contextFlags*/
+ void 0
+ ),
+ /*isCache*/
+ true
+ );
+ }
+ function pushContextualType(node, type, isCache) {
contextualTypeNodes[contextualTypeCount] = node;
contextualTypes[contextualTypeCount] = type;
+ contextualIsCache[contextualTypeCount] = isCache;
contextualTypeCount++;
}
function popContextualType() {
contextualTypeCount--;
}
- function findContextualNode(node) {
+ function findContextualNode(node, includeCaches) {
for (let i = contextualTypeCount - 1; i >= 0; i--) {
- if (node === contextualTypeNodes[i]) {
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
return i;
}
}
@@ -66208,7 +66898,11 @@ function createTypeChecker(host) {
}
function getContextualJsxElementAttributesType(node, contextFlags) {
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
- const index = findContextualNode(node.parent);
+ const index = findContextualNode(
+ node.parent,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
return contextualTypes[index];
}
@@ -66479,11 +67173,7 @@ function createTypeChecker(host) {
const elementCount = elements.length;
const elementTypes = [];
const elementFlags = [];
- pushContextualType(node, getContextualType(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const inDestructuringPattern = isAssignmentTarget(node);
const inConstContext = isConstContext(node);
const contextualType = getApparentTypeOfContextualType(
@@ -66646,11 +67336,7 @@ function createTypeChecker(host) {
let propertiesTable = createSymbolTable();
let propertiesArray = [];
let spread = emptyObjectType;
- pushContextualType(node, getContextualType(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const contextualType = getApparentTypeOfContextualType(
node,
/*contextFlags*/
@@ -67937,7 +68623,7 @@ function createTypeChecker(host) {
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
let errorInfo;
let relatedInfo;
- if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 131068 /* Primitive */)) {
+ if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
for (const subtype of containingType.types) {
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
@@ -67990,26 +68676,22 @@ function createTypeChecker(host) {
function getSuggestedLibForNonExistentName(name) {
const missingName = diagnosticName(name);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const containingTypes = getOwnKeys(allFeatures[libTarget]);
- if (containingTypes !== void 0 && contains(containingTypes, missingName)) {
- return libTarget;
- }
- }
+ const typeFeatures = allFeatures.get(missingName);
+ return typeFeatures && firstIterator(typeFeatures.keys());
}
function getSuggestedLibForNonExistentProperty(missingProperty, containingType) {
const container = getApparentType(containingType).symbol;
if (!container) {
return void 0;
}
+ const containingTypeName = symbolName(container);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const featuresOfLib = allFeatures[libTarget];
- const featuresOfContainingType = featuresOfLib[symbolName(container)];
- if (featuresOfContainingType !== void 0 && contains(featuresOfContainingType, missingProperty)) {
- return libTarget;
+ const typeFeatures = allFeatures.get(containingTypeName);
+ if (typeFeatures) {
+ for (const [libTarget, featuresOfType] of typeFeatures) {
+ if (contains(featuresOfType, missingProperty)) {
+ return libTarget;
+ }
}
}
}
@@ -68538,7 +69220,7 @@ function createTypeChecker(host) {
} else {
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
- const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
flags.push(1 /* Required */);
}
@@ -69072,7 +69754,7 @@ function createTypeChecker(host) {
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
const isDecorator2 = node.kind === 167 /* Decorator */;
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
- const reportErrors2 = !candidatesOutArray;
+ const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
let typeArguments;
if (!isDecorator2 && !isSuperCall(node)) {
typeArguments = node.typeArguments;
@@ -70031,7 +70713,7 @@ function createTypeChecker(host) {
}
}
function checkCallExpression(node, checkMode) {
- var _a2;
+ var _a2, _b, _c;
checkGrammarTypeArguments(node, node.typeArguments);
const signature = getResolvedSignature(
node,
@@ -70048,7 +70730,7 @@ function createTypeChecker(host) {
}
if (node.kind === 211 /* NewExpression */) {
const declaration = signature.declaration;
- if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
+ if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
if (noImplicitAny) {
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
}
@@ -70076,7 +70758,7 @@ function createTypeChecker(host) {
/*allowDeclaration*/
false
);
- if ((_a2 = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _a2.size) {
+ if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
return getIntersectionType([returnType, jsAssignmentType]);
@@ -70362,6 +71044,9 @@ function createTypeChecker(host) {
checkGrammarExpressionWithTypeArguments(node);
forEach(node.typeArguments, checkSourceElement);
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
+ return getInstantiationExpressionType(exprType, node);
+ }
+ function getInstantiationExpressionType(exprType, node) {
const typeArguments = node.typeArguments;
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
return exprType;
@@ -71785,10 +72470,10 @@ function createTypeChecker(host) {
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 131068 /* Primitive */)) {
+ if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
}
return booleanType;
@@ -72310,8 +72995,8 @@ function createTypeChecker(host) {
case 32 /* LessThanEqualsToken */:
case 33 /* GreaterThanEqualsToken */:
if (checkForDisallowedESSymbolOperand(operator)) {
- leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
- rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
+ leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
+ rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
reportOperatorErrorUnless((left2, right2) => {
if (isTypeAny(left2) || isTypeAny(right2)) {
return true;
@@ -72371,7 +73056,7 @@ function createTypeChecker(host) {
return leftType;
} else {
checkAssignmentOperator(rightType);
- return getRegularTypeOfObjectLiteral(rightType);
+ return rightType;
}
case 27 /* CommaToken */:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -72662,14 +73347,19 @@ function createTypeChecker(host) {
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
}
function getContextNode(node) {
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
return node.parent.parent;
}
return node;
}
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
const contextNode = getContextNode(node);
- pushContextualType(contextNode, contextualType);
+ pushContextualType(
+ contextNode,
+ contextualType,
+ /*isCache*/
+ false
+ );
pushInferenceContext(contextNode, inferenceContext);
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -73000,7 +73690,7 @@ function createTypeChecker(host) {
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
return checkExpression(node);
}
return void 0;
@@ -73010,7 +73700,12 @@ function createTypeChecker(host) {
if (links.contextFreeType) {
return links.contextFreeType;
}
- pushContextualType(node, anyType);
+ pushContextualType(
+ node,
+ anyType,
+ /*isCache*/
+ false
+ );
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
popContextualType();
return type;
@@ -73225,7 +73920,7 @@ function createTypeChecker(host) {
error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
}
}
- if ((node.questionToken || isJSDocOptionalParameter(node)) && isBindingPattern(node.name) && func.body) {
+ if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
}
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
@@ -73747,8 +74442,8 @@ function createTypeChecker(host) {
}
return void 0;
}
- function getTypeParametersForTypeReference(node) {
- const type = getTypeFromTypeReference(node);
+ function getTypeParametersForTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
const symbol = getNodeLinks(node).resolvedSymbol;
if (symbol) {
@@ -73766,11 +74461,14 @@ function createTypeChecker(host) {
}
}
forEach(node.typeArguments, checkSourceElement);
- const type = getTypeFromTypeReference(node);
+ checkTypeReferenceOrImport(node);
+ }
+ function checkTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
if (node.typeArguments) {
addLazyDiagnostic(() => {
- const typeParameters = getTypeParametersForTypeReference(node);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(node);
if (typeParameters) {
checkTypeArgumentConstraints(node, typeParameters);
}
@@ -73792,7 +74490,7 @@ function createTypeChecker(host) {
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
if (!typeReferenceNode)
return void 0;
- const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReferenceNode);
if (!typeParameters)
return void 0;
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
@@ -73972,7 +74670,7 @@ function createTypeChecker(host) {
}
}
}
- getTypeFromTypeNode(node);
+ checkTypeReferenceOrImport(node);
}
function checkNamedTupleMember(node) {
if (node.dotDotDotToken && node.questionToken) {
@@ -74137,6 +74835,17 @@ function createTypeChecker(host) {
lastSeenNonAmbientDeclaration = node;
}
}
+ if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
+ for (const node2 of current.jsDoc) {
+ if (node2.tags) {
+ for (const tag of node2.tags) {
+ if (isJSDocOverloadTag(tag)) {
+ hasOverloads = true;
+ }
+ }
+ }
+ }
+ }
}
}
if (multipleConstructorImplementation) {
@@ -74174,8 +74883,9 @@ function createTypeChecker(host) {
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
for (const signature of signatures) {
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
+ const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
addRelatedInfo(
- error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
+ error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
);
break;
@@ -74268,6 +74978,9 @@ function createTypeChecker(host) {
case 273 /* ImportSpecifier */:
case 79 /* Identifier */:
return 1 /* ExportValue */;
+ case 170 /* MethodSignature */:
+ case 168 /* PropertySignature */:
+ return 2 /* ExportType */;
default:
return Debug.failBadSyntaxKind(d);
}
@@ -74291,7 +75004,7 @@ function createTypeChecker(host) {
))) {
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
}
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return void 0;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -74343,7 +75056,7 @@ function createTypeChecker(host) {
return awaitedType || errorType;
}
function isThenableType(type) {
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return false;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -74392,7 +75105,7 @@ function createTypeChecker(host) {
return awaitedType;
}
}
- Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
+ Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
return type;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -77205,20 +77918,19 @@ function createTypeChecker(host) {
}
}
}
- function getMemberOverrideModifierStatus(node, member) {
+ function getMemberOverrideModifierStatus(node, member, memberSymbol) {
if (!member.name) {
return 0 /* Ok */;
}
- const symbol = getSymbolOfDeclaration(node);
- const type = getDeclaredTypeOfSymbol(symbol);
+ const classSymbol = getSymbolOfDeclaration(node);
+ const type = getDeclaredTypeOfSymbol(classSymbol);
const typeWithThis = getTypeWithThisArgument(type);
- const staticType = getTypeOfSymbol(symbol);
+ const staticType = getTypeOfSymbol(classSymbol);
const baseTypeNode = getEffectiveBaseTypeNode(node);
const baseTypes = baseTypeNode && getBaseTypes(type);
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
const baseStaticType = getBaseConstructorTypeOfClass(type);
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
- const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
return checkMemberForOverrideModifier(
node,
staticType,
@@ -77231,7 +77943,7 @@ function createTypeChecker(host) {
isStatic(member),
/* memberIsParameterProperty */
false,
- memberName
+ symbolName(memberSymbol)
);
}
function getTargetSymbol(s) {
@@ -77783,7 +78495,7 @@ function createTypeChecker(host) {
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
}
}
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
if (exportModifier) {
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -78114,8 +78826,6 @@ function createTypeChecker(host) {
} else {
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
- } else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
- grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
}
@@ -78270,7 +78980,7 @@ function createTypeChecker(host) {
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
- const sym = resolveEntityName(
+ const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
id,
67108863 /* All */,
/*ignoreErrors*/
@@ -78278,7 +78988,7 @@ function createTypeChecker(host) {
/*dontResolveAlias*/
true,
node
- );
+ ));
if (sym) {
markAliasReferenced(sym, id);
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
@@ -78322,8 +79032,6 @@ function createTypeChecker(host) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
- } else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
- grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
}
}
}
@@ -78651,6 +79359,8 @@ function createTypeChecker(host) {
if (!(links.flags & 1 /* TypeChecked */)) {
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
links.deferredNodes.add(node);
+ } else {
+ Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
}
}
function checkDeferredNodes(context) {
@@ -78658,6 +79368,7 @@ function createTypeChecker(host) {
if (links.deferredNodes) {
links.deferredNodes.forEach(checkDeferredNode);
}
+ links.deferredNodes = void 0;
}
function checkDeferredNode(node) {
var _a2, _b;
@@ -78913,7 +79624,7 @@ function createTypeChecker(host) {
}
return node.parent.kind === 180 /* TypeReference */;
}
- function isHeritageClauseElementIdentifier(node) {
+ function isInNameOfExpressionWithTypeArguments(node) {
while (node.parent.kind === 208 /* PropertyAccessExpression */) {
node = node.parent;
}
@@ -79023,10 +79734,10 @@ function createTypeChecker(host) {
while (isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
name = name.parent;
}
- if (isHeritageClauseElementIdentifier(name)) {
+ if (isInNameOfExpressionWithTypeArguments(name)) {
let meaning = 0 /* None */;
if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) {
- meaning = 788968 /* Type */;
+ meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */;
if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
meaning |= 111551 /* Value */;
}
@@ -79432,8 +80143,8 @@ function createTypeChecker(host) {
}
return getNamedMembers(propsByName);
}
- function typeHasCallOrConstructSignatures2(type) {
- return typeHasCallOrConstructSignatures(type, checker);
+ function typeHasCallOrConstructSignatures(type) {
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
}
function getRootSymbols(symbol) {
const roots = getImmediateRootSymbols(symbol);
@@ -79738,7 +80449,7 @@ function createTypeChecker(host) {
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
}
function getTypeReferenceSerializationKind(typeNameIn, location) {
- var _a2, _b;
+ var _a2;
const typeName = getParseTreeNode(typeNameIn, isEntityName);
if (!typeName)
return 0 /* Unknown */;
@@ -79770,7 +80481,7 @@ function createTypeChecker(host) {
location
);
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
- isTypeOnly || (isTypeOnly = !!((_b = valueSymbol == null ? void 0 : valueSymbol.declarations) == null ? void 0 : _b.every(isTypeOnlyImportOrExportDeclaration)));
+ isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
const typeSymbol = resolveEntityName(
typeName,
788968 /* Type */,
@@ -79921,7 +80632,7 @@ function createTypeChecker(host) {
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- const enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
type.symbol,
111551 /* Value */,
enclosing,
@@ -80464,6 +81175,7 @@ function createTypeChecker(host) {
let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator;
let flags = 0 /* None */;
let sawExportBeforeDecorators = false;
+ let hasLeadingDecorators = false;
for (const modifier of node.modifiers) {
if (isDecorator(modifier)) {
if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) {
@@ -80481,8 +81193,22 @@ function createTypeChecker(host) {
if (flags & ~(1025 /* ExportDefault */ | 131072 /* Decorator */)) {
return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
}
+ if (hasLeadingDecorators && flags & 126975 /* Modifier */) {
+ Debug.assertIsDefined(firstDecorator);
+ const sourceFile = getSourceFileOfNode(modifier);
+ if (!hasParseDiagnostics(sourceFile)) {
+ addRelatedInfo(
+ error(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
+ );
+ return true;
+ }
+ return false;
+ }
flags |= 131072 /* Decorator */;
- if (flags & 1 /* Export */) {
+ if (!(flags & 126975 /* Modifier */)) {
+ hasLeadingDecorators = true;
+ } else if (flags & 1 /* Export */) {
sawExportBeforeDecorators = true;
}
firstDecorator != null ? firstDecorator : firstDecorator = modifier;
@@ -80770,7 +81496,6 @@ function createTypeChecker(host) {
case 299 /* PropertyAssignment */:
case 300 /* ShorthandPropertyAssignment */:
case 267 /* NamespaceExportDeclaration */:
- case 181 /* FunctionType */:
case 279 /* MissingDeclaration */:
return find(node.modifiers, isModifier);
default:
@@ -81467,7 +82192,7 @@ function createTypeChecker(host) {
}
function isSimpleLiteralEnumReference(expr) {
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
- return !!(checkExpressionCached(expr).flags & 1024 /* EnumLiteral */);
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
}
}
function checkAmbientInitializer(node) {
@@ -81869,10 +82594,10 @@ function createTypeChecker(host) {
}
function findMostOverlappyType(source, unionTarget) {
let bestMatch;
- if (!(source.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
let matchingCount = 0;
for (const target of unionTarget.types) {
- if (!(target.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
if (overlap.flags & 4194304 /* Index */) {
return target;
@@ -81890,7 +82615,7 @@ function createTypeChecker(host) {
}
function filterPrimitivesIfContainsNonPrimitive(type) {
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
- const result = filterType(type, (t) => !(t.flags & 131068 /* Primitive */));
+ const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
if (!(result.flags & 131072 /* Never */)) {
return result;
}
@@ -83293,7 +84018,7 @@ var visitEachChildTable = {
[291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
return context.factory.updateJsxExpression(
node,
- Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
+ nodeVisitor(node.expression, visitor, isExpression)
);
},
// Clauses
@@ -83380,31 +84105,31 @@ function extractSingleNode(nodes) {
// src/compiler/sourcemap.ts
function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
- const { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
- const rawSources = [];
- const sources = [];
- const sourceToSourceIndexMap = /* @__PURE__ */ new Map();
- let sourcesContent;
- const names = [];
- let nameToNameIndexMap;
- const mappingCharCodes = [];
- let mappings = "";
- let lastGeneratedLine = 0;
- let lastGeneratedCharacter = 0;
- let lastSourceIndex = 0;
- let lastSourceLine = 0;
- let lastSourceCharacter = 0;
- let lastNameIndex = 0;
- let hasLast = false;
- let pendingGeneratedLine = 0;
- let pendingGeneratedCharacter = 0;
- let pendingSourceIndex = 0;
- let pendingSourceLine = 0;
- let pendingSourceCharacter = 0;
- let pendingNameIndex = 0;
- let hasPending = false;
- let hasPendingSource = false;
- let hasPendingName = false;
+ var { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
+ var rawSources = [];
+ var sources = [];
+ var sourceToSourceIndexMap = /* @__PURE__ */ new Map();
+ var sourcesContent;
+ var names = [];
+ var nameToNameIndexMap;
+ var mappingCharCodes = [];
+ var mappings = "";
+ var lastGeneratedLine = 0;
+ var lastGeneratedCharacter = 0;
+ var lastSourceIndex = 0;
+ var lastSourceLine = 0;
+ var lastSourceCharacter = 0;
+ var lastNameIndex = 0;
+ var hasLast = false;
+ var pendingGeneratedLine = 0;
+ var pendingGeneratedCharacter = 0;
+ var pendingSourceIndex = 0;
+ var pendingSourceLine = 0;
+ var pendingSourceCharacter = 0;
+ var pendingNameIndex = 0;
+ var hasPending = false;
+ var hasPendingSource = false;
+ var hasPendingName = false;
return {
getSources: () => rawSources,
addSource,
@@ -86468,7 +87193,7 @@ function transformTypeScript(context) {
return node;
}
function tryGetConstEnumValue(node) {
- if (compilerOptions.isolatedModules) {
+ if (getIsolatedModules(compilerOptions)) {
return void 0;
}
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
@@ -87017,7 +87742,16 @@ function transformClassFields(context) {
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
);
}
- return visitEachChild(node, visitor, context);
+ return factory2.updatePropertyDeclaration(
+ node,
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
+ visitNode(node.name, propertyNameVisitor, isPropertyName),
+ /*questionOrExclamationToken*/
+ void 0,
+ /*type*/
+ void 0,
+ visitNode(node.initializer, visitor, isExpression)
+ );
}
function transformPublicFieldInitializer(node) {
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
@@ -92350,7 +93084,7 @@ function transformES2018(context) {
);
}
function visitBinaryExpression(node, expressionResultIsUnused2) {
- if (isDestructuringAssignment(node) && node.left.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (isDestructuringAssignment(node) && containsObjectRestOrSpread(node.left)) {
return flattenDestructuringAssignment(
node,
visitor,
@@ -92482,7 +93216,7 @@ function transformES2018(context) {
}
function visitForOfStatement(node, outermostLabeledStatement) {
const ancestorFacts = enterSubtree(0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */);
- if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */ || isAssignmentPattern(node.initializer) && containsObjectRestOrSpread(node.initializer)) {
node = transformForOfStatementWithObjectRest(node);
}
const result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory2.restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
@@ -100319,6 +101053,9 @@ function transformModule(context) {
return visitEachChild(node, visitor, context);
}
function visitImportCallExpression(node) {
+ if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
+ return visitEachChild(node, visitor, context);
+ }
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
@@ -102795,7 +103532,7 @@ function transformECMAScriptModule(context) {
if (node.isDeclarationFile) {
return node;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
currentSourceFile = node;
importRequireStatements = void 0;
let result = updateExternalModule(node);
@@ -103002,7 +103739,7 @@ function transformECMAScriptModule(context) {
}
function onEmitNode(hint, node, emitCallback) {
if (isSourceFile(node)) {
- if ((isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) {
+ if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
helperNameSubstitutions = /* @__PURE__ */ new Map();
}
previousOnEmitNode(hint, node, emitCallback);
@@ -103854,7 +104591,7 @@ function transformDeclarations(context) {
if (elem.kind === 229 /* OmittedExpression */) {
return elem;
}
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
return factory2.updateBindingElement(
elem,
elem.dotDotDotToken,
@@ -105716,15 +106453,15 @@ function getFirstProjectOutput(configFile, ignoreCase) {
return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
}
function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
- const compilerOptions = host.getCompilerOptions();
- const sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
- const emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
- const emitterDiagnostics = createDiagnosticCollection();
- const newLine = getNewLineCharacter(compilerOptions);
- const writer = createTextWriter(newLine);
- const { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
- let bundleBuildInfo;
- let emitSkipped = false;
+ var compilerOptions = host.getCompilerOptions();
+ var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
+ var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
+ var emitterDiagnostics = createDiagnosticCollection();
+ var newLine = getNewLineCharacter(compilerOptions);
+ var writer = createTextWriter(newLine);
+ var { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
+ var bundleBuildInfo;
+ var emitSkipped = false;
enter();
forEachEmittedFile(
host,
@@ -106286,12 +107023,12 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
);
return outputFiles;
}
-var createPrinterWithDefaults = memoize(() => createPrinter({}));
-var createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
-var createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
-var createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
+var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
+var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
+var createPrinterWithRemoveCommentsNeverAsciiEscape = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
+var createPrinterWithRemoveCommentsOmitTrailingSemicolon = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
function createPrinter(printerOptions = {}, handlers = {}) {
- const {
+ var {
hasGlobalName,
onEmitNode = noEmitNotification,
isEmitNotificationEnabled,
@@ -106303,57 +107040,57 @@ function createPrinter(printerOptions = {}, handlers = {}) {
onBeforeEmitToken,
onAfterEmitToken
} = handlers;
- const extendedDiagnostics = !!printerOptions.extendedDiagnostics;
- const newLine = getNewLineCharacter(printerOptions);
- const moduleKind = getEmitModuleKind(printerOptions);
- const bundledHelpers = /* @__PURE__ */ new Map();
- let currentSourceFile;
- let nodeIdToGeneratedName;
- let nodeIdToGeneratedPrivateName;
- let autoGeneratedIdToGeneratedName;
- let generatedNames;
- let formattedNameTempFlagsStack;
- let formattedNameTempFlags;
- let privateNameTempFlagsStack;
- let privateNameTempFlags;
- let tempFlagsStack;
- let tempFlags;
- let reservedNamesStack;
- let reservedNames;
- let reservedPrivateNamesStack;
- let reservedPrivateNames;
- let preserveSourceNewlines = printerOptions.preserveSourceNewlines;
- let nextListElementPos;
- let writer;
- let ownWriter;
- let write = writeBase;
- let isOwnFileEmit;
- const bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
- const relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
- const recordInternalSection = printerOptions.recordInternalSection;
- let sourceFileTextPos = 0;
- let sourceFileTextKind = "text" /* Text */;
- let sourceMapsDisabled = true;
- let sourceMapGenerator;
- let sourceMapSource;
- let sourceMapSourceIndex = -1;
- let mostRecentlyAddedSourceMapSource;
- let mostRecentlyAddedSourceMapSourceIndex = -1;
- let containerPos = -1;
- let containerEnd = -1;
- let declarationListContainerEnd = -1;
- let currentLineMap;
- let detachedCommentsInfo;
- let hasWrittenComment = false;
- let commentsDisabled = !!printerOptions.removeComments;
- let lastSubstitution;
- let currentParenthesizerRule;
- const { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
- const parenthesizer = factory.parenthesizer;
- const typeArgumentParenthesizerRuleSelector = {
+ var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
+ var newLine = getNewLineCharacter(printerOptions);
+ var moduleKind = getEmitModuleKind(printerOptions);
+ var bundledHelpers = /* @__PURE__ */ new Map();
+ var currentSourceFile;
+ var nodeIdToGeneratedName;
+ var nodeIdToGeneratedPrivateName;
+ var autoGeneratedIdToGeneratedName;
+ var generatedNames;
+ var formattedNameTempFlagsStack;
+ var formattedNameTempFlags;
+ var privateNameTempFlagsStack;
+ var privateNameTempFlags;
+ var tempFlagsStack;
+ var tempFlags;
+ var reservedNamesStack;
+ var reservedNames;
+ var reservedPrivateNamesStack;
+ var reservedPrivateNames;
+ var preserveSourceNewlines = printerOptions.preserveSourceNewlines;
+ var nextListElementPos;
+ var writer;
+ var ownWriter;
+ var write = writeBase;
+ var isOwnFileEmit;
+ var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
+ var relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
+ var recordInternalSection = printerOptions.recordInternalSection;
+ var sourceFileTextPos = 0;
+ var sourceFileTextKind = "text" /* Text */;
+ var sourceMapsDisabled = true;
+ var sourceMapGenerator;
+ var sourceMapSource;
+ var sourceMapSourceIndex = -1;
+ var mostRecentlyAddedSourceMapSource;
+ var mostRecentlyAddedSourceMapSourceIndex = -1;
+ var containerPos = -1;
+ var containerEnd = -1;
+ var declarationListContainerEnd = -1;
+ var currentLineMap;
+ var detachedCommentsInfo;
+ var hasWrittenComment = false;
+ var commentsDisabled = !!printerOptions.removeComments;
+ var lastSubstitution;
+ var currentParenthesizerRule;
+ var { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
+ var parenthesizer = factory.parenthesizer;
+ var typeArgumentParenthesizerRuleSelector = {
select: (index) => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : void 0
};
- const emitBinaryExpression = createEmitBinaryExpression();
+ var emitBinaryExpression = createEmitBinaryExpression();
reset();
return {
// public API
@@ -106612,9 +107349,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
formattedNameTempFlagsStack = [];
formattedNameTempFlags = /* @__PURE__ */ new Map();
privateNameTempFlagsStack = [];
- privateNameTempFlags = TempFlags.Auto;
+ privateNameTempFlags = 0 /* Auto */;
tempFlagsStack = [];
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
reservedNamesStack = [];
reservedNames = void 0;
reservedPrivateNamesStack = [];
@@ -107583,7 +108320,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitTypeLiteral(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -107772,7 +108509,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitObjectLiteralExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -108538,7 +109275,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitClassDeclarationOrExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -108571,7 +109308,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitInterfaceDeclaration(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -110014,7 +110751,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
return;
}
tempFlagsStack.push(tempFlags);
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
formattedNameTempFlagsStack.push(formattedNameTempFlags);
formattedNameTempFlags = void 0;
reservedNamesStack.push(reservedNames);
@@ -110200,7 +110937,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
case "#":
return privateNameTempFlags;
default:
- return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : TempFlags.Auto;
+ return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : 0 /* Auto */;
}
}
function setTempFlags(formattedNameKey, flags) {
@@ -110224,7 +110961,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
const key = formatGeneratedName(privateName, prefix, "", suffix);
let tempFlags2 = getTempFlags(key);
if (flags && !(tempFlags2 & flags)) {
- const name = flags === TempFlags._i ? "_i" : "_n";
+ const name = flags === 268435456 /* _i */ ? "_i" : "_n";
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
if (isUniqueName(fullName, privateName)) {
tempFlags2 |= flags;
@@ -110238,7 +110975,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
}
while (true) {
- const count = tempFlags2 & TempFlags.CountMask;
+ const count = tempFlags2 & 268435455 /* CountMask */;
tempFlags2++;
if (count !== 8 && count !== 13) {
const name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
@@ -110382,7 +111119,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
return generateNameCached(node.name, privateName);
}
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reservedInNestedScopes*/
false,
privateName,
@@ -110439,7 +111176,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
return generateNameForMethodOrAccessor(node, privateName, prefix, suffix);
case 164 /* ComputedPropertyName */:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
true,
privateName,
@@ -110448,7 +111185,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
);
default:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
false,
privateName,
@@ -110463,11 +111200,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
const suffix = formatGeneratedNamePart(autoGenerate.suffix);
switch (autoGenerate.flags & 7 /* KindMask */) {
case 1 /* Auto */:
- return makeTempVariableName(TempFlags.Auto, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
+ return makeTempVariableName(0 /* Auto */, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
case 2 /* Loop */:
Debug.assertNode(name, isIdentifier);
return makeTempVariableName(
- TempFlags._i,
+ 268435456 /* _i */,
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
/*privateName*/
false,
@@ -110937,12 +111674,6 @@ function getOpeningBracket(format) {
function getClosingBracket(format) {
return brackets[format & 15360 /* BracketsMask */][1];
}
-var TempFlags = /* @__PURE__ */ ((TempFlags2) => {
- TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
- TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
- TempFlags2[TempFlags2["_i"] = 268435456] = "_i";
- return TempFlags2;
-})(TempFlags || {});
function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
emit(node);
}
@@ -111870,14 +112601,14 @@ var moduleResolutionNameAndModeGetter = {
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
return {
nameAndMode: moduleResolutionNameAndModeGetter,
- resolve: (moduleName, resoluionMode) => resolveModuleName(
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
moduleName,
containingFile,
options,
host,
cache,
redirectedReference,
- resoluionMode
+ resolutionMode
)
};
}
@@ -113412,11 +114143,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
} else if (isClassDeclaration(parent)) {
const exportIndex = findIndex(parent.modifiers, isExportModifier);
- const defaultIndex = findIndex(parent.modifiers, isDefaultModifier);
- if (exportIndex >= 0 && decoratorIndex < exportIndex) {
- diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_must_come_after_export_or_export_default_in_JavaScript_files));
- } else if (defaultIndex >= 0 && decoratorIndex < defaultIndex) {
- diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ if (exportIndex >= 0) {
+ const defaultIndex = findIndex(parent.modifiers, isDefaultModifier);
+ if (decoratorIndex > exportIndex && defaultIndex >= 0 && decoratorIndex < defaultIndex) {
+ diagnostics.push(createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ } else if (exportIndex >= 0 && decoratorIndex < exportIndex) {
+ const trailingDecoratorIndex = findIndex(parent.modifiers, isDecorator, exportIndex);
+ if (trailingDecoratorIndex >= 0) {
+ diagnostics.push(addRelatedInfo(
+ createDiagnosticForNode2(parent.modifiers[trailingDecoratorIndex], Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode2(parent.modifiers[decoratorIndex], Diagnostics.Decorator_used_before_export_here)
+ ));
+ }
+ }
}
}
}
@@ -113594,7 +114333,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
let imports;
let moduleAugmentations;
let ambientModules;
- if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) {
+ if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
if (options.importHelpers) {
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
}
@@ -114315,12 +115054,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
}
- if (options.isolatedModules) {
+ if (options.isolatedModules || options.verbatimModuleSyntax) {
if (options.out) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
if (options.outFile) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
}
if (options.inlineSourceMap) {
@@ -114531,10 +115270,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
}
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
- createDiagnosticForOptionName(Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
}
+ const moduleKind = getEmitModuleKind(options);
if (options.verbatimModuleSyntax) {
- const moduleKind = getEmitModuleKind(options);
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
}
@@ -114553,13 +115292,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
const moduleResolution = getEmitModuleResolutionKind(options);
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
}
if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
}
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ }
+ if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
}
if (!options.noEmit && !options.suppressOutputPathCheck) {
const emitHost = getEmitHost();
@@ -114714,7 +115456,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (version2 === "6.0" /* v6_0 */) {
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
} else {
- createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
+ createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
}
}
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
@@ -115727,7 +116469,7 @@ var BuilderState;
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
}
const compilerOptions = programOfThisState.getCompilerOptions();
- if (compilerOptions && (compilerOptions.isolatedModules || outFile(compilerOptions))) {
+ if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
return [sourceFileWithUpdatedShape];
}
const seenFileNamesMap = /* @__PURE__ */ new Map();
@@ -116140,7 +116882,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
return;
if (!isChangedSignature(state, affectedFile.resolvedPath))
return;
- if (state.compilerOptions.isolatedModules) {
+ if (getIsolatedModules(state.compilerOptions)) {
const seenFileNamesMap = /* @__PURE__ */ new Map();
seenFileNamesMap.set(affectedFile.resolvedPath, true);
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
@@ -116233,14 +116975,17 @@ function getBuildInfo2(state, bundle) {
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
const fileNames = [];
const fileNameToFileId = /* @__PURE__ */ new Map();
+ const root = [];
if (outFile(state.compilerOptions)) {
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
- toFileId(key);
+ const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
});
const program2 = {
fileNames,
fileInfos: fileInfos2,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
outSignature: state.outSignature,
latestChangedDtsFile,
@@ -116268,6 +117013,7 @@ function getBuildInfo2(state, bundle) {
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
var _a3, _b2;
const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
const oldSignature = (_a3 = state.oldSignatures) == null ? void 0 : _a3.get(key);
const actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value.signature;
@@ -116367,6 +117113,7 @@ function getBuildInfo2(state, bundle) {
const program = {
fileNames,
fileInfos,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
fileIdsList,
referencedMap,
@@ -116402,6 +117149,24 @@ function getBuildInfo2(state, bundle) {
}
return fileIdListId;
}
+ function tryAddRoot(path, fileId) {
+ const file = state.program.getSourceFile(path);
+ if (!state.program.getFileIncludeReasons().get(file.path).some((r) => r.kind === 0 /* RootFile */))
+ return;
+ if (!root.length)
+ return root.push(fileId);
+ const last2 = root[root.length - 1];
+ const isLastStartEnd = isArray(last2);
+ if (isLastStartEnd && last2[1] === fileId - 1)
+ return last2[1] = fileId;
+ if (isLastStartEnd || root.length === 1 || last2 !== fileId - 1)
+ return root.push(fileId);
+ const lastButOne = root[root.length - 2];
+ if (!isNumber(lastButOne) || lastButOne !== last2 - 1)
+ return root.push(fileId);
+ root[root.length - 2] = [lastButOne, fileId];
+ return root.length = root.length - 1;
+ }
function convertToProgramBuildInfoCompilerOptions(options) {
let result;
const { optionsNameMap } = getOptionsNameMap();
@@ -116909,12 +117674,28 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
const fileInfos = /* @__PURE__ */ new Map();
+ let rootIndex = 0;
+ const roots = [];
program.fileInfos.forEach((fileInfo, index) => {
const path = toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
const version2 = isString(fileInfo) ? fileInfo : fileInfo.version;
fileInfos.set(path, version2);
+ if (rootIndex < program.root.length) {
+ const current = program.root[rootIndex];
+ const fileId = index + 1;
+ if (isArray(current)) {
+ if (current[0] <= fileId && fileId <= current[1]) {
+ roots.push(path);
+ if (current[1] === fileId)
+ rootIndex++;
+ }
+ } else if (current === fileId) {
+ roots.push(path);
+ rootIndex++;
+ }
+ }
});
- return fileInfos;
+ return { fileInfos, roots };
}
function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
return {
@@ -117822,7 +118603,7 @@ function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) {
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
}
function getLocaleTimeString(system) {
- return !system.now ? new Date().toLocaleTimeString() : (
+ return !system.now ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : (
// On some systems / builds of Node, there's a non-breaking space between the time and AM/PM.
// This branch is solely for testing, so just switch it to a normal space for baseline stability.
// See:
@@ -119149,8 +119930,8 @@ function resolveConfigFileProjectName(project) {
}
// src/compiler/tsbuildPublic.ts
-var minimumDate = new Date(-864e13);
-var maximumDate = new Date(864e13);
+var minimumDate = /* @__PURE__ */ new Date(-864e13);
+var maximumDate = /* @__PURE__ */ new Date(864e13);
function getOrCreateValueFromConfigFileMap(configFileMap, resolved, createT) {
const existingValue = configFileMap.get(resolved);
let newValue;
@@ -119164,7 +119945,7 @@ function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, () => /* @__PURE__ */ new Map());
}
function getCurrentTime(host) {
- return host.now ? host.now() : new Date();
+ return host.now ? host.now() : /* @__PURE__ */ new Date();
}
function isCircularBuildOrder(buildOrder) {
return !!buildOrder && !!buildOrder.buildOrder;
@@ -120026,7 +120807,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
}
continue;
}
- if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 14 /* UpToDateWithInputFileText */) {
+ if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
return {
kind: 2 /* UpdateOutputFileStamps */,
@@ -120038,7 +120819,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
};
}
}
- if (status.type === 11 /* UpstreamBlocked */) {
+ if (status.type === 12 /* UpstreamBlocked */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -120052,7 +120833,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
}
continue;
}
- if (status.type === 15 /* ContainerOnly */) {
+ if (status.type === 16 /* ContainerOnly */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -120239,31 +121020,31 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
var _a2, _b;
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
return {
- type: 15 /* ContainerOnly */
+ type: 16 /* ContainerOnly */
};
}
let referenceStatuses;
const force = !!state.options.force;
if (project.projectReferences) {
- state.projectStatus.set(resolvedPath, { type: 12 /* ComputingUpstream */ });
+ state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
for (const ref of project.projectReferences) {
const resolvedRef = resolveProjectReferencePath(ref);
const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
- if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
+ if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
continue;
}
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
+ if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */) {
return {
- type: 11 /* UpstreamBlocked */,
+ type: 12 /* UpstreamBlocked */,
upstreamProjectName: ref.path,
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
+ upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
};
}
if (refStatus.type !== 1 /* UpToDate */) {
return {
- type: 10 /* UpstreamOutOfDate */,
+ type: 11 /* UpstreamOutOfDate */,
upstreamProjectName: ref.path
};
}
@@ -120272,7 +121053,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
}
}
if (force)
- return { type: 16 /* ForceBuild */ };
+ return { type: 17 /* ForceBuild */ };
const { host } = state;
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
let oldestOutputFileName;
@@ -120305,7 +121086,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
}
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== version) {
return {
- type: 13 /* TsVersionOutputOfDate */,
+ type: 14 /* TsVersionOutputOfDate */,
version: buildInfo.version
};
}
@@ -120330,6 +121111,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
let newestInputFileName = void 0;
let newestInputFileTime = minimumDate;
let pseudoInputUpToDate = false;
+ const seenRoots = /* @__PURE__ */ new Set();
for (const inputFile of project.fileNames) {
const inputTime = getModifiedTime2(state, inputFile);
if (inputTime === missingFileModifiedTime) {
@@ -120344,7 +121126,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
if (buildInfoProgram) {
if (!buildInfoVersionMap)
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
- version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
+ version2 = buildInfoVersionMap.fileInfos.get(toPath2(state, inputFile));
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
if (version2 && version2 === currentVersion)
@@ -120362,6 +121144,21 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
newestInputFileName = inputFile;
newestInputFileTime = inputTime;
}
+ if (buildInfoProgram)
+ seenRoots.add(toPath2(state, inputFile));
+ }
+ if (buildInfoProgram) {
+ if (!buildInfoVersionMap)
+ buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
+ for (const existingRoot of buildInfoVersionMap.roots) {
+ if (!seenRoots.has(existingRoot)) {
+ return {
+ type: 10 /* OutOfDateRoots */,
+ buildInfoFile: buildInfoPath,
+ inputFile: existingRoot
+ };
+ }
+ }
}
if (!buildInfoPath) {
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
@@ -120443,7 +121240,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
};
}
return {
- type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 14 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
+ type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
newestInputFileTime,
newestInputFileName,
oldestOutputFileName
@@ -120562,7 +121359,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
}
break;
}
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
case 2 /* UpToDateWithUpstreamTypes */:
case 3 /* OutOfDateWithPrepend */:
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -120573,7 +121370,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
});
}
break;
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
clearProjectStatus(state, nextProjectPath);
}
@@ -121024,6 +121821,14 @@ function reportUpToDateStatus(state, configFileName, status) {
relName(state, configFileName),
relName(state, status.buildInfoFile)
);
+ case 10 /* OutOfDateRoots */:
+ return reportStatus(
+ state,
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
+ relName(state, configFileName),
+ relName(state, status.buildInfoFile),
+ relName(state, status.inputFile)
+ );
case 1 /* UpToDate */:
if (status.newestInputFileTime !== void 0) {
return reportStatus(
@@ -121048,20 +121853,20 @@ function reportUpToDateStatus(state, configFileName, status) {
Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
relName(state, configFileName)
);
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
return reportStatus(
state,
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
relName(state, configFileName)
);
- case 10 /* UpstreamOutOfDate */:
+ case 11 /* UpstreamOutOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
return reportStatus(
state,
status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
@@ -121075,7 +121880,7 @@ function reportUpToDateStatus(state, configFileName, status) {
relName(state, configFileName),
status.reason
);
- case 13 /* TsVersionOutputOfDate */:
+ case 14 /* TsVersionOutputOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
@@ -121083,14 +121888,14 @@ function reportUpToDateStatus(state, configFileName, status) {
status.version,
version
);
- case 16 /* ForceBuild */:
+ case 17 /* ForceBuild */:
return reportStatus(
state,
Diagnostics.Project_0_is_being_forcibly_rebuilt,
relName(state, configFileName)
);
- case 15 /* ContainerOnly */:
- case 12 /* ComputingUpstream */:
+ case 16 /* ContainerOnly */:
+ case 13 /* ComputingUpstream */:
break;
default:
assertType(status);
diff --git a/lib/tsserver.js b/lib/tsserver.js
index 31db324c0bdd3..20cb517f86aaa 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -331,6 +331,7 @@ __export(server_exports, {
consumesNodeCoreModules: () => consumesNodeCoreModules,
contains: () => contains,
containsIgnoredPath: () => containsIgnoredPath,
+ containsObjectRestOrSpread: () => containsObjectRestOrSpread,
containsParseError: () => containsParseError,
containsPath: () => containsPath,
convertCompilerOptionsForTelemetry: () => convertCompilerOptionsForTelemetry,
@@ -669,6 +670,7 @@ __export(server_exports, {
getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig,
getCompilerOptionValue: () => getCompilerOptionValue,
getCompilerOptionsDiffValue: () => getCompilerOptionsDiffValue,
+ getConditions: () => getConditions,
getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics,
getConstantValue: () => getConstantValue,
getContainerNode: () => getContainerNode,
@@ -1350,6 +1352,7 @@ __export(server_exports, {
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
isGlobalDeclaration: () => isGlobalDeclaration,
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
+ isGrammarError: () => isGrammarError,
isHeritageClause: () => isHeritageClause,
isHoistedFunction: () => isHoistedFunction,
isHoistedVariableStatement: () => isHoistedVariableStatement,
@@ -1692,6 +1695,7 @@ __export(server_exports, {
isString: () => isString,
isStringAKeyword: () => isStringAKeyword,
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted: () => isStringDoubleQuoted,
isStringLiteral: () => isStringLiteral,
isStringLiteralLike: () => isStringLiteralLike,
@@ -1856,6 +1860,7 @@ __export(server_exports, {
mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
needsParentheses: () => needsParentheses,
needsScopeMarker: () => needsScopeMarker,
+ newCaseClauseTracker: () => newCaseClauseTracker,
newPrivateEnvironment: () => newPrivateEnvironment,
noEmitNotification: () => noEmitNotification,
noEmitSubstitution: () => noEmitSubstitution,
@@ -2229,7 +2234,6 @@ __export(server_exports, {
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
typeAliasNamePart: () => typeAliasNamePart,
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
typeKeywords: () => typeKeywords,
typeParameterNamePart: () => typeParameterNamePart,
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
@@ -2282,102 +2286,9 @@ __export(server_exports, {
});
module.exports = __toCommonJS(server_exports);
-// src/tsserver/_namespaces/ts.server.ts
-var ts_server_exports3 = {};
-__export(ts_server_exports3, {
- ActionInvalidate: () => ActionInvalidate,
- ActionPackageInstalled: () => ActionPackageInstalled,
- ActionSet: () => ActionSet,
- Arguments: () => Arguments,
- AutoImportProviderProject: () => AutoImportProviderProject,
- CharRangeSection: () => CharRangeSection,
- CommandNames: () => CommandNames,
- ConfigFileDiagEvent: () => ConfigFileDiagEvent,
- ConfiguredProject: () => ConfiguredProject2,
- Errors: () => Errors,
- EventBeginInstallTypes: () => EventBeginInstallTypes,
- EventEndInstallTypes: () => EventEndInstallTypes,
- EventInitializationFailed: () => EventInitializationFailed,
- EventTypesRegistry: () => EventTypesRegistry,
- ExternalProject: () => ExternalProject2,
- GcTimer: () => GcTimer,
- InferredProject: () => InferredProject2,
- LargeFileReferencedEvent: () => LargeFileReferencedEvent,
- LineIndex: () => LineIndex,
- LineLeaf: () => LineLeaf,
- LineNode: () => LineNode,
- LogLevel: () => LogLevel2,
- Msg: () => Msg,
- OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
- Project: () => Project3,
- ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
- ProjectKind: () => ProjectKind,
- ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
- ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
- ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
- ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
- ProjectService: () => ProjectService3,
- ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
- ScriptInfo: () => ScriptInfo,
- ScriptVersionCache: () => ScriptVersionCache,
- Session: () => Session3,
- TextStorage: () => TextStorage,
- ThrottledOperations: () => ThrottledOperations,
- TypingsCache: () => TypingsCache,
- allFilesAreJsOrDts: () => allFilesAreJsOrDts,
- allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
- asNormalizedPath: () => asNormalizedPath,
- convertCompilerOptions: () => convertCompilerOptions,
- convertFormatOptions: () => convertFormatOptions,
- convertScriptKindName: () => convertScriptKindName,
- convertTypeAcquisition: () => convertTypeAcquisition,
- convertUserPreferences: () => convertUserPreferences,
- convertWatchOptions: () => convertWatchOptions,
- countEachFileTypes: () => countEachFileTypes,
- createInstallTypingsRequest: () => createInstallTypingsRequest,
- createModuleSpecifierCache: () => createModuleSpecifierCache,
- createNormalizedPathMap: () => createNormalizedPathMap,
- createPackageJsonCache: () => createPackageJsonCache,
- createSortedArray: () => createSortedArray2,
- emptyArray: () => emptyArray2,
- findArgument: () => findArgument,
- forEachResolvedProjectReferenceProject: () => forEachResolvedProjectReferenceProject,
- formatMessage: () => formatMessage2,
- getBaseConfigFileName: () => getBaseConfigFileName,
- getLocationInNewDocument: () => getLocationInNewDocument,
- getLogLevel: () => getLogLevel,
- hasArgument: () => hasArgument,
- hasNoTypeScriptSource: () => hasNoTypeScriptSource,
- indent: () => indent2,
- initializeNodeSystem: () => initializeNodeSystem,
- isConfigFile: () => isConfigFile,
- isConfiguredProject: () => isConfiguredProject,
- isDynamicFileName: () => isDynamicFileName,
- isExternalProject: () => isExternalProject,
- isInferredProject: () => isInferredProject,
- isInferredProjectName: () => isInferredProjectName,
- makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
- makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
- makeInferredProjectName: () => makeInferredProjectName,
- maxFileSize: () => maxFileSize,
- maxProgramSizeForNonTsFiles: () => maxProgramSizeForNonTsFiles,
- normalizedPathToPath: () => normalizedPathToPath,
- nowString: () => nowString,
- nullCancellationToken: () => nullCancellationToken,
- nullTypingsInstaller: () => nullTypingsInstaller,
- projectContainsInfoDirectly: () => projectContainsInfoDirectly,
- protocol: () => ts_server_protocol_exports,
- removeSorted: () => removeSorted,
- stringifyIndented: () => stringifyIndented,
- toEvent: () => toEvent,
- toNormalizedPath: () => toNormalizedPath,
- tryConvertScriptKindName: () => tryConvertScriptKindName,
- updateProjectIfDirty: () => updateProjectIfDirty
-});
-
// src/compiler/corePublic.ts
var versionMajorMinor = "5.0";
-var version = `${versionMajorMinor}.0-beta`;
+var version = `${versionMajorMinor}.1-rc`;
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5432,7 +5343,7 @@ var nativePerformance = nativePerformanceHooks == null ? void 0 : nativePerforma
function tryGetNativePerformanceHooks() {
return nativePerformanceHooks;
}
-var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +new Date();
+var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +/* @__PURE__ */ new Date();
// src/compiler/perfLogger.ts
var nullLogger = {
@@ -5525,6 +5436,9 @@ function mark(markName) {
counts.set(markName, count + 1);
marks.set(markName, timestamp());
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
+ if (typeof onProfilerEvent === "function") {
+ onProfilerEvent(markName);
+ }
}
}
function measure(measureName, startMarkName, endMarkName) {
@@ -6758,13 +6672,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -7566,7 +7481,7 @@ var PollingInterval = /* @__PURE__ */ ((PollingInterval3) => {
PollingInterval3[PollingInterval3["Low"] = 250] = "Low";
return PollingInterval3;
})(PollingInterval || {});
-var missingFileModifiedTime = new Date(0);
+var missingFileModifiedTime = /* @__PURE__ */ new Date(0);
function getModifiedTime(host, fileName) {
return host.getModifiedTime(fileName) || missingFileModifiedTime;
}
@@ -7791,7 +7706,7 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
const watcher = fsWatch(
dirName,
- FileSystemEntryKind.Directory,
+ 1 /* Directory */,
(_eventName, relativeFileName, modifiedTime) => {
if (!isString(relativeFileName))
return;
@@ -7991,7 +7906,7 @@ function createDirectoryWatcherSupportingRecursive({
}
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
const parentWatcher = cache.get(dirPath);
- if (parentWatcher && fileSystemEntryExists(dirName, FileSystemEntryKind.Directory)) {
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
return;
}
@@ -8056,7 +7971,7 @@ function createDirectoryWatcherSupportingRecursive({
return false;
let newChildWatches;
const hasChanges = enumerateInsertsAndDeletes(
- fileSystemEntryExists(parentDir, FileSystemEntryKind.Directory) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
+ fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
const childFullName = getNormalizedAbsolutePath(child, parentDir);
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
}) : emptyArray,
@@ -8661,7 +8576,7 @@ var sys = (() => {
if (!err) {
try {
if ((_a2 = statSync(profilePath)) == null ? void 0 : _a2.isDirectory()) {
- profilePath = _path.join(profilePath, `${new Date().toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
+ profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
}
} catch (e) {
}
@@ -9602,7 +9517,6 @@ var Diagnostics = {
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* 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."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* 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}')'?"),
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* 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'."),
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -9731,6 +9645,7 @@ var Diagnostics = {
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, 3 /* Message */, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),
_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
+ Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -10124,7 +10039,6 @@ var Diagnostics = {
Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -10248,7 +10162,7 @@ var Diagnostics = {
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -10440,13 +10354,11 @@ var Diagnostics = {
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
- Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
+ Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
- Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
- Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
- Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify 'ignoreDeprecations: "{2}"' to silence this error.`),
+ Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
@@ -10534,7 +10446,7 @@ var Diagnostics = {
Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
- File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
+ File_0_exists_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exists_use_it_as_a_name_resolution_result_6097", "File '{0}' exists - use it as a name resolution result."),
Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
@@ -10824,6 +10736,11 @@ var Diagnostics = {
Use_the_package_json_imports_field_when_resolving_imports: diag(6409, 3 /* Message */, "Use_the_package_json_imports_field_when_resolving_imports_6409", "Use the package.json 'imports' field when resolving imports."),
Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -10985,6 +10902,7 @@ var Diagnostics = {
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
+ This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
@@ -11082,7 +11000,7 @@ var Diagnostics = {
You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
- Decorators_must_come_after_export_or_export_default_in_JavaScript_files: diag(8038, 1 /* Error */, "Decorators_must_come_after_export_or_export_default_in_JavaScript_files_8038", "Decorators must come after 'export' or 'export default' in JavaScript files."),
+ Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -12032,18 +11950,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
return true;
}
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start2, length2) {
- let text = textInitial;
- let pos;
- let end;
- let startPos;
- let tokenPos;
- let token;
- let tokenValue;
- let tokenFlags;
- let commentDirectives;
- let inJSDocType = 0;
+ var text = textInitial;
+ var pos;
+ var end;
+ var startPos;
+ var tokenPos;
+ var token;
+ var tokenValue;
+ var tokenFlags;
+ var commentDirectives;
+ var inJSDocType = 0;
setText(text, start2, length2);
- const scanner2 = {
+ var scanner2 = {
getStartPos: () => startPos,
getTextPos: () => pos,
getToken: () => token,
@@ -15053,7 +14971,7 @@ function isTransientSymbol(symbol) {
}
var stringWriter = createSingleLineStringWriter();
function createSingleLineStringWriter() {
- let str = "";
+ var str = "";
const writeText = (text) => str += text;
return {
getText: () => str,
@@ -15274,6 +15192,36 @@ function nodeIsMissing(node) {
function nodeIsPresent(node) {
return !nodeIsMissing(node);
}
+function isGrammarError(parent2, child) {
+ if (isTypeParameterDeclaration(parent2))
+ return child === parent2.expression;
+ if (isClassStaticBlockDeclaration(parent2))
+ return child === parent2.modifiers;
+ if (isPropertySignature(parent2))
+ return child === parent2.initializer;
+ if (isPropertyDeclaration(parent2))
+ return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
+ if (isPropertyAssignment(parent2))
+ return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ if (isShorthandPropertyAssignment(parent2))
+ return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ if (isMethodDeclaration(parent2))
+ return child === parent2.exclamationToken;
+ if (isConstructorDeclaration(parent2))
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isGetAccessorDeclaration(parent2))
+ return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isSetAccessorDeclaration(parent2))
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isNamespaceExportDeclaration(parent2))
+ return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ return false;
+}
+function isGrammarErrorElement(nodeArray, child, isElement) {
+ if (!nodeArray || isArray(child) || !isElement(child))
+ return false;
+ return contains(nodeArray, child);
+}
function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
if (from === void 0 || from.length === 0)
return to;
@@ -15417,101 +15365,400 @@ function getInternalEmitFlags(node) {
return emitNode && emitNode.internalFlags || 0;
}
function getScriptTargetFeatures() {
- return {
- es2015: {
- Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"],
- RegExp: ["flags", "sticky", "unicode"],
- Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"],
- ArrayConstructor: ["from", "of"],
- ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"],
- NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"],
- Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"],
- Map: ["entries", "keys", "values"],
- Set: ["entries", "keys", "values"],
- Promise: emptyArray,
- PromiseConstructor: ["all", "race", "reject", "resolve"],
- Symbol: ["for", "keyFor"],
- WeakMap: ["entries", "keys", "values"],
- WeakSet: ["entries", "keys", "values"],
- Iterator: emptyArray,
- AsyncIterator: emptyArray,
- String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"],
- StringConstructor: ["fromCodePoint", "raw"]
- },
- es2016: {
- Array: ["includes"]
- },
- es2017: {
- Atomics: emptyArray,
- SharedArrayBuffer: emptyArray,
- String: ["padStart", "padEnd"],
- ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"],
- DateTimeFormat: ["formatToParts"]
- },
- es2018: {
- Promise: ["finally"],
- RegExpMatchArray: ["groups"],
- RegExpExecArray: ["groups"],
- RegExp: ["dotAll"],
- Intl: ["PluralRules"],
- AsyncIterable: emptyArray,
- AsyncIterableIterator: emptyArray,
- AsyncGenerator: emptyArray,
- AsyncGeneratorFunction: emptyArray,
- NumberFormat: ["formatToParts"]
- },
- es2019: {
- Array: ["flat", "flatMap"],
- ObjectConstructor: ["fromEntries"],
- String: ["trimStart", "trimEnd", "trimLeft", "trimRight"],
- Symbol: ["description"]
- },
- es2020: {
- BigInt: emptyArray,
- BigInt64Array: emptyArray,
- BigUint64Array: emptyArray,
- PromiseConstructor: ["allSettled"],
- SymbolConstructor: ["matchAll"],
- String: ["matchAll"],
- DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"],
- RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"]
- },
- es2021: {
- PromiseConstructor: ["any"],
- String: ["replaceAll"]
- },
- es2022: {
- Array: ["at"],
- String: ["at"],
- Int8Array: ["at"],
- Uint8Array: ["at"],
- Uint8ClampedArray: ["at"],
- Int16Array: ["at"],
- Uint16Array: ["at"],
- Int32Array: ["at"],
- Uint32Array: ["at"],
- Float32Array: ["at"],
- Float64Array: ["at"],
- BigInt64Array: ["at"],
- BigUint64Array: ["at"],
- ObjectConstructor: ["hasOwn"],
- Error: ["cause"]
- },
- es2023: {
- Array: ["findLastIndex", "findLast"],
- Int8Array: ["findLastIndex", "findLast"],
- Uint8Array: ["findLastIndex", "findLast"],
- Uint8ClampedArray: ["findLastIndex", "findLast"],
- Int16Array: ["findLastIndex", "findLast"],
- Uint16Array: ["findLastIndex", "findLast"],
- Int32Array: ["findLastIndex", "findLast"],
- Uint32Array: ["findLastIndex", "findLast"],
- Float32Array: ["findLastIndex", "findLast"],
- Float64Array: ["findLastIndex", "findLast"],
- BigInt64Array: ["findLastIndex", "findLast"],
- BigUint64Array: ["findLastIndex", "findLast"]
- }
- };
+ return new Map(Object.entries({
+ Array: new Map(Object.entries({
+ es2015: [
+ "find",
+ "findIndex",
+ "fill",
+ "copyWithin",
+ "entries",
+ "keys",
+ "values"
+ ],
+ es2016: [
+ "includes"
+ ],
+ es2019: [
+ "flat",
+ "flatMap"
+ ],
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Iterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ AsyncIterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ Atomics: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ SharedArrayBuffer: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ AsyncIterable: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncIterableIterator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGenerator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGeneratorFunction: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ RegExp: new Map(Object.entries({
+ es2015: [
+ "flags",
+ "sticky",
+ "unicode"
+ ],
+ es2018: [
+ "dotAll"
+ ]
+ })),
+ Reflect: new Map(Object.entries({
+ es2015: [
+ "apply",
+ "construct",
+ "defineProperty",
+ "deleteProperty",
+ "get",
+ " getOwnPropertyDescriptor",
+ "getPrototypeOf",
+ "has",
+ "isExtensible",
+ "ownKeys",
+ "preventExtensions",
+ "set",
+ "setPrototypeOf"
+ ]
+ })),
+ ArrayConstructor: new Map(Object.entries({
+ es2015: [
+ "from",
+ "of"
+ ]
+ })),
+ ObjectConstructor: new Map(Object.entries({
+ es2015: [
+ "assign",
+ "getOwnPropertySymbols",
+ "keys",
+ "is",
+ "setPrototypeOf"
+ ],
+ es2017: [
+ "values",
+ "entries",
+ "getOwnPropertyDescriptors"
+ ],
+ es2019: [
+ "fromEntries"
+ ],
+ es2022: [
+ "hasOwn"
+ ]
+ })),
+ NumberConstructor: new Map(Object.entries({
+ es2015: [
+ "isFinite",
+ "isInteger",
+ "isNaN",
+ "isSafeInteger",
+ "parseFloat",
+ "parseInt"
+ ]
+ })),
+ Math: new Map(Object.entries({
+ es2015: [
+ "clz32",
+ "imul",
+ "sign",
+ "log10",
+ "log2",
+ "log1p",
+ "expm1",
+ "cosh",
+ "sinh",
+ "tanh",
+ "acosh",
+ "asinh",
+ "atanh",
+ "hypot",
+ "trunc",
+ "fround",
+ "cbrt"
+ ]
+ })),
+ Map: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ Set: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ PromiseConstructor: new Map(Object.entries({
+ es2015: [
+ "all",
+ "race",
+ "reject",
+ "resolve"
+ ],
+ es2020: [
+ "allSettled"
+ ],
+ es2021: [
+ "any"
+ ]
+ })),
+ Symbol: new Map(Object.entries({
+ es2015: [
+ "for",
+ "keyFor"
+ ],
+ es2019: [
+ "description"
+ ]
+ })),
+ WeakMap: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ WeakSet: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ String: new Map(Object.entries({
+ es2015: [
+ "codePointAt",
+ "includes",
+ "endsWith",
+ "normalize",
+ "repeat",
+ "startsWith",
+ "anchor",
+ "big",
+ "blink",
+ "bold",
+ "fixed",
+ "fontcolor",
+ "fontsize",
+ "italics",
+ "link",
+ "small",
+ "strike",
+ "sub",
+ "sup"
+ ],
+ es2017: [
+ "padStart",
+ "padEnd"
+ ],
+ es2019: [
+ "trimStart",
+ "trimEnd",
+ "trimLeft",
+ "trimRight"
+ ],
+ es2020: [
+ "matchAll"
+ ],
+ es2021: [
+ "replaceAll"
+ ],
+ es2022: [
+ "at"
+ ]
+ })),
+ StringConstructor: new Map(Object.entries({
+ es2015: [
+ "fromCodePoint",
+ "raw"
+ ]
+ })),
+ DateTimeFormat: new Map(Object.entries({
+ es2017: [
+ "formatToParts"
+ ]
+ })),
+ Promise: new Map(Object.entries({
+ es2015: emptyArray,
+ es2018: [
+ "finally"
+ ]
+ })),
+ RegExpMatchArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ RegExpExecArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ Intl: new Map(Object.entries({
+ es2018: [
+ "PluralRules"
+ ]
+ })),
+ NumberFormat: new Map(Object.entries({
+ es2018: [
+ "formatToParts"
+ ]
+ })),
+ SymbolConstructor: new Map(Object.entries({
+ es2020: [
+ "matchAll"
+ ]
+ })),
+ DataView: new Map(Object.entries({
+ es2020: [
+ "setBigInt64",
+ "setBigUint64",
+ "getBigInt64",
+ "getBigUint64"
+ ]
+ })),
+ BigInt: new Map(Object.entries({
+ es2020: emptyArray
+ })),
+ RelativeTimeFormat: new Map(Object.entries({
+ es2020: [
+ "format",
+ "formatToParts",
+ "resolvedOptions"
+ ]
+ })),
+ Int8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8ClampedArray: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float64Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigInt64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigUint64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Error: new Map(Object.entries({
+ es2022: [
+ "cause"
+ ]
+ }))
+ }));
}
var GetLiteralTextFlags = /* @__PURE__ */ ((GetLiteralTextFlags2) => {
GetLiteralTextFlags2[GetLiteralTextFlags2["None"] = 0] = "None";
@@ -15630,7 +15877,7 @@ function isCommonJSContainingModuleKind(kind) {
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
}
function isEffectiveExternalModule(node, compilerOptions) {
- return isExternalModule(node) || compilerOptions.isolatedModules || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
+ return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
}
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
switch (node.scriptKind) {
@@ -15651,7 +15898,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
if (startsWithUseStrict(node.statements)) {
return true;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
return true;
}
@@ -18267,12 +18514,12 @@ function isNightly() {
return stringContains(version, "-dev") || stringContains(version, "-insiders");
}
function createTextWriter(newLine) {
- let output;
- let indent3;
- let lineStart;
- let lineCount;
- let linePos;
- let hasTrailingComment = false;
+ var output;
+ var indent3;
+ var lineStart;
+ var lineCount;
+ var linePos;
+ var hasTrailingComment = false;
function updateLineCountAndPosFor(s) {
const lineStartsOfS = computeLineStarts(s);
if (lineStartsOfS.length > 1) {
@@ -19398,17 +19645,11 @@ function getCombinedLocalAndExportSymbolFlags(symbol) {
return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
}
function isWriteOnlyAccess(node) {
- return accessKind(node) === AccessKind.Write;
+ return accessKind(node) === 1 /* Write */;
}
function isWriteAccess(node) {
- return accessKind(node) !== AccessKind.Read;
-}
-var AccessKind = /* @__PURE__ */ ((AccessKind2) => {
- AccessKind2[AccessKind2["Read"] = 0] = "Read";
- AccessKind2[AccessKind2["Write"] = 1] = "Write";
- AccessKind2[AccessKind2["ReadWrite"] = 2] = "ReadWrite";
- return AccessKind2;
-})(AccessKind || {});
+ return accessKind(node) !== 0 /* Read */;
+}
function accessKind(node) {
const { parent: parent2 } = node;
if (!parent2)
@@ -19508,9 +19749,6 @@ function getClassLikeDeclarationOfSymbol(symbol) {
function getObjectFlags(type) {
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
}
-function typeHasCallOrConstructSignatures(type, checker) {
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
-}
function forSomeAncestorDirectory(directory, callback) {
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
}
@@ -20088,7 +20326,7 @@ function getEmitDeclarations(compilerOptions) {
return !!(compilerOptions.declaration || compilerOptions.composite);
}
function shouldPreserveConstEnums(compilerOptions) {
- return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
+ return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
}
function isIncrementalCompilation(options) {
return !!(options.incremental || options.composite);
@@ -20676,7 +20914,7 @@ function rangeOfNode(node) {
}
function rangeOfTypeParameters(sourceFile, typeParameters) {
const pos = typeParameters.pos - 1;
- const end = skipTrivia(sourceFile.text, typeParameters.end) + 1;
+ const end = Math.min(sourceFile.text.length, skipTrivia(sourceFile.text, typeParameters.end) + 1);
return { pos, end };
}
function skipTypeChecking(sourceFile, options, host) {
@@ -23746,24 +23984,7 @@ function createNodeFactory(flags, baseFactory2) {
return node;
}
function propagateAssignmentPatternFlags(node) {
- if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
- return 65536 /* ContainsObjectRestOrSpread */;
- if (node.transformFlags & 128 /* ContainsES2018 */) {
- for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
- const target = getTargetOfBindingOrAssignmentElement(element);
- if (target && isAssignmentPattern(target)) {
- if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
- return 65536 /* ContainsObjectRestOrSpread */;
- }
- if (target.transformFlags & 128 /* ContainsES2018 */) {
- const flags2 = propagateAssignmentPatternFlags(target);
- if (flags2)
- return flags2;
- }
- }
- }
- }
- return 0 /* None */;
+ return containsObjectRestOrSpread(node) ? 65536 /* ContainsObjectRestOrSpread */ : 0 /* None */;
}
function updateBinaryExpression(node, left, operator, right) {
return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node;
@@ -26771,14 +26992,114 @@ function createEmitHelperFactory(context) {
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name)
]);
}
+ function createESDecorateClassElementAccessGetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "get",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ accessor
+ )
+ );
+ }
+ function createESDecorateClassElementAccessSetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "set",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ ),
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("value")
+ )
+ ],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBlock([
+ factory2.createExpressionStatement(
+ factory2.createAssignment(
+ accessor,
+ factory2.createIdentifier("value")
+ )
+ )
+ ])
+ )
+ );
+ }
+ function createESDecorateClassElementAccessHasMethod(elementName) {
+ const propertyName = elementName.computed ? elementName.name : isIdentifier(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name;
+ return factory2.createPropertyAssignment(
+ "has",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBinaryExpression(
+ propertyName,
+ 101 /* InKeyword */,
+ factory2.createIdentifier("obj")
+ )
+ )
+ );
+ }
+ function createESDecorateClassElementAccessObject(name, access) {
+ const properties = [];
+ properties.push(createESDecorateClassElementAccessHasMethod(name));
+ if (access.get)
+ properties.push(createESDecorateClassElementAccessGetMethod(name));
+ if (access.set)
+ properties.push(createESDecorateClassElementAccessSetMethod(name));
+ return factory2.createObjectLiteralExpression(properties);
+ }
function createESDecorateClassElementContextObject(contextIn) {
return factory2.createObjectLiteralExpression([
factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral(contextIn.kind)),
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory2.createStringLiteralFromNode(contextIn.name.name)),
factory2.createPropertyAssignment(factory2.createIdentifier("static"), contextIn.static ? factory2.createTrue() : factory2.createFalse()),
- factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse())
- // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494
- // factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
+ factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse()),
+ factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
]);
}
function createESDecorateContextObject(contextIn) {
@@ -28968,7 +29289,7 @@ function canHaveIllegalDecorators(node) {
}
function canHaveIllegalModifiers(node) {
const kind = node.kind;
- return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 181 /* FunctionType */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
+ return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
}
function isQuestionOrExclamationToken(node) {
return isQuestionToken(node) || isExclamationToken(node);
@@ -29341,6 +29662,25 @@ function flattenCommaList(node) {
flattenCommaListWorker(node, expressions);
return expressions;
}
+function containsObjectRestOrSpread(node) {
+ if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
+ return true;
+ if (node.transformFlags & 128 /* ContainsES2018 */) {
+ for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
+ const target = getTargetOfBindingOrAssignmentElement(element);
+ if (target && isAssignmentPattern(target)) {
+ if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ return true;
+ }
+ if (target.transformFlags & 128 /* ContainsES2018 */) {
+ if (containsObjectRestOrSpread(target))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
// src/compiler/factory/utilitiesPublic.ts
function setTextRange(range, location) {
@@ -30011,22 +30351,22 @@ function parseJSDocTypeExpressionForTests(content, start2, length2) {
}
var Parser;
((Parser2) => {
- const scanner2 = createScanner(
+ var scanner2 = createScanner(
99 /* Latest */,
/*skipTrivia*/
true
);
- const disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
- let NodeConstructor2;
- let TokenConstructor2;
- let IdentifierConstructor2;
- let PrivateIdentifierConstructor2;
- let SourceFileConstructor2;
+ var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
+ var NodeConstructor2;
+ var TokenConstructor2;
+ var IdentifierConstructor2;
+ var PrivateIdentifierConstructor2;
+ var SourceFileConstructor2;
function countNode(node) {
nodeCount++;
return node;
}
- const baseNodeFactory = {
+ var baseNodeFactory = {
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
kind,
/*pos*/
@@ -30063,25 +30403,53 @@ var Parser;
0
))
};
- const factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
- let fileName;
- let sourceFlags;
- let sourceText;
- let languageVersion;
- let scriptKind;
- let languageVariant;
- let parseDiagnostics;
- let jsDocDiagnostics;
- let syntaxCursor;
- let currentToken;
- let nodeCount;
- let identifiers;
- let identifierCount;
- let parsingContext;
- let notParenthesizedArrow;
- let contextFlags;
- let topLevel = true;
- let parseErrorBeforeNextFinishedNode = false;
+ var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
+ var {
+ createNodeArray: factoryCreateNodeArray,
+ createNumericLiteral: factoryCreateNumericLiteral,
+ createStringLiteral: factoryCreateStringLiteral,
+ createLiteralLikeNode: factoryCreateLiteralLikeNode,
+ createIdentifier: factoryCreateIdentifier,
+ createPrivateIdentifier: factoryCreatePrivateIdentifier,
+ createToken: factoryCreateToken,
+ createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
+ createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
+ createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
+ createPropertyAccessChain: factoryCreatePropertyAccessChain,
+ createElementAccessExpression: factoryCreateElementAccessExpression,
+ createElementAccessChain: factoryCreateElementAccessChain,
+ createCallExpression: factoryCreateCallExpression,
+ createCallChain: factoryCreateCallChain,
+ createNewExpression: factoryCreateNewExpression,
+ createParenthesizedExpression: factoryCreateParenthesizedExpression,
+ createBlock: factoryCreateBlock,
+ createVariableStatement: factoryCreateVariableStatement,
+ createExpressionStatement: factoryCreateExpressionStatement,
+ createIfStatement: factoryCreateIfStatement,
+ createWhileStatement: factoryCreateWhileStatement,
+ createForStatement: factoryCreateForStatement,
+ createForOfStatement: factoryCreateForOfStatement,
+ createVariableDeclaration: factoryCreateVariableDeclaration,
+ createVariableDeclarationList: factoryCreateVariableDeclarationList
+ } = factory2;
+ var fileName;
+ var sourceFlags;
+ var sourceText;
+ var languageVersion;
+ var scriptKind;
+ var languageVariant;
+ var parseDiagnostics;
+ var jsDocDiagnostics;
+ var syntaxCursor;
+ var currentToken;
+ var nodeCount;
+ var identifiers;
+ var identifierCount;
+ var parsingContext;
+ var notParenthesizedArrow;
+ var contextFlags;
+ var topLevel = true;
+ var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
var _a2;
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
@@ -30181,8 +30549,8 @@ var Parser;
}
}
}
- const expression = isArray(expressions) ? finishNode(factory2.createArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
- const statement = factory2.createExpressionStatement(expression);
+ const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
+ const statement = factoryCreateExpressionStatement(expression);
finishNode(statement, pos);
statements = createNodeArray([statement], pos);
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
@@ -30274,7 +30642,7 @@ var Parser;
}
sourceFlags = contextFlags;
nextToken();
- const statements = parseList(ParsingContext.SourceElements, parseStatement);
+ const statements = parseList(0 /* SourceElements */, parseStatement);
Debug.assert(token() === 1 /* EndOfFileToken */);
const endOfFileToken = addJSDocComment(parseTokenNode());
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
@@ -30337,7 +30705,7 @@ var Parser;
nextToken();
while (token() !== 1 /* EndOfFileToken */) {
const startPos = scanner2.getStartPos();
- const statement = parseListElement(ParsingContext.SourceElements, parseStatement);
+ const statement = parseListElement(0 /* SourceElements */, parseStatement);
statements.push(statement);
if (startPos === scanner2.getStartPos()) {
nextToken();
@@ -30365,7 +30733,7 @@ var Parser;
}
}
syntaxCursor = savedSyntaxCursor;
- return factory2.updateSourceFile(sourceFile, setTextRange(factory2.createNodeArray(statements), sourceFile.statements));
+ return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
function containsPossibleTopLevelAwait(node) {
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
}
@@ -30806,13 +31174,13 @@ var Parser;
const pos = getNodePos();
const kind = token();
nextToken();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseTokenNodeJSDoc() {
const pos = getNodePos();
const kind = token();
nextTokenJSDoc();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function canParseSemicolon() {
if (token() === 26 /* SemicolonToken */) {
@@ -30833,7 +31201,7 @@ var Parser;
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
}
function createNodeArray(elements, pos, end, hasTrailingComma) {
- const array = factory2.createNodeArray(elements, hasTrailingComma);
+ const array = factoryCreateNodeArray(elements, hasTrailingComma);
setTextRangePosEnd(array, pos, end != null ? end : scanner2.getStartPos());
return array;
}
@@ -30855,7 +31223,7 @@ var Parser;
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
const pos = getNodePos();
- const result = kind === 79 /* Identifier */ ? factory2.createIdentifier(
+ const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
"",
/*originalKeywordKind*/
void 0
@@ -30865,15 +31233,15 @@ var Parser;
"",
/*templateFlags*/
void 0
- ) : kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(
+ ) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
"",
/*numericLiteralFlags*/
void 0
- ) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ ) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
"",
/*isSingleQuote*/
void 0
- ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factory2.createToken(kind);
+ ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
return finishNode(result, pos);
}
function internIdentifier(text) {
@@ -30891,7 +31259,7 @@ var Parser;
const text = internIdentifier(scanner2.getTokenValue());
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
nextTokenWithoutCheck();
- return finishNode(factory2.createIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
+ return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
}
if (token() === 80 /* PrivateIdentifier */) {
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -30962,7 +31330,7 @@ var Parser;
}
function parsePrivateIdentifier() {
const pos = getNodePos();
- const node = factory2.createPrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
+ const node = factoryCreatePrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
nextToken();
return finishNode(node, pos);
}
@@ -30991,7 +31359,6 @@ var Parser;
return canFollowExportModifier();
case 88 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 127 /* AccessorKeyword */:
case 124 /* StaticKeyword */:
case 137 /* GetKeyword */:
case 151 /* SetKeyword */:
@@ -31024,19 +31391,19 @@ var Parser;
return true;
}
switch (parsingContext2) {
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return lookAhead(isClassMemberStart) || token() === 26 /* SemicolonToken */ && !inErrorRecovery;
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return token() === 22 /* OpenBracketToken */ || isLiteralPropertyName();
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
switch (token()) {
case 22 /* OpenBracketToken */:
case 41 /* AsteriskToken */:
@@ -31046,13 +31413,13 @@ var Parser;
default:
return isLiteralPropertyName();
}
- case ParsingContext.RestProperties:
+ case 18 /* RestProperties */:
return isLiteralPropertyName();
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return token() === 22 /* OpenBracketToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName();
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return isAssertionKey2();
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
if (token() === 18 /* OpenBraceToken */) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
@@ -31061,40 +31428,40 @@ var Parser;
} else {
return isIdentifier2() && !isHeritageClauseExtendsOrImplementsKeyword();
}
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
switch (token()) {
case 27 /* CommaToken */:
case 24 /* DotToken */:
return true;
}
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 25 /* DotDotDotToken */ || isStartOfExpression();
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isStartOfParameter(
/*isJSDocParameter*/
false
);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return isStartOfParameter(
/*isJSDocParameter*/
true
);
- case ParsingContext.TypeArguments:
- case ParsingContext.TupleElementTypes:
+ case 20 /* TypeArguments */:
+ case 21 /* TupleElementTypes */:
return token() === 27 /* CommaToken */ || isStartOfType();
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return isHeritageClause2();
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return tokenIsIdentifierOrKeyword(token());
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return true;
}
return Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -31138,41 +31505,41 @@ var Parser;
return true;
}
switch (kind) {
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauses:
- case ParsingContext.TypeMembers:
- case ParsingContext.ClassMembers:
- case ParsingContext.EnumMembers:
- case ParsingContext.ObjectLiteralMembers:
- case ParsingContext.ObjectBindingElements:
- case ParsingContext.ImportOrExportSpecifiers:
- case ParsingContext.AssertEntries:
+ case 1 /* BlockStatements */:
+ case 2 /* SwitchClauses */:
+ case 4 /* TypeMembers */:
+ case 5 /* ClassMembers */:
+ case 6 /* EnumMembers */:
+ case 12 /* ObjectLiteralMembers */:
+ case 9 /* ObjectBindingElements */:
+ case 23 /* ImportOrExportSpecifiers */:
+ case 24 /* AssertEntries */:
return token() === 19 /* CloseBraceToken */;
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return token() === 19 /* CloseBraceToken */ || token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 31 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
- case ParsingContext.ArrayLiteralMembers:
- case ParsingContext.TupleElementTypes:
- case ParsingContext.ArrayBindingElements:
+ case 15 /* ArrayLiteralMembers */:
+ case 21 /* TupleElementTypes */:
+ case 10 /* ArrayBindingElements */:
return token() === 23 /* CloseBracketToken */;
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
- case ParsingContext.RestProperties:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
+ case 18 /* RestProperties */:
return token() === 21 /* CloseParenToken */ || token() === 23 /* CloseBracketToken */;
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return token() !== 27 /* CommaToken */;
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return token() === 18 /* OpenBraceToken */ || token() === 19 /* CloseBraceToken */;
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return token() === 31 /* GreaterThanToken */ || token() === 43 /* SlashToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
default:
return false;
@@ -31191,7 +31558,7 @@ var Parser;
return false;
}
function isInSomeParsingContext() {
- for (let kind = 0; kind < ParsingContext.Count; kind++) {
+ for (let kind = 0; kind < 25 /* Count */; kind++) {
if (parsingContext & 1 << kind) {
if (isListElement2(
kind,
@@ -31260,38 +31627,38 @@ var Parser;
}
function isReusableParsingContext(parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
- case ParsingContext.SwitchClauses:
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
- case ParsingContext.EnumMembers:
- case ParsingContext.TypeMembers:
- case ParsingContext.VariableDeclarations:
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 5 /* ClassMembers */:
+ case 2 /* SwitchClauses */:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
+ case 6 /* EnumMembers */:
+ case 4 /* TypeMembers */:
+ case 8 /* VariableDeclarations */:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return true;
}
return false;
}
function canReuseNode(node, parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return isReusableClassMember(node);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return isReusableSwitchClause(node);
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return isReusableStatement(node);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return isReusableEnumMember(node);
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return isReusableTypeMember(node);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isReusableVariableDeclaration(node);
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return isReusableParameter(node);
}
return false;
@@ -31401,56 +31768,56 @@ var Parser;
}
function parsingContextErrors(context) {
switch (context) {
- case ParsingContext.SourceElements:
+ case 0 /* SourceElements */:
return token() === 88 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(93 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.BlockStatements:
+ case 1 /* BlockStatements */:
return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return parseErrorAtCurrentToken(Diagnostics.case_or_default_expected);
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
- case ParsingContext.RestProperties:
- case ParsingContext.TypeMembers:
+ case 18 /* RestProperties */:
+ case 4 /* TypeMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return parseErrorAtCurrentToken(Diagnostics.Enum_member_expected);
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return parseErrorAtCurrentToken(Diagnostics.Expression_expected);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Variable_declaration_expected);
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Property_destructuring_pattern_expected);
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Array_element_destructuring_pattern_expected);
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return parseErrorAtCurrentToken(Diagnostics.Argument_expression_expected);
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
- case ParsingContext.TupleElementTypes:
+ case 21 /* TupleElementTypes */:
return parseErrorAtCurrentToken(Diagnostics.Type_expected);
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_expected);
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
- case ParsingContext.Count:
+ case 25 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(context);
@@ -31509,7 +31876,7 @@ var Parser;
);
}
function getExpectedCommaDiagnostic(kind) {
- return kind === ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
+ return kind === 6 /* EnumMembers */ ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
}
function createMissingList() {
const list = createNodeArray([], getNodePos());
@@ -31678,12 +32045,12 @@ var Parser;
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
// We also do not need to check for negatives because any prefix operator would be part of a
// parent unary expression.
- kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
scanner2.getTokenValue(),
/*isSingleQuote*/
void 0,
scanner2.hasExtendedUnicodeEscape()
- ) : isLiteralKind(kind) ? factory2.createLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
+ ) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
);
if (scanner2.hasExtendedUnicodeEscape()) {
node.hasExtendedUnicodeEscape = true;
@@ -31703,7 +32070,7 @@ var Parser;
}
function parseTypeArgumentsOfTypeReference() {
if (!scanner2.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function parseTypeReference() {
@@ -31885,7 +32252,7 @@ var Parser;
}
function parseTypeParameters() {
if (token() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeParameters, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function isStartOfParameter(isJSDocParameter) {
@@ -31991,7 +32358,7 @@ var Parser;
const savedAwaitContext = inAwaitContext();
setYieldContext(!!(flags & 1 /* Yield */));
setAwaitContext(!!(flags & 2 /* Await */));
- const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
+ const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) : parseDelimitedList(16 /* Parameters */, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
return parameters;
@@ -32059,7 +32426,7 @@ var Parser;
return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers) {
- const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(
+ const parameters = parseBracketedList(16 /* Parameters */, () => parseParameter(
/*inOuterAwaitContext*/
false
), 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
@@ -32158,7 +32525,7 @@ var Parser;
function parseObjectTypeMembers() {
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -32212,7 +32579,7 @@ var Parser;
}
const type = parseTypeAnnotation();
parseSemicolon();
- const members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ const members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
}
@@ -32257,7 +32624,7 @@ var Parser;
const pos = getNodePos();
return finishNode(
factory2.createTupleTypeNode(
- parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
+ parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
),
pos
);
@@ -32274,7 +32641,7 @@ var Parser;
if (token() === 126 /* AbstractKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(126 /* AbstractKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -32284,6 +32651,7 @@ var Parser;
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiersForConstructorType();
const isConstructorType = parseOptional(103 /* NewKeyword */);
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
const typeParameters = parseTypeParameters();
const parameters = parseParameters(4 /* Type */);
const type = parseReturnType(
@@ -32292,8 +32660,6 @@ var Parser;
false
);
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
- if (!isConstructorType)
- node.modifiers = modifiers;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseKeywordAndNoDot() {
@@ -32885,10 +33251,10 @@ var Parser;
}
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
const triState = isParenthesizedArrowFunctionExpression();
- if (triState === Tristate.False) {
+ if (triState === 0 /* False */) {
return void 0;
}
- return triState === Tristate.True ? parseParenthesizedArrowFunctionExpression(
+ return triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpression(
/*allowAmbiguity*/
true,
/*allowReturnTypeInArrowFunction*/
@@ -32900,18 +33266,18 @@ var Parser;
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner2.hasPrecedingLineBreak()) {
- return Tristate.False;
+ return 0 /* False */;
}
if (token() !== 20 /* OpenParenToken */ && token() !== 29 /* LessThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
}
const first2 = token();
@@ -32923,45 +33289,45 @@ var Parser;
case 38 /* EqualsGreaterThanToken */:
case 58 /* ColonToken */:
case 18 /* OpenBraceToken */:
- return Tristate.True;
+ return 1 /* True */;
default:
- return Tristate.False;
+ return 0 /* False */;
}
}
if (second === 22 /* OpenBracketToken */ || second === 18 /* OpenBraceToken */) {
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
if (second === 25 /* DotDotDotToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
if (isModifierKind(second) && second !== 132 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
if (nextToken() === 128 /* AsKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.True;
+ return 1 /* True */;
}
if (!isIdentifier2() && second !== 108 /* ThisKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
switch (nextToken()) {
case 58 /* ColonToken */:
- return Tristate.True;
+ return 1 /* True */;
case 57 /* QuestionToken */:
nextToken();
if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 63 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
case 27 /* CommaToken */:
case 63 /* EqualsToken */:
case 21 /* CloseParenToken */:
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
- return Tristate.False;
+ return 0 /* False */;
} else {
Debug.assert(first2 === 29 /* LessThanToken */);
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
if (languageVariant === 1 /* JSX */) {
const isArrowFunctionInJsx = lookAhead(() => {
@@ -32972,6 +33338,7 @@ var Parser;
switch (fourth) {
case 63 /* EqualsToken */:
case 31 /* GreaterThanToken */:
+ case 43 /* SlashToken */:
return false;
default:
return true;
@@ -32982,11 +33349,11 @@ var Parser;
return false;
});
if (isArrowFunctionInJsx) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
}
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
@@ -33006,7 +33373,7 @@ var Parser;
}
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) {
if (token() === 132 /* AsyncKeyword */) {
- if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === Tristate.True) {
+ if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
const pos = getNodePos();
const asyncModifier = parseModifiersForArrowFunction();
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
@@ -33019,14 +33386,14 @@ var Parser;
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner2.hasPrecedingLineBreak() || token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
if (!scanner2.hasPrecedingLineBreak() && expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
}
- return Tristate.False;
+ return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) {
const pos = getNodePos();
@@ -33231,6 +33598,12 @@ var Parser;
case 114 /* VoidKeyword */:
return parseVoidExpression();
case 29 /* LessThanToken */:
+ if (languageVariant === 1 /* JSX */) {
+ return parseJsxElementOrSelfClosingElementOrFragment(
+ /*inExpressionContext*/
+ true
+ );
+ }
return parseTypeAssertion();
case 133 /* AwaitKeyword */:
if (isAwaitExpression2()) {
@@ -33325,7 +33698,7 @@ var Parser;
return expression;
}
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
- return finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -33346,7 +33719,7 @@ var Parser;
factory2.createJsxElement(
lastChild.openingElement,
lastChild.children,
- finishNode(factory2.createJsxClosingElement(finishNode(factory2.createIdentifier(""), end, end)), end, end)
+ finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
),
lastChild.openingElement.pos,
end
@@ -33434,7 +33807,7 @@ var Parser;
const list = [];
const listPos = getNodePos();
const saveParsingContext = parsingContext;
- parsingContext |= 1 << ParsingContext.JsxChildren;
+ parsingContext |= 1 << 14 /* JsxChildren */;
while (true) {
const child = parseJsxChild(openingTag, currentToken = scanner2.reScanJsxToken());
if (!child)
@@ -33449,7 +33822,7 @@ var Parser;
}
function parseJsxAttributes() {
const pos = getNodePos();
- return finishNode(factory2.createJsxAttributes(parseList(ParsingContext.JsxAttributes, parseJsxAttribute)), pos);
+ return finishNode(factory2.createJsxAttributes(parseList(13 /* JsxAttributes */, parseJsxAttribute)), pos);
}
function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
const pos = getNodePos();
@@ -33489,7 +33862,7 @@ var Parser;
scanJsxIdentifier();
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- expression = finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -33583,13 +33956,9 @@ var Parser;
function parseJsxClosingFragment(inExpressionContext) {
const pos = getNodePos();
parseExpected(30 /* LessThanSlashToken */);
- if (tokenIsIdentifierOrKeyword(token())) {
- parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
- }
if (parseExpected(
31 /* GreaterThanToken */,
- /*diagnostic*/
- void 0,
+ Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
/*shouldAdvance*/
false
)) {
@@ -33602,6 +33971,7 @@ var Parser;
return finishNode(factory2.createJsxJsxClosingFragment(), pos);
}
function parseTypeAssertion() {
+ Debug.assert(languageVariant !== 1 /* JSX */, "Type assertions should never be parsed in JSX; they should be parsed as comparisons or JSX elements/fragments.");
const pos = getNodePos();
parseExpected(29 /* LessThanToken */);
const type = parseType();
@@ -33643,7 +34013,7 @@ var Parser;
true
);
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
- const propertyAccess = isOptionalChain2 ? factory2.createPropertyAccessChain(expression, questionDotToken, name) : factory2.createPropertyAccessExpression(expression, name);
+ const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
}
@@ -33671,7 +34041,7 @@ var Parser;
argumentExpression = argument;
}
parseExpected(23 /* CloseBracketToken */);
- const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createElementAccessChain(expression, questionDotToken, argumentExpression) : factory2.createElementAccessExpression(expression, argumentExpression);
+ const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
return finishNode(indexedAccess, pos);
}
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
@@ -33758,7 +34128,7 @@ var Parser;
expression = expression.expression;
}
const argumentList = parseArgumentList();
- const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createCallChain(expression, questionDotToken, typeArguments, argumentList) : factory2.createCallExpression(expression, typeArguments, argumentList);
+ const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
}
@@ -33769,7 +34139,7 @@ var Parser;
false,
Diagnostics.Identifier_expected
);
- expression = finishNode(factory2.createPropertyAccessChain(expression, questionDotToken, name), pos);
+ expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
}
@@ -33777,7 +34147,7 @@ var Parser;
}
function parseArgumentList() {
parseExpected(20 /* OpenParenToken */);
- const result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression);
+ const result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);
parseExpected(21 /* CloseParenToken */);
return result;
}
@@ -33789,7 +34159,7 @@ var Parser;
return void 0;
}
nextToken();
- const typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType);
+ const typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
return void 0;
}
@@ -33864,7 +34234,7 @@ var Parser;
parseExpected(20 /* OpenParenToken */);
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- return withJSDoc(finishNode(factory2.createParenthesizedExpression(expression), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
}
function parseSpreadElement() {
const pos = getNodePos();
@@ -33889,9 +34259,9 @@ var Parser;
const openBracketPosition = scanner2.getTokenPos();
const openBracketParsed = parseExpected(22 /* OpenBracketToken */);
const multiLine = scanner2.hasPrecedingLineBreak();
- const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
+ const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
- return finishNode(factory2.createArrayLiteralExpression(elements, multiLine), pos);
+ return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
}
function parseObjectLiteralElement() {
const pos = getNodePos();
@@ -33950,13 +34320,13 @@ var Parser;
const openBraceParsed = parseExpected(18 /* OpenBraceToken */);
const multiLine = scanner2.hasPrecedingLineBreak();
const properties = parseDelimitedList(
- ParsingContext.ObjectLiteralMembers,
+ 12 /* ObjectLiteralMembers */,
parseObjectLiteralElement,
/*considerSemicolonAsDelimiter*/
true
);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- return finishNode(factory2.createObjectLiteralExpression(properties, multiLine), pos);
+ return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
}
function parseFunctionExpression() {
const savedDecoratorContext = inDecoratorContext();
@@ -34013,7 +34383,7 @@ var Parser;
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
}
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
- return finishNode(factory2.createNewExpression(expression, typeArguments, argumentList), pos);
+ return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
const pos = getNodePos();
@@ -34022,17 +34392,17 @@ var Parser;
const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
if (openBraceParsed || ignoreMissingOpenBrace) {
const multiLine = scanner2.hasPrecedingLineBreak();
- const statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ const statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
+ const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
if (token() === 63 /* EqualsToken */) {
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
nextToken();
}
return result;
} else {
const statements = createMissingList();
- return withJSDoc(finishNode(factory2.createBlock(
+ return withJSDoc(finishNode(factoryCreateBlock(
statements,
/*multiLine*/
void 0
@@ -34081,7 +34451,7 @@ var Parser;
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const thenStatement = parseStatement();
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
- return withJSDoc(finishNode(factory2.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
}
function parseDoStatement() {
const pos = getNodePos();
@@ -34105,7 +34475,7 @@ var Parser;
const expression = allowInAnd(parseExpression);
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const statement = parseStatement();
- return withJSDoc(finishNode(factory2.createWhileStatement(expression, statement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
}
function parseForOrForInOrForOfStatement() {
const pos = getNodePos();
@@ -34131,7 +34501,7 @@ var Parser;
true
));
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForOfStatement(awaitToken, initializer, expression, parseStatement());
+ node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
} else if (parseOptional(101 /* InKeyword */)) {
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -34142,7 +34512,7 @@ var Parser;
parseExpected(26 /* SemicolonToken */);
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForStatement(initializer, condition, incrementor, parseStatement());
+ node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
}
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -34180,14 +34550,14 @@ var Parser;
parseExpected(82 /* CaseKeyword */);
const expression = allowInAnd(parseExpression);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return withJSDoc(finishNode(factory2.createCaseClause(expression, statements), pos), hasJSDoc);
}
function parseDefaultClause() {
const pos = getNodePos();
parseExpected(88 /* DefaultKeyword */);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(factory2.createDefaultClause(statements), pos);
}
function parseCaseOrDefaultClause() {
@@ -34196,7 +34566,7 @@ var Parser;
function parseCaseBlock() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const clauses = parseList(ParsingContext.SwitchClauses, parseCaseOrDefaultClause);
+ const clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createCaseBlock(clauses), pos);
}
@@ -34217,7 +34587,7 @@ var Parser;
let expression = scanner2.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
if (expression === void 0) {
identifierCount++;
- expression = finishNode(factory2.createIdentifier(""), getNodePos());
+ expression = finishNode(factoryCreateIdentifier(""), getNodePos());
}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
@@ -34278,7 +34648,7 @@ var Parser;
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
}
- node = factory2.createExpressionStatement(expression);
+ node = factoryCreateExpressionStatement(expression);
if (hasParen) {
hasJSDoc = false;
}
@@ -34637,14 +35007,14 @@ var Parser;
function parseObjectBindingPattern() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement);
+ const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createObjectBindingPattern(elements), pos);
}
function parseArrayBindingPattern() {
const pos = getNodePos();
parseExpected(22 /* OpenBracketToken */);
- const elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement);
+ const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
return finishNode(factory2.createArrayBindingPattern(elements), pos);
}
@@ -34676,7 +35046,7 @@ var Parser;
}
const type = parseTypeAnnotation();
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
- const node = factory2.createVariableDeclaration(name, exclamationToken, type, initializer);
+ const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseVariableDeclarationList(inForStatementInitializer) {
@@ -34702,12 +35072,12 @@ var Parser;
const savedDisallowIn = inDisallowInContext();
setDisallowInContext(inForStatementInitializer);
declarations = parseDelimitedList(
- ParsingContext.VariableDeclarations,
+ 8 /* VariableDeclarations */,
inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation
);
setDisallowInContext(savedDisallowIn);
}
- return finishNode(factory2.createVariableDeclarationList(declarations, flags), pos);
+ return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
}
function canFollowContextualOfKeyword() {
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
@@ -34718,7 +35088,7 @@ var Parser;
false
);
parseSemicolon();
- const node = factory2.createVariableStatement(modifiers, declarationList);
+ const node = factoryCreateVariableStatement(modifiers, declarationList);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
@@ -34947,22 +35317,30 @@ var Parser;
return void 0;
}
}
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
const pos = getNodePos();
let list;
- let modifier, hasSeenStaticModifier = false;
+ let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false;
+ if (allowDecorators && token() === 59 /* AtToken */) {
+ while (decorator = tryParseDecorator()) {
+ list = append(list, decorator);
+ }
+ }
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
list = append(list, modifier);
+ hasLeadingModifier = true;
}
- if (allowDecorators && token() === 59 /* AtToken */) {
- let decorator;
+ if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) {
while (decorator = tryParseDecorator()) {
list = append(list, decorator);
+ hasTrailingDecorator = true;
}
+ }
+ if (hasTrailingDecorator) {
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
@@ -34976,7 +35354,7 @@ var Parser;
if (token() === 132 /* AsyncKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(132 /* AsyncKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -35105,7 +35483,7 @@ var Parser;
}
function parseHeritageClauses() {
if (isHeritageClause2()) {
- return parseList(ParsingContext.HeritageClauses, parseHeritageClause);
+ return parseList(22 /* HeritageClauses */, parseHeritageClause);
}
return void 0;
}
@@ -35114,7 +35492,7 @@ var Parser;
const tok = token();
Debug.assert(tok === 94 /* ExtendsKeyword */ || tok === 117 /* ImplementsKeyword */);
nextToken();
- const types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
+ const types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(factory2.createHeritageClause(tok, types), pos);
}
function parseExpressionWithTypeArguments() {
@@ -35127,13 +35505,13 @@ var Parser;
return finishNode(factory2.createExpressionWithTypeArguments(expression, typeArguments), pos);
}
function tryParseTypeArguments() {
- return token() === 29 /* LessThanToken */ ? parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
+ return token() === 29 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
}
function isHeritageClause2() {
return token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
}
function parseClassMembers() {
- return parseList(ParsingContext.ClassMembers, parseClassElement);
+ return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(pos, hasJSDoc, modifiers) {
parseExpected(118 /* InterfaceKeyword */);
@@ -35166,7 +35544,7 @@ var Parser;
const name = parseIdentifier();
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember));
+ members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(6 /* EnumMembers */, parseEnumMember));
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -35178,7 +35556,7 @@ var Parser;
const pos = getNodePos();
let statements;
if (parseExpected(18 /* OpenBraceToken */)) {
- statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
} else {
statements = createMissingList();
@@ -35303,7 +35681,7 @@ var Parser;
if (parseExpected(18 /* OpenBraceToken */)) {
const multiLine = scanner2.hasPrecedingLineBreak();
const elements = parseDelimitedList(
- ParsingContext.AssertEntries,
+ 24 /* AssertEntries */,
parseAssertEntry,
/*considerSemicolonAsDelimiter*/
true
@@ -35387,7 +35765,7 @@ var Parser;
}
function parseNamedImportsOrExports(kind) {
const pos = getNodePos();
- const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
+ const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
return finishNode(node, pos);
}
function parseExportSpecifier() {
@@ -35563,7 +35941,7 @@ var Parser;
/*isDeclarationFile*/
false,
[],
- factory2.createToken(1 /* EndOfFileToken */),
+ factoryCreateToken(1 /* EndOfFileToken */),
0 /* None */,
noop
);
@@ -36224,7 +36602,7 @@ var Parser;
let node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
const name = parseJSDocIdentifierName();
- node = finishNode(factory2.createPropertyAccessExpression(node, name), pos);
+ node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
}
return node;
}
@@ -36515,7 +36893,7 @@ var Parser;
const end2 = scanner2.getTextPos();
const originalKeywordKind = token();
const text = internIdentifier(scanner2.getTokenValue());
- const result = finishNode(factory2.createIdentifier(text, originalKeywordKind), pos, end2);
+ const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
nextTokenJSDoc();
return result;
}
@@ -36837,7 +37215,7 @@ var IncrementalParser;
let currentArrayIndex = 0;
Debug.assert(currentArrayIndex < currentArray.length);
let current = currentArray[currentArrayIndex];
- let lastQueriedPosition = InvalidPosition.Value;
+ let lastQueriedPosition = -1 /* Value */;
return {
currentNode(position) {
if (position !== lastQueriedPosition) {
@@ -36856,7 +37234,7 @@ var IncrementalParser;
};
function findHighestListElementThatStartsAtPosition(position) {
currentArray = void 0;
- currentArrayIndex = InvalidPosition.Value;
+ currentArrayIndex = -1 /* Value */;
current = void 0;
forEachChild(sourceFile, visitNode3, visitArray2);
return;
@@ -38170,7 +38548,7 @@ var commandOptionsWithoutBuild = [
{
name: "allowArbitraryExtensions",
type: "boolean",
- affectsModuleResolution: true,
+ affectsProgramStructure: true,
category: Diagnostics.Modules,
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
defaultValueDescription: false
@@ -40424,6 +40802,22 @@ function resolvedTypeScriptOnly(resolved) {
Debug.assert(extensionIsTS(resolved.extension));
return { fileName: resolved.path, packageId: resolved.packageId };
}
+function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
+ if (originalPath)
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
+ }
+ return createResolvedModuleWithFailedLookupLocations(
+ resolved,
+ isExternalLibraryImport,
+ failedLookupLocations,
+ affectingLocations,
+ diagnostics,
+ state.resultFromCache,
+ legacyResult
+ );
+}
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
if (resultFromCache) {
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -40584,6 +40978,15 @@ function arePathsEqual(path1, path2, host) {
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
}
+function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ return {
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
+ originalPath: pathsAreEqual ? void 0 : fileName
+ };
+}
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
const traceEnabled = isTraceEnabled(options, host);
@@ -40628,9 +41031,9 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
const affectingLocations = [];
let features = getNodeResolutionFeatures(options);
if (resolutionMode === 99 /* ESNext */ && (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */)) {
- features |= NodeResolutionFeatures.EsmMode;
+ features |= 32 /* EsmMode */;
}
- const conditions = features & NodeResolutionFeatures.Exports ? getConditions(options, !!(features & NodeResolutionFeatures.EsmMode)) : [];
+ const conditions = features & 8 /* Exports */ ? getConditions(options, !!(features & 32 /* EsmMode */)) : [];
const diagnostics = [];
const moduleResolutionState = {
compilerOptions: options,
@@ -40655,13 +41058,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
let resolvedTypeReferenceDirective;
if (resolved) {
const { fileName, packageId } = resolved;
- const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ let resolvedFileName = fileName, originalPath;
+ if (!options.preserveSymlinks)
+ ({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
resolvedTypeReferenceDirective = {
primary,
- // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
- resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
- originalPath: pathsAreEqual ? void 0 : fileName,
+ resolvedFileName,
+ originalPath,
packageId,
isExternalLibraryImport: pathContainsNodeModules(fileName)
};
@@ -40763,35 +41166,38 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
}
}
function getNodeResolutionFeatures(options) {
- let features = NodeResolutionFeatures.None;
+ let features = 0 /* None */;
switch (getEmitModuleResolutionKind(options)) {
case 3 /* Node16 */:
- features = NodeResolutionFeatures.Node16Default;
+ features = 30 /* Node16Default */;
break;
case 99 /* NodeNext */:
- features = NodeResolutionFeatures.NodeNextDefault;
+ features = 30 /* NodeNextDefault */;
break;
case 100 /* Bundler */:
- features = NodeResolutionFeatures.BundlerDefault;
+ features = 30 /* BundlerDefault */;
break;
}
if (options.resolvePackageJsonExports) {
- features |= NodeResolutionFeatures.Exports;
+ features |= 8 /* Exports */;
} else if (options.resolvePackageJsonExports === false) {
- features &= ~NodeResolutionFeatures.Exports;
+ features &= ~8 /* Exports */;
}
if (options.resolvePackageJsonImports) {
- features |= NodeResolutionFeatures.Imports;
+ features |= 2 /* Imports */;
} else if (options.resolvePackageJsonImports === false) {
- features &= ~NodeResolutionFeatures.Imports;
+ features &= ~2 /* Imports */;
}
return features;
}
function getConditions(options, esmMode) {
- const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["node", "import"] : ["node", "require"];
+ const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
if (!options.noDtsResolution) {
conditions.push("types");
}
+ if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
+ conditions.push("node");
+ }
return concatenate(conditions, options.customConditions);
}
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
@@ -41518,7 +41924,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
isConfigLookup,
candidateIsFromPackageJsonField: false
};
- if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
+ if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
}
let result;
@@ -41544,13 +41950,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
legacyResult = diagnosticResult.value.resolved.path;
}
}
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache,
+ state,
legacyResult
);
function tryResolve(extensions2, state2) {
@@ -41580,16 +41987,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
}
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
}
- if (!resolved2)
- return void 0;
- let resolvedValue = resolved2.value;
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
- const path = realPath(resolvedValue.path, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
- }
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
} else {
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
const resolved2 = nodeLoadModuleByRelativeName(
@@ -41772,7 +42170,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
if (!onlyRecordFailures) {
if (state.host.fileExists(fileName)) {
if (state.traceEnabled) {
- trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
+ trace(state.host, Diagnostics.File_0_exists_use_it_as_a_name_resolution_result, fileName);
}
return fileName;
} else {
@@ -42367,18 +42765,24 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
)));
} else if (typeof target === "object" && target !== null) {
if (!Array.isArray(target)) {
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
for (const condition of getOwnKeys(target)) {
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
const subTarget = target[condition];
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
if (result) {
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return result;
+ } else {
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
}
} else {
traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
}
}
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return void 0;
} else {
if (!length(target)) {
@@ -42745,13 +43149,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
candidateIsFromPackageJsonField: false
};
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
resolved && resolved.value,
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache
+ state
);
function tryResolve(extensions) {
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -42991,35 +43396,36 @@ function bindSourceFile(file, options) {
measure("Bind", "beforeBind", "afterBind");
}
function createBinder() {
- let file;
- let options;
- let languageVersion;
- let parent2;
- let container;
- let thisParentContainer;
- let blockScopeContainer;
- let lastContainer;
- let delayedTypeAliases;
- let seenThisKeyword;
- let currentFlow;
- let currentBreakTarget;
- let currentContinueTarget;
- let currentReturnTarget;
- let currentTrueTarget;
- let currentFalseTarget;
- let currentExceptionTarget;
- let preSwitchCaseFlow;
- let activeLabelList;
- let hasExplicitReturn;
- let emitFlags;
- let inStrictMode;
- let inAssignmentPattern = false;
- let symbolCount = 0;
- let Symbol46;
- let classifiableNames;
- const unreachableFlow = { flags: 1 /* Unreachable */ };
- const reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
- const bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ var file;
+ var options;
+ var languageVersion;
+ var parent2;
+ var container;
+ var thisParentContainer;
+ var blockScopeContainer;
+ var lastContainer;
+ var delayedTypeAliases;
+ var seenThisKeyword;
+ var currentFlow;
+ var currentBreakTarget;
+ var currentContinueTarget;
+ var currentReturnTarget;
+ var currentTrueTarget;
+ var currentFalseTarget;
+ var currentExceptionTarget;
+ var preSwitchCaseFlow;
+ var activeLabelList;
+ var hasExplicitReturn;
+ var emitFlags;
+ var inStrictMode;
+ var inAssignmentPattern = false;
+ var symbolCount = 0;
+ var Symbol46;
+ var classifiableNames;
+ var unreachableFlow = { flags: 1 /* Unreachable */ };
+ var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
+ var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ return bindSourceFile2;
function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
}
@@ -43070,7 +43476,6 @@ function createBinder() {
inAssignmentPattern = false;
emitFlags = 0 /* None */;
}
- return bindSourceFile2;
function bindInStrictMode(file2, opts) {
if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) {
return true;
@@ -46061,7 +46466,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
let redirectPathsSpecifiers;
let relativeSpecifiers;
for (const modulePath of modulePaths) {
- const specifier = tryGetModuleNameAsNodeModule(
+ const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
modulePath,
info,
importingSourceFile,
@@ -46071,7 +46476,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
/*packageNameOnly*/
void 0,
options.overrideImportMode
- );
+ ) : void 0;
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
if (specifier && modulePath.isRedirect) {
return nodeModulesSpecifiers;
@@ -46483,9 +46888,11 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
- if (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */) {
- const conditions = ["node", importMode === 99 /* ESNext */ ? "import" : "require", "types"];
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
+ if (getResolvePackageJsonExports(options)) {
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
+ const conditions = getConditions(options, importMode === 99 /* ESNext */);
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
if (fromExports) {
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
return { ...withJsExtension, verbatimFromExports: true };
@@ -46742,6 +47149,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
return SignatureCheckMode3;
})(SignatureCheckMode || {});
@@ -46776,8 +47184,8 @@ function isInstantiatedModule(node, preserveConstEnums) {
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
}
function createTypeChecker(host) {
- const getPackagesMap = memoize(() => {
- const map2 = /* @__PURE__ */ new Map();
+ var getPackagesMap = memoize(() => {
+ var map2 = /* @__PURE__ */ new Map();
host.getSourceFiles().forEach((sf) => {
if (!sf.resolvedModules)
return;
@@ -46788,57 +47196,58 @@ function createTypeChecker(host) {
});
return map2;
});
- let deferredDiagnosticsCallbacks = [];
- let addLazyDiagnostic = (arg) => {
+ var deferredDiagnosticsCallbacks = [];
+ var addLazyDiagnostic = (arg) => {
deferredDiagnosticsCallbacks.push(arg);
};
- let cancellationToken;
- const requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
- let requestedExternalEmitHelpers;
- let externalHelpersModule;
- const Symbol46 = objectAllocator.getSymbolConstructor();
- const Type27 = objectAllocator.getTypeConstructor();
- const Signature15 = objectAllocator.getSignatureConstructor();
- let typeCount = 0;
- let symbolCount = 0;
- let totalInstantiationCount = 0;
- let instantiationCount = 0;
- let instantiationDepth = 0;
- let inlineLevel = 0;
- let currentNode;
- let varianceTypeParameter;
- const emptySymbols = createSymbolTable();
- const arrayVariances = [1 /* Covariant */];
- const compilerOptions = host.getCompilerOptions();
- const languageVersion = getEmitScriptTarget(compilerOptions);
- const moduleKind = getEmitModuleKind(compilerOptions);
- const legacyDecorators = !!compilerOptions.experimentalDecorators;
- const useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
- const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
- const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
- const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
- const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
- const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
- const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
- const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
- const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
- const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
- const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
- const exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
- const checkBinaryExpression = createCheckBinaryExpression();
- const emitResolver = createResolver();
- const nodeBuilder = createNodeBuilder();
- const globals = createSymbolTable();
- const undefinedSymbol = createSymbol(4 /* Property */, "undefined");
+ var cancellationToken;
+ var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
+ var requestedExternalEmitHelpers;
+ var externalHelpersModule;
+ var Symbol46 = objectAllocator.getSymbolConstructor();
+ var Type27 = objectAllocator.getTypeConstructor();
+ var Signature15 = objectAllocator.getSignatureConstructor();
+ var typeCount = 0;
+ var symbolCount = 0;
+ var totalInstantiationCount = 0;
+ var instantiationCount = 0;
+ var instantiationDepth = 0;
+ var inlineLevel = 0;
+ var currentNode;
+ var varianceTypeParameter;
+ var isInferencePartiallyBlocked = false;
+ var emptySymbols = createSymbolTable();
+ var arrayVariances = [1 /* Covariant */];
+ var compilerOptions = host.getCompilerOptions();
+ var languageVersion = getEmitScriptTarget(compilerOptions);
+ var moduleKind = getEmitModuleKind(compilerOptions);
+ var legacyDecorators = !!compilerOptions.experimentalDecorators;
+ var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
+ var allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
+ var strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
+ var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
+ var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
+ var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
+ var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
+ var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
+ var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
+ var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
+ var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
+ var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
+ var checkBinaryExpression = createCheckBinaryExpression();
+ var emitResolver = createResolver();
+ var nodeBuilder = createNodeBuilder();
+ var globals = createSymbolTable();
+ var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
undefinedSymbol.declarations = [];
- const globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
+ var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
globalThisSymbol.declarations = [];
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
- const argumentsSymbol = createSymbol(4 /* Property */, "arguments");
- const requireSymbol = createSymbol(4 /* Property */, "require");
- const isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
- let apparentArgumentCount;
+ var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
+ var requireSymbol = createSymbol(4 /* Property */, "require");
+ var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
+ var apparentArgumentCount;
const checker = {
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -47016,15 +47425,14 @@ function createTypeChecker(host) {
getTypeOfPropertyOfContextualType,
getFullyQualifiedName,
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
call,
candidatesOutArray,
/*argumentCount*/
void 0,
- 32 /* IsForStringLiteralArgumentCompletions */,
- editingArgument
- ),
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
+ 32 /* IsForStringLiteralArgumentCompletions */
+ )),
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
getExpandedParameters,
hasEffectiveRestParameter,
containsArgumentsReference,
@@ -47129,6 +47537,7 @@ function createTypeChecker(host) {
isArrayType,
isTupleType,
isArrayLikeType,
+ isEmptyAnonymousObjectType,
isTypeInvalidDueToUnionDiscriminant,
getExactOptionalProperties,
getAllPossiblePropertiesOfTypes,
@@ -47215,81 +47624,93 @@ function createTypeChecker(host) {
isPropertyAccessible,
getTypeOnlyAliasDeclaration,
getMemberOverrideModifierStatus,
- isTypeParameterPossiblyReferenced
+ isTypeParameterPossiblyReferenced,
+ typeHasCallOrConstructSignatures
};
- function runWithInferenceBlockedFromSourceNode(node, fn) {
+ function runWithoutResolvedSignatureCaching(node, fn) {
const containingCall = findAncestor(node, isCallLikeExpression);
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = void 0;
+ }
+ const result = fn();
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
+ }
+ return result;
+ }
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
+ const containingCall = findAncestor(node, isCallLikeExpression);
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = true;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = void 0;
}
- const result = fn();
+ isInferencePartiallyBlocked = true;
+ const result = runWithoutResolvedSignatureCaching(node, fn);
+ isInferencePartiallyBlocked = false;
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
}
return result;
}
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
apparentArgumentCount = argumentCount;
- const res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignature(node, candidatesOutArray, checkMode)) : getResolvedSignature(node, candidatesOutArray, checkMode);
+ const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
apparentArgumentCount = void 0;
return res;
}
- const tupleTypes = /* @__PURE__ */ new Map();
- const unionTypes = /* @__PURE__ */ new Map();
- const intersectionTypes = /* @__PURE__ */ new Map();
- const stringLiteralTypes = /* @__PURE__ */ new Map();
- const numberLiteralTypes = /* @__PURE__ */ new Map();
- const bigIntLiteralTypes = /* @__PURE__ */ new Map();
- const enumLiteralTypes = /* @__PURE__ */ new Map();
- const indexedAccessTypes = /* @__PURE__ */ new Map();
- const templateLiteralTypes = /* @__PURE__ */ new Map();
- const stringMappingTypes = /* @__PURE__ */ new Map();
- const substitutionTypes = /* @__PURE__ */ new Map();
- const subtypeReductionCache = /* @__PURE__ */ new Map();
- const decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
- const cachedTypes = /* @__PURE__ */ new Map();
- const evolvingArrayTypes = [];
- const undefinedProperties = /* @__PURE__ */ new Map();
- const markerTypes = /* @__PURE__ */ new Set();
- const unknownSymbol = createSymbol(4 /* Property */, "unknown");
- const resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
- const unresolvedSymbols = /* @__PURE__ */ new Map();
- const errorTypes = /* @__PURE__ */ new Map();
- const anyType = createIntrinsicType(1 /* Any */, "any");
- const autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
- const wildcardType = createIntrinsicType(1 /* Any */, "any");
- const errorType = createIntrinsicType(1 /* Any */, "error");
- const unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
- const nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
- const intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
- const unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
- const missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
- const optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const nullType = createIntrinsicType(65536 /* Null */, "null");
- const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
- const stringType = createIntrinsicType(4 /* String */, "string");
- const numberType = createIntrinsicType(8 /* Number */, "number");
- const bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
- const falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
- const regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var tupleTypes = /* @__PURE__ */ new Map();
+ var unionTypes = /* @__PURE__ */ new Map();
+ var intersectionTypes = /* @__PURE__ */ new Map();
+ var stringLiteralTypes = /* @__PURE__ */ new Map();
+ var numberLiteralTypes = /* @__PURE__ */ new Map();
+ var bigIntLiteralTypes = /* @__PURE__ */ new Map();
+ var enumLiteralTypes = /* @__PURE__ */ new Map();
+ var indexedAccessTypes = /* @__PURE__ */ new Map();
+ var templateLiteralTypes = /* @__PURE__ */ new Map();
+ var stringMappingTypes = /* @__PURE__ */ new Map();
+ var substitutionTypes = /* @__PURE__ */ new Map();
+ var subtypeReductionCache = /* @__PURE__ */ new Map();
+ var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
+ var cachedTypes = /* @__PURE__ */ new Map();
+ var evolvingArrayTypes = [];
+ var undefinedProperties = /* @__PURE__ */ new Map();
+ var markerTypes = /* @__PURE__ */ new Set();
+ var unknownSymbol = createSymbol(4 /* Property */, "unknown");
+ var resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
+ var unresolvedSymbols = /* @__PURE__ */ new Map();
+ var errorTypes = /* @__PURE__ */ new Map();
+ var anyType = createIntrinsicType(1 /* Any */, "any");
+ var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
+ var wildcardType = createIntrinsicType(1 /* Any */, "any");
+ var errorType = createIntrinsicType(1 /* Any */, "error");
+ var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
+ var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
+ var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
+ var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
+ var missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
+ var optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var nullType = createIntrinsicType(65536 /* Null */, "null");
+ var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
+ var stringType = createIntrinsicType(4 /* String */, "string");
+ var numberType = createIntrinsicType(8 /* Number */, "number");
+ var bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
+ var falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
trueType.regularType = regularTrueType;
trueType.freshType = trueType;
regularTrueType.regularType = regularTrueType;
@@ -47298,26 +47719,26 @@ function createTypeChecker(host) {
falseType.freshType = falseType;
regularFalseType.regularType = regularFalseType;
regularFalseType.freshType = falseType;
- const booleanType = getUnionType([regularFalseType, regularTrueType]);
- const esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
- const voidType = createIntrinsicType(16384 /* Void */, "void");
- const neverType = createIntrinsicType(131072 /* Never */, "never");
- const silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
- const implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
- const unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
- const nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
- const stringOrNumberType = getUnionType([stringType, numberType]);
- const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
- const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
- const numberOrBigIntType = getUnionType([numberType, bigintType]);
- const templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
- const numericStringType = getTemplateLiteralType(["", ""], [numberType]);
- const restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
- const permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
- const uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
- const uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
- let outofbandVarianceMarkerHandler;
- const reportUnreliableMapper = makeFunctionTypeMapper((t) => {
+ var booleanType = getUnionType([regularFalseType, regularTrueType]);
+ var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
+ var voidType = createIntrinsicType(16384 /* Void */, "void");
+ var neverType = createIntrinsicType(131072 /* Never */, "never");
+ var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
+ var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
+ var stringOrNumberType = getUnionType([stringType, numberType]);
+ var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
+ var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
+ var numberOrBigIntType = getUnionType([numberType, bigintType]);
+ var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
+ var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
+ var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
+ var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
+ var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
+ var outofbandVarianceMarkerHandler;
+ var reportUnreliableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -47326,7 +47747,7 @@ function createTypeChecker(host) {
}
return t;
}, () => "(unmeasurable reporter)");
- const reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
+ var reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -47335,30 +47756,30 @@ function createTypeChecker(host) {
}
return t;
}, () => "(unreliable reporter)");
- const emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
- const emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
+ var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
emptyTypeLiteralSymbol.members = createSymbolTable();
- const emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
- const emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
+ var emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyGenericType.instantiations = /* @__PURE__ */ new Map();
- const anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
anyFunctionType.objectFlags |= 262144 /* NonInferrableType */;
- const noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const markerSuperType = createTypeParameter();
- const markerSubType = createTypeParameter();
+ var noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var markerSuperType = createTypeParameter();
+ var markerSubType = createTypeParameter();
markerSubType.constraint = markerSuperType;
- const markerOtherType = createTypeParameter();
- const markerSuperTypeForCheck = createTypeParameter();
- const markerSubTypeForCheck = createTypeParameter();
+ var markerOtherType = createTypeParameter();
+ var markerSuperTypeForCheck = createTypeParameter();
+ var markerSubTypeForCheck = createTypeParameter();
markerSubTypeForCheck.constraint = markerSuperTypeForCheck;
- const noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
- const anySignature = createSignature(
+ var noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
+ var anySignature = createSignature(
void 0,
void 0,
void 0,
@@ -47369,7 +47790,7 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const unknownSignature = createSignature(
+ var unknownSignature = createSignature(
void 0,
void 0,
void 0,
@@ -47380,7 +47801,7 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const resolvingSignature = createSignature(
+ var resolvingSignature = createSignature(
void 0,
void 0,
void 0,
@@ -47391,7 +47812,7 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const silentNeverSignature = createSignature(
+ var silentNeverSignature = createSignature(
void 0,
void 0,
void 0,
@@ -47402,14 +47823,14 @@ function createTypeChecker(host) {
0,
0 /* None */
);
- const enumNumberIndexInfo = createIndexInfo(
+ var enumNumberIndexInfo = createIndexInfo(
numberType,
stringType,
/*isReadonly*/
true
);
- const iterationTypesCache = /* @__PURE__ */ new Map();
- const noIterationTypes = {
+ var iterationTypesCache = /* @__PURE__ */ new Map();
+ var noIterationTypes = {
get yieldType() {
return Debug.fail("Not supported");
},
@@ -47420,10 +47841,10 @@ function createTypeChecker(host) {
return Debug.fail("Not supported");
}
};
- const anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
- const anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
- const defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
- const asyncIterationTypesResolver = {
+ var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
+ var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
+ var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
+ var asyncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfAsyncIterable",
iteratorCacheKey: "iterationTypesOfAsyncIterator",
iteratorSymbolName: "asyncIterator",
@@ -47436,7 +47857,7 @@ function createTypeChecker(host) {
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
};
- const syncIterationTypesResolver = {
+ var syncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfIterable",
iteratorCacheKey: "iterationTypesOfIterator",
iteratorSymbolName: "iterator",
@@ -47449,117 +47870,118 @@ function createTypeChecker(host) {
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property
};
- let amalgamatedDuplicates;
- const reverseMappedCache = /* @__PURE__ */ new Map();
- let inInferTypeForHomomorphicMappedType = false;
- let ambientModulesCache;
- let patternAmbientModules;
- let patternAmbientModuleAugmentations;
- let globalObjectType;
- let globalFunctionType;
- let globalCallableFunctionType;
- let globalNewableFunctionType;
- let globalArrayType;
- let globalReadonlyArrayType;
- let globalStringType;
- let globalNumberType;
- let globalBooleanType;
- let globalRegExpType;
- let globalThisType;
- let anyArrayType;
- let autoArrayType;
- let anyReadonlyArrayType;
- let deferredGlobalNonNullableTypeAlias;
- let deferredGlobalESSymbolConstructorSymbol;
- let deferredGlobalESSymbolConstructorTypeSymbol;
- let deferredGlobalESSymbolType;
- let deferredGlobalTypedPropertyDescriptorType;
- let deferredGlobalPromiseType;
- let deferredGlobalPromiseLikeType;
- let deferredGlobalPromiseConstructorSymbol;
- let deferredGlobalPromiseConstructorLikeType;
- let deferredGlobalIterableType;
- let deferredGlobalIteratorType;
- let deferredGlobalIterableIteratorType;
- let deferredGlobalGeneratorType;
- let deferredGlobalIteratorYieldResultType;
- let deferredGlobalIteratorReturnResultType;
- let deferredGlobalAsyncIterableType;
- let deferredGlobalAsyncIteratorType;
- let deferredGlobalAsyncIterableIteratorType;
- let deferredGlobalAsyncGeneratorType;
- let deferredGlobalTemplateStringsArrayType;
- let deferredGlobalImportMetaType;
- let deferredGlobalImportMetaExpressionType;
- let deferredGlobalImportCallOptionsType;
- let deferredGlobalExtractSymbol;
- let deferredGlobalOmitSymbol;
- let deferredGlobalAwaitedSymbol;
- let deferredGlobalBigIntType;
- let deferredGlobalNaNSymbol;
- let deferredGlobalRecordSymbol;
- let deferredGlobalClassDecoratorContextType;
- let deferredGlobalClassMethodDecoratorContextType;
- let deferredGlobalClassGetterDecoratorContextType;
- let deferredGlobalClassSetterDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorTargetType;
- let deferredGlobalClassAccessorDecoratorResultType;
- let deferredGlobalClassFieldDecoratorContextType;
- const allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
- let flowLoopStart = 0;
- let flowLoopCount = 0;
- let sharedFlowCount = 0;
- let flowAnalysisDisabled = false;
- let flowInvocationCount = 0;
- let lastFlowNode;
- let lastFlowNodeReachable;
- let flowTypeCache;
- const contextualTypeNodes = [];
- const contextualTypes = [];
- let contextualTypeCount = 0;
- const inferenceContextNodes = [];
- const inferenceContexts = [];
- let inferenceContextCount = 0;
- const emptyStringType = getStringLiteralType("");
- const zeroType = getNumberLiteralType(0);
- const zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
- const resolutionTargets = [];
- const resolutionResults = [];
- const resolutionPropertyNames = [];
- let suggestionCount = 0;
- const maximumSuggestionCount = 10;
- const mergedSymbols = [];
- const symbolLinks = [];
- const nodeLinks = [];
- const flowLoopCaches = [];
- const flowLoopNodes = [];
- const flowLoopKeys = [];
- const flowLoopTypes = [];
- const sharedFlowNodes = [];
- const sharedFlowTypes = [];
- const flowNodeReachable = [];
- const flowNodePostSuper = [];
- const potentialThisCollisions = [];
- const potentialNewTargetCollisions = [];
- const potentialWeakMapSetCollisions = [];
- const potentialReflectCollisions = [];
- const potentialUnusedRenamedBindingElementsInTypes = [];
- const awaitedTypeStack = [];
- const diagnostics = createDiagnosticCollection();
- const suggestionDiagnostics = createDiagnosticCollection();
- const typeofType = createTypeofType();
- let _jsxNamespace;
- let _jsxFactoryEntity;
- const subtypeRelation = /* @__PURE__ */ new Map();
- const strictSubtypeRelation = /* @__PURE__ */ new Map();
- const assignableRelation = /* @__PURE__ */ new Map();
- const comparableRelation = /* @__PURE__ */ new Map();
- const identityRelation = /* @__PURE__ */ new Map();
- const enumRelation = /* @__PURE__ */ new Map();
- const builtinGlobals = createSymbolTable();
+ var amalgamatedDuplicates;
+ var reverseMappedCache = /* @__PURE__ */ new Map();
+ var inInferTypeForHomomorphicMappedType = false;
+ var ambientModulesCache;
+ var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
+ var globalObjectType;
+ var globalFunctionType;
+ var globalCallableFunctionType;
+ var globalNewableFunctionType;
+ var globalArrayType;
+ var globalReadonlyArrayType;
+ var globalStringType;
+ var globalNumberType;
+ var globalBooleanType;
+ var globalRegExpType;
+ var globalThisType;
+ var anyArrayType;
+ var autoArrayType;
+ var anyReadonlyArrayType;
+ var deferredGlobalNonNullableTypeAlias;
+ var deferredGlobalESSymbolConstructorSymbol;
+ var deferredGlobalESSymbolConstructorTypeSymbol;
+ var deferredGlobalESSymbolType;
+ var deferredGlobalTypedPropertyDescriptorType;
+ var deferredGlobalPromiseType;
+ var deferredGlobalPromiseLikeType;
+ var deferredGlobalPromiseConstructorSymbol;
+ var deferredGlobalPromiseConstructorLikeType;
+ var deferredGlobalIterableType;
+ var deferredGlobalIteratorType;
+ var deferredGlobalIterableIteratorType;
+ var deferredGlobalGeneratorType;
+ var deferredGlobalIteratorYieldResultType;
+ var deferredGlobalIteratorReturnResultType;
+ var deferredGlobalAsyncIterableType;
+ var deferredGlobalAsyncIteratorType;
+ var deferredGlobalAsyncIterableIteratorType;
+ var deferredGlobalAsyncGeneratorType;
+ var deferredGlobalTemplateStringsArrayType;
+ var deferredGlobalImportMetaType;
+ var deferredGlobalImportMetaExpressionType;
+ var deferredGlobalImportCallOptionsType;
+ var deferredGlobalExtractSymbol;
+ var deferredGlobalOmitSymbol;
+ var deferredGlobalAwaitedSymbol;
+ var deferredGlobalBigIntType;
+ var deferredGlobalNaNSymbol;
+ var deferredGlobalRecordSymbol;
+ var deferredGlobalClassDecoratorContextType;
+ var deferredGlobalClassMethodDecoratorContextType;
+ var deferredGlobalClassGetterDecoratorContextType;
+ var deferredGlobalClassSetterDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorTargetType;
+ var deferredGlobalClassAccessorDecoratorResultType;
+ var deferredGlobalClassFieldDecoratorContextType;
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
+ var flowLoopStart = 0;
+ var flowLoopCount = 0;
+ var sharedFlowCount = 0;
+ var flowAnalysisDisabled = false;
+ var flowInvocationCount = 0;
+ var lastFlowNode;
+ var lastFlowNodeReachable;
+ var flowTypeCache;
+ var contextualTypeNodes = [];
+ var contextualTypes = [];
+ var contextualIsCache = [];
+ var contextualTypeCount = 0;
+ var inferenceContextNodes = [];
+ var inferenceContexts = [];
+ var inferenceContextCount = 0;
+ var emptyStringType = getStringLiteralType("");
+ var zeroType = getNumberLiteralType(0);
+ var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
+ var resolutionTargets = [];
+ var resolutionResults = [];
+ var resolutionPropertyNames = [];
+ var suggestionCount = 0;
+ var maximumSuggestionCount = 10;
+ var mergedSymbols = [];
+ var symbolLinks = [];
+ var nodeLinks = [];
+ var flowLoopCaches = [];
+ var flowLoopNodes = [];
+ var flowLoopKeys = [];
+ var flowLoopTypes = [];
+ var sharedFlowNodes = [];
+ var sharedFlowTypes = [];
+ var flowNodeReachable = [];
+ var flowNodePostSuper = [];
+ var potentialThisCollisions = [];
+ var potentialNewTargetCollisions = [];
+ var potentialWeakMapSetCollisions = [];
+ var potentialReflectCollisions = [];
+ var potentialUnusedRenamedBindingElementsInTypes = [];
+ var awaitedTypeStack = [];
+ var diagnostics = createDiagnosticCollection();
+ var suggestionDiagnostics = createDiagnosticCollection();
+ var typeofType = createTypeofType();
+ var _jsxNamespace;
+ var _jsxFactoryEntity;
+ var subtypeRelation = /* @__PURE__ */ new Map();
+ var strictSubtypeRelation = /* @__PURE__ */ new Map();
+ var assignableRelation = /* @__PURE__ */ new Map();
+ var comparableRelation = /* @__PURE__ */ new Map();
+ var identityRelation = /* @__PURE__ */ new Map();
+ var enumRelation = /* @__PURE__ */ new Map();
+ var builtinGlobals = createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- const suggestedExtensions = [
+ var suggestedExtensions = [
[".mts", ".mjs"],
[".ts", ".js"],
[".cts", ".cjs"],
@@ -48951,7 +49373,12 @@ function createTypeChecker(host) {
}
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
- const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
+ const exportSymbol = exportValue ? getPropertyOfType(
+ getTypeOfSymbol(exportValue),
+ name,
+ /*skipObjectFunctionPropertyAugment*/
+ true
+ ) : moduleSymbol.exports.get(name);
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
markSymbolOfAliasDeclarationIfTypeOnly(
sourceNode,
@@ -49986,12 +50413,9 @@ function createTypeChecker(host) {
if (resolutionDiagnostic) {
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
} else {
- const tsExtension = tryExtractTSExtension(moduleReference);
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
- if (tsExtension) {
- errorOnTSExtensionImport(tsExtension);
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -50011,14 +50435,12 @@ function createTypeChecker(host) {
}
}
return void 0;
- function errorOnTSExtensionImport(tsExtension) {
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
- }
function getSuggestedImportSource(tsExtension) {
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
- return importSourceWithoutExtension + (tsExtension === ".mts" /* Mts */ ? ".mjs" : tsExtension === ".cts" /* Cts */ ? ".cjs" : ".js");
+ const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
+ const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
+ return importSourceWithoutExtension + ext;
}
return importSourceWithoutExtension;
}
@@ -50205,7 +50627,7 @@ function createTypeChecker(host) {
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
}
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
- return !(resolvedExternalModuleType.flags & 131068 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
+ return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
}
function getExportsOfSymbol(symbol) {
@@ -51504,7 +51926,7 @@ function createTypeChecker(host) {
return result;
}
function createAnonymousTypeNode(type2) {
- var _a3;
+ var _a3, _b2;
const typeId = type2.id;
const symbol = type2.symbol;
if (symbol) {
@@ -51530,6 +51952,20 @@ function createTypeChecker(host) {
return visitAndTransformType(type2, createTypeNodeFromObjectType);
}
} else {
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
+ if (isInstantiationExpressionType) {
+ const instantiationExpressionType = type2;
+ if (isTypeQueryNode(instantiationExpressionType.node)) {
+ const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
+ if (typeNode) {
+ return typeNode;
+ }
+ }
+ if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
+ return createElidedInformationPlaceholder(context);
+ }
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
+ }
return createTypeNodeFromObjectType(type2);
}
function shouldWriteTypeOfFunctionSymbol() {
@@ -52038,7 +52474,7 @@ function createTypeChecker(host) {
);
}
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
- var _a2, _b, _c, _d;
+ var _a2, _b, _c, _d, _e;
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
if (suppressAny)
context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -52055,6 +52491,39 @@ function createTypeChecker(host) {
/*skipUnionExpanding*/
true
)[0];
+ let cleanup;
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
+ const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
+ let newLocals;
+ for (const param of expandedParams) {
+ if (!locals.has(param.escapedName)) {
+ newLocals = append(newLocals, param.escapedName);
+ locals.set(param.escapedName, param);
+ }
+ }
+ if (newLocals) {
+ let removeNewLocals2 = function() {
+ forEach(newLocals, (s) => locals.delete(s));
+ };
+ var removeNewLocals = removeNewLocals2;
+ if (existingFakeScope) {
+ cleanup = removeNewLocals2;
+ } else {
+ const fakeScope = parseNodeFactory.createBlock(emptyArray);
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
+ fakeScope.locals = locals;
+ const saveEnclosingDeclaration = context.enclosingDeclaration;
+ setParent(fakeScope, saveEnclosingDeclaration);
+ context.enclosingDeclaration = fakeScope;
+ cleanup = () => {
+ context.enclosingDeclaration = saveEnclosingDeclaration;
+ removeNewLocals2();
+ };
+ }
+ }
+ }
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
if (thisParameter) {
@@ -52080,11 +52549,11 @@ function createTypeChecker(host) {
const flags = modifiersToFlags(modifiers);
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
}
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
modifiers,
/*asteriskToken*/
void 0,
- (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
/*questionToken*/
void 0,
typeParameters,
@@ -52099,14 +52568,14 @@ function createTypeChecker(host) {
void 0
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
modifiers,
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
parameters,
returnTypeNode,
/*body*/
void 0
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
modifiers,
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
+ (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
parameters,
/*body*/
void 0
@@ -52141,13 +52610,14 @@ function createTypeChecker(host) {
if (typeArguments) {
node.typeArguments = factory.createNodeArray(typeArguments);
}
+ cleanup == null ? void 0 : cleanup();
return node;
}
function tryGetThisParameterDeclaration(signature, context) {
if (signature.thisParameter) {
return symbolToParameterDeclaration(signature.thisParameter, context);
}
- if (signature.declaration) {
+ if (signature.declaration && isInJSFile(signature.declaration)) {
const thisTag = getJSDocThisTag(signature.declaration);
if (thisTag && thisTag.typeExpression) {
return factory.createParameterDeclaration(
@@ -52755,9 +53225,12 @@ function createTypeChecker(host) {
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
}
+ function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
+ }
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
if (!isErrorType(type) && enclosingDeclaration) {
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -52789,7 +53262,8 @@ function createTypeChecker(host) {
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
if (!isErrorType(type) && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
- if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
+ const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
+ if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
const annotated = getTypeFromTypeNode(annotation);
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -54404,8 +54878,8 @@ function createTypeChecker(host) {
const t = types[i];
flags |= t.flags;
if (!(t.flags & 98304 /* Nullable */)) {
- if (t.flags & (512 /* BooleanLiteral */ | 1024 /* EnumLiteral */)) {
- const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLiteralType(t);
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
if (baseType.flags & 1048576 /* Union */) {
const count = baseType.types.length;
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -54660,7 +55134,7 @@ function createTypeChecker(host) {
}
function findResolutionCycleStartIndex(target, propertyName) {
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
return -1;
}
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -54669,7 +55143,7 @@ function createTypeChecker(host) {
}
return -1;
}
- function hasType2(target, propertyName) {
+ function resolutionTargetHasProperty(target, propertyName) {
switch (propertyName) {
case 0 /* Type */:
return !!getSymbolLinks(target).type;
@@ -54689,6 +55163,8 @@ function createTypeChecker(host) {
return !!target.baseTypesResolved;
case 8 /* WriteType */:
return !!getSymbolLinks(target).writeType;
+ case 9 /* ParameterInitializerContainsUndefined */:
+ return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
}
return Debug.assertNever(propertyName);
}
@@ -55128,7 +55604,7 @@ function createTypeChecker(host) {
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
- const tag = getJSDocTypeTag(container);
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
if (tag && tag.typeExpression) {
return getTypeFromTypeNode(tag.typeExpression);
}
@@ -56280,8 +56756,8 @@ function createTypeChecker(host) {
}
return links.declaredType;
}
- function getBaseTypeOfEnumLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
+ function getBaseTypeOfEnumLikeType(type) {
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
}
function getDeclaredTypeOfEnum(symbol) {
const links = getSymbolLinks(symbol);
@@ -56294,7 +56770,7 @@ function createTypeChecker(host) {
if (hasBindableName(member)) {
const memberSymbol = getSymbolOfDeclaration(member);
const value = getEnumMemberValue(member);
- const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
+ const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
getSymbolLinks(memberSymbol).declaredType = memberType;
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
}
@@ -56308,7 +56784,7 @@ function createTypeChecker(host) {
symbol,
/*aliasTypeArguments*/
void 0
- ) : createTypeWithSymbol(32 /* Enum */, symbol);
+ ) : createComputedEnumType(symbol);
if (enumType.flags & 1048576 /* Union */) {
enumType.flags |= 1024 /* EnumLiteral */;
enumType.symbol = symbol;
@@ -56317,6 +56793,15 @@ function createTypeChecker(host) {
}
return links.declaredType;
}
+ function createComputedEnumType(symbol) {
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
+ regularType.regularType = regularType;
+ regularType.freshType = freshType;
+ freshType.regularType = regularType;
+ freshType.freshType = freshType;
+ return regularType;
+ }
function getDeclaredTypeOfEnumMember(symbol) {
const links = getSymbolLinks(symbol);
if (!links.declaredType) {
@@ -57265,6 +57750,7 @@ function createTypeChecker(host) {
const typeParameter = getTypeParameterFromMappedType(type);
const constraintType = getConstraintTypeFromMappedType(type);
const nameType = getNameTypeFromMappedType(type.target || type);
+ const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
const templateType = getTemplateTypeFromMappedType(type.target || type);
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
const templateModifiers = getMappedTypeModifiers(type);
@@ -57302,7 +57788,7 @@ function createTypeChecker(host) {
prop.links.keyType = keyType;
if (modifiersProp) {
prop.links.syntheticOrigin = modifiersProp;
- prop.declarations = nameType ? void 0 : modifiersProp.declarations;
+ prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
}
members.set(propName, prop);
}
@@ -58246,6 +58732,12 @@ function createTypeChecker(host) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
+ if (isInJSFile(declaration)) {
+ const thisTag = getJSDocThisTag(declaration);
+ if (thisTag && thisTag.typeExpression) {
+ thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
+ }
+ }
const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0;
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
@@ -58359,7 +58851,11 @@ function createTypeChecker(host) {
if (node.tags) {
for (const tag of node.tags) {
if (isJSDocOverloadTag(tag)) {
- result.push(getSignatureFromDeclaration(tag.typeExpression));
+ const jsDocSignature = tag.typeExpression;
+ if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
+ reportImplicitAny(jsDocSignature, anyType);
+ }
+ result.push(getSignatureFromDeclaration(jsDocSignature));
hasJSDocOverloads = true;
}
}
@@ -58468,6 +58964,12 @@ function createTypeChecker(host) {
if (declaration.kind === 173 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
+ if (isJSDocSignature(declaration)) {
+ const root = getJSDocRoot(declaration);
+ if (root && isConstructorDeclaration(root.parent)) {
+ return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
+ }
+ }
if (isJSDocConstructSignature(declaration)) {
return getTypeFromTypeNode(declaration.parameters[0].type);
}
@@ -58646,7 +59148,7 @@ function createTypeChecker(host) {
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
if (grandParent.kind === 180 /* TypeReference */ && !omitTypeReferences) {
const typeReference = grandParent;
- const typeParameters = getTypeParametersForTypeReference(typeReference);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReference);
if (typeParameters) {
const index = typeReference.typeArguments.indexOf(childTypeParameter);
if (index < typeParameters.length) {
@@ -58996,7 +59498,7 @@ function createTypeChecker(host) {
return links.resolvedJSDocType;
}
function getSubstitutionType(baseType, constraint) {
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
return baseType;
}
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -59939,7 +60441,7 @@ function createTypeChecker(host) {
}
}
function removeStringLiteralsMatchedByTemplateLiterals(types) {
- const templates = filter(types, isPatternLiteralType);
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
if (templates.length) {
let i = types.length;
while (i > 0) {
@@ -59989,7 +60491,7 @@ function createTypeChecker(host) {
orderedRemoveItemAt(typeSet, 1);
}
}
- if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
}
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
@@ -60058,7 +60560,7 @@ function createTypeChecker(host) {
function typePredicateKindsMatch(a, b) {
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
}
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
if (types.length === 0) {
return neverType;
}
@@ -60070,7 +60572,7 @@ function createTypeChecker(host) {
let type = unionTypes.get(id);
if (!type) {
type = createType(1048576 /* Union */);
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
types,
/*excludeKinds*/
98304 /* Nullable */
@@ -60120,7 +60622,7 @@ function createTypeChecker(host) {
type = undefinedType;
}
if (!typeSet.has(type.id.toString())) {
- if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
includes |= 67108864 /* NonPrimitive */;
}
typeSet.set(type.id.toString(), type);
@@ -60396,7 +60898,7 @@ function createTypeChecker(host) {
const typeVariable = getTypeParameterFromMappedType(mappedType);
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
function isDistributive(type) {
- return type.flags & (3 /* AnyOrUnknown */ | 131068 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
+ return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
}
}
function getLiteralTypeFromPropertyName(name) {
@@ -60683,7 +61185,7 @@ function createTypeChecker(host) {
}
}
const propType = getTypeOfSymbol(prop);
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
}
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
const index = +propName;
@@ -61049,7 +61551,7 @@ function createTypeChecker(host) {
}
function getActualTypeVariable(type) {
if (type.flags & 33554432 /* Substitution */) {
- return type.baseType;
+ return getActualTypeVariable(type.baseType);
}
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -61247,11 +61749,6 @@ function createTypeChecker(host) {
var _a2;
const links = getNodeLinks(node);
if (!links.resolvedType) {
- if (node.isTypeOf && node.typeArguments) {
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
- links.resolvedSymbol = unknownSymbol;
- return links.resolvedType = errorType;
- }
if (!isLiteralImportTypeNode(node)) {
error(node.argument, Diagnostics.String_literal_expected);
links.resolvedSymbol = unknownSymbol;
@@ -61312,15 +61809,8 @@ function createTypeChecker(host) {
const resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
if (meaning === 111551 /* Value */) {
- return getTypeOfSymbol(symbol);
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
} else {
- const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
- const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
- if (node.typeArguments && typeParameters) {
- addLazyDiagnostic(() => {
- checkTypeArgumentConstraints(node, typeParameters);
- });
- }
return getTypeReferenceType(node, resolvedSymbol);
}
}
@@ -61498,7 +61988,7 @@ function createTypeChecker(host) {
return type;
}
function getFreshTypeOfLiteralType(type) {
- if (type.flags & 2944 /* Literal */) {
+ if (type.flags & 2976 /* Freshable */) {
if (!type.freshType) {
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
freshType.freshType = freshType;
@@ -61509,10 +61999,10 @@ function createTypeChecker(host) {
return type;
}
function getRegularTypeOfLiteralType(type) {
- return type.flags & 2944 /* Literal */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
}
function isFreshLiteralType(type) {
- return !!(type.flags & 2944 /* Literal */) && type.freshType === type;
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
}
function getStringLiteralType(value) {
let type;
@@ -62191,13 +62681,13 @@ function createTypeChecker(host) {
return type;
}
function getUniqueLiteralFilledInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
}
function getPermissiveInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
}
function getRestrictiveInstantiation(type) {
- if (type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
+ if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
return type;
}
if (type.restrictiveInstantiation) {
@@ -62469,7 +62959,12 @@ function createTypeChecker(host) {
}
}
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
- pushContextualType(next, sourcePropType);
+ pushContextualType(
+ next,
+ sourcePropType,
+ /*isCache*/
+ false
+ );
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
popContextualType();
return result;
@@ -62772,12 +63267,17 @@ function createTypeChecker(host) {
}
}
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
}
- pushContextualType(node, target);
+ pushContextualType(
+ node,
+ target,
+ /*isCache*/
+ false
+ );
const tupleizedType = checkArrayLiteral(
node,
1 /* Contextual */,
@@ -62816,7 +63316,7 @@ function createTypeChecker(host) {
}
}
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
}
@@ -62839,16 +63339,24 @@ function createTypeChecker(host) {
void 0
) !== 0 /* False */;
}
- function isAnySignature(s) {
- return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s));
+ function isTopSignature(s) {
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
+ const paramType = getTypeOfParameter(s.parameters[0]);
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
+ }
+ return false;
}
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
if (source === target) {
return -1 /* True */;
}
- if (isAnySignature(target)) {
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
return -1 /* True */;
}
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
+ return 0 /* False */;
+ }
const targetCount = getParameterCount(target);
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
if (sourceHasMoreParameters) {
@@ -63066,7 +63574,9 @@ function createTypeChecker(host) {
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
const s = source.flags;
const t = target.flags;
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
+ return true;
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
return true;
if (t & 131072 /* Never */)
return false;
@@ -63193,7 +63703,6 @@ function createTypeChecker(host) {
let overrideNextErrorInfo = 0;
let lastSkippedInfo;
let incompatibleStack;
- let inPropertyCheck = false;
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
const result = isRelatedTo(
source,
@@ -63390,7 +63899,8 @@ function createTypeChecker(host) {
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
}
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
const constraint = getBaseConstraintOfType(target2);
let needsOriginalSource;
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -63463,7 +63973,7 @@ function createTypeChecker(host) {
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
}
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
- if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) {
+ if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
return -1 /* True */;
}
@@ -63527,7 +64037,7 @@ function createTypeChecker(host) {
return 0 /* False */;
}
}
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
if (reportErrors2) {
@@ -63589,7 +64099,7 @@ function createTypeChecker(host) {
maybeSuppress = !!errorInfo;
}
}
- if (source2.flags & 524288 /* Object */ && target2.flags & 131068 /* Primitive */) {
+ if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
@@ -63735,15 +64245,15 @@ function createTypeChecker(host) {
}
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
if (source2.flags & 1048576 /* Union */) {
- return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState);
+ return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
}
if (target2.flags & 1048576 /* Union */) {
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */) && !(target2.flags & 131068 /* Primitive */));
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
}
if (target2.flags & 2097152 /* Intersection */) {
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
}
- if (relation === comparableRelation && target2.flags & 131068 /* Primitive */) {
+ if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
if (constraints !== source2.types) {
source2 = getIntersectionType(constraints);
@@ -64151,14 +64661,15 @@ function createTypeChecker(host) {
);
}
}
- if (result2 && !inPropertyCheck && (target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */)))) {
- inPropertyCheck = true;
+ if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
result2 &= propertiesRelatedTo(
source2,
target2,
reportErrors2,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
@@ -64171,7 +64682,17 @@ function createTypeChecker(host) {
0 /* None */
);
}
- inPropertyCheck = false;
+ } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
+ result2 &= propertiesRelatedTo(
+ source2,
+ target2,
+ reportErrors2,
+ /*excludedProperties*/
+ void 0,
+ /*optionalsOnly*/
+ true,
+ intersectionState
+ );
}
}
if (result2) {
@@ -64625,7 +65146,7 @@ function createTypeChecker(host) {
}
return 0 /* False */;
}
- const sourceIsPrimitive = !!(sourceFlags & 131068 /* Primitive */);
+ const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
if (relation !== identityRelation) {
source2 = getApparentType(source2);
sourceFlags = source2.flags;
@@ -64661,12 +65182,14 @@ function createTypeChecker(host) {
reportStructuralErrors,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
intersectionState
);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
if (result2) {
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
}
@@ -64795,6 +65318,8 @@ function createTypeChecker(host) {
/*reportErrors*/
false,
excludedProperties,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2) {
@@ -64803,7 +65328,8 @@ function createTypeChecker(host) {
type,
0 /* Call */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2) {
result2 &= signaturesRelatedTo(
@@ -64811,7 +65337,8 @@ function createTypeChecker(host) {
type,
1 /* Construct */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
result2 &= indexSignaturesRelatedTo(
@@ -64989,7 +65516,7 @@ function createTypeChecker(host) {
}
}
}
- function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
+ function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source2, target2, excludedProperties);
}
@@ -65125,7 +65652,7 @@ function createTypeChecker(host) {
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
for (const targetProp of excludeProperties(properties, excludedProperties)) {
const name = targetProp.escapedName;
- if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
+ if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
const sourceProp = getPropertyOfType(source2, name);
if (sourceProp && sourceProp !== targetProp) {
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
@@ -65161,7 +65688,7 @@ function createTypeChecker(host) {
}
return result2;
}
- function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
+ function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
var _a3, _b;
if (relation === identityRelation) {
return signaturesIdenticalTo(source2, target2, kind);
@@ -65198,6 +65725,7 @@ function createTypeChecker(host) {
/*erase*/
true,
reportErrors2,
+ intersectionState,
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
);
if (!related) {
@@ -65209,7 +65737,7 @@ function createTypeChecker(host) {
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
const sourceSignature = first(sourceSignatures);
const targetSignature = first(targetSignatures);
- result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
+ result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
const constructSignatureToString = (signature) => signatureToString(
signature,
@@ -65234,6 +65762,7 @@ function createTypeChecker(host) {
/*erase*/
true,
shouldElaborateErrors,
+ intersectionState,
incompatibleReporter(s, t)
);
if (related) {
@@ -65286,17 +65815,29 @@ function createTypeChecker(host) {
}
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
}
- function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
+ function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
return compareSignaturesRelated(
erase ? getErasedSignature(source2) : source2,
erase ? getErasedSignature(target2) : target2,
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
+ checkMode,
reportErrors2,
reportError,
incompatibleReporter,
- isRelatedToWorker,
+ isRelatedToWorker2,
reportUnreliableMapper
);
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
+ return isRelatedTo(
+ source3,
+ target3,
+ 3 /* Both */,
+ reportErrors3,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
+ }
}
function signaturesIdenticalTo(source2, target2, kind) {
const sourceSignatures = getSignaturesOfType(source2, kind);
@@ -65355,7 +65896,7 @@ function createTypeChecker(host) {
}
for (const info of getIndexInfosOfType(source2)) {
if (isApplicableIndexType(info.keyType, keyType)) {
- const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
+ const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
if (!related) {
return 0 /* False */;
}
@@ -65364,8 +65905,16 @@ function createTypeChecker(host) {
}
return result2;
}
- function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
- const related = isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */, reportErrors2);
+ function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
+ const related = isRelatedTo(
+ sourceInfo.type,
+ targetInfo.type,
+ 3 /* Both */,
+ reportErrors2,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
if (!related && reportErrors2) {
if (sourceInfo.keyType === targetInfo.keyType) {
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -65394,9 +65943,9 @@ function createTypeChecker(host) {
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
if (sourceInfo) {
- return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
+ return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
}
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
}
if (reportErrors2) {
@@ -65685,12 +66234,15 @@ function createTypeChecker(host) {
}
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
if (depth >= maxDepth) {
+ if (type.flags & 2097152 /* Intersection */) {
+ return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
+ }
const identity2 = getRecursionIdentity(type);
let count = 0;
let lastTypeId = 0;
for (let i = 0; i < depth; i++) {
const t = stack[i];
- if (getRecursionIdentity(t) === identity2) {
+ if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
if (t.id >= lastTypeId) {
count++;
if (count >= maxDepth) {
@@ -65923,15 +66475,25 @@ function createTypeChecker(host) {
return propType;
}
if (everyType(type, isTupleType)) {
- return mapType(type, (t) => getRestTypeOfTupleType(t) || undefinedType);
+ return mapType(type, (t) => {
+ const tupleType = t;
+ const restType = getRestTypeOfTupleType(tupleType);
+ if (!restType) {
+ return undefinedType;
+ }
+ if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) {
+ return getUnionType([restType, undefinedType]);
+ }
+ return restType;
+ });
}
return void 0;
}
function isNeitherUnitTypeNorNever(type) {
- return !(type.flags & (109440 /* Unit */ | 131072 /* Never */));
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
}
function isUnitType(type) {
- return !!(type.flags & 109440 /* Unit */);
+ return !!(type.flags & 109472 /* Unit */);
}
function isUnitLikeType(type) {
const t = getBaseConstraintOrType(type);
@@ -65944,15 +66506,18 @@ function createTypeChecker(host) {
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
}
function getBaseTypeOfLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
+ return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
}
function getBaseTypeOfLiteralTypeUnion(type) {
var _a2;
const key = `B${getTypeId(type)}`;
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
}
+ function getBaseTypeOfLiteralTypeForComparison(type) {
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
+ }
function getWidenedLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
+ return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
}
function getWidenedUniqueESSymbolType(type) {
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
@@ -65993,7 +66558,7 @@ function createTypeChecker(host) {
const restType = getRestTypeOfTupleType(type);
return restType && createArrayType(restType);
}
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
const length2 = getTypeReferenceArity(type) - endSkipCount;
if (index < length2) {
const typeArguments = getTypeArguments(type);
@@ -66002,7 +66567,7 @@ function createTypeChecker(host) {
const t = typeArguments[i];
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
}
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
return void 0;
}
@@ -66070,7 +66635,7 @@ function createTypeChecker(host) {
}
function isObjectTypeWithInferableIndex(type) {
const objectFlags = getObjectFlags(type);
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
}
function createSymbolWithType(source, type) {
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -66308,6 +66873,11 @@ function createTypeChecker(host) {
case 320 /* JSDocFunctionType */:
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
+ case 326 /* JSDocSignature */:
+ if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
+ error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
+ }
+ return;
case 259 /* FunctionDeclaration */:
case 171 /* MethodDeclaration */:
case 170 /* MethodSignature */:
@@ -66480,8 +67050,8 @@ function createTypeChecker(host) {
}
return false;
}
- function isTypeParameterAtTopLevel(type, typeParameter) {
- return !!(type === typeParameter || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, typeParameter)) || type.flags & 16777216 /* Conditional */ && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
+ function isTypeParameterAtTopLevel(type, tp, depth = 0) {
+ return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
}
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
const typePredicate = getTypePredicateOfSignature(signature);
@@ -66575,7 +67145,7 @@ function createTypeChecker(host) {
yield targetProp;
} else if (matchDiscriminantProperties) {
const targetType = getTypeOfSymbol(targetProp);
- if (targetType.flags & 109440 /* Unit */) {
+ if (targetType.flags & 109472 /* Unit */) {
const sourceType = getTypeOfSymbol(sourceProp);
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
yield targetProp;
@@ -66636,10 +67206,10 @@ function createTypeChecker(host) {
return getBigIntLiteralType(parseValidBigInt(text));
}
function isMemberOfStringMapping(source, target) {
- if (target.flags & (4 /* String */ | 1 /* Any */)) {
+ if (target.flags & 1 /* Any */) {
return true;
}
- if (target.flags & 134217728 /* TemplateLiteral */) {
+ if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
return isTypeAssignableTo(source, target);
}
if (target.flags & 268435456 /* StringMapping */) {
@@ -67334,7 +67904,7 @@ function createTypeChecker(host) {
}
function hasPrimitiveConstraint(type) {
const constraint = getConstraintOfTypeParameter(type);
- return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
}
function isObjectLiteralType2(type) {
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
@@ -67816,7 +68386,7 @@ function createTypeChecker(host) {
return 83886079 /* UnknownFacts */;
}
function getIntersectionTypeFacts(type) {
- const ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
+ const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
let oredFacts = 0 /* None */;
let andedFacts = 134217727 /* All */;
for (const t of type.types) {
@@ -68015,7 +68585,7 @@ function createTypeChecker(host) {
}
return true;
}
- if (source.flags & 1024 /* EnumLiteral */ && getBaseTypeOfEnumLiteralType(source) === target) {
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
return true;
}
return containsType(target.types, source);
@@ -68053,7 +68623,7 @@ function createTypeChecker(host) {
}
return getUnionTypeFromSortedList(
filtered,
- type.objectFlags,
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
/*aliasSymbol*/
void 0,
/*aliasTypeArguments*/
@@ -68411,10 +68981,12 @@ function createTypeChecker(host) {
}
function isConstantReference(node) {
switch (node.kind) {
- case 79 /* Identifier */: {
- const symbol = getResolvedSymbol(node);
- return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
- }
+ case 79 /* Identifier */:
+ if (!isThisInTypeQuery(node)) {
+ const symbol = getResolvedSymbol(node);
+ return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
+ }
+ break;
case 208 /* PropertyAccessExpression */:
case 209 /* ElementAccessExpression */:
return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
@@ -68560,7 +69132,7 @@ function createTypeChecker(host) {
}
return declaredType;
}
- if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) {
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
}
return void 0;
@@ -69077,7 +69649,7 @@ function createTypeChecker(host) {
}
if (assumeTrue) {
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
- if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
+ if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
return valueType;
}
if (valueType.flags & 524288 /* Object */) {
@@ -69110,7 +69682,7 @@ function createTypeChecker(host) {
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
}
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
- return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
+ return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getAdjustedTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
}
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
const everyClauseChecks = clauseStart !== clauseEnd && every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -69127,7 +69699,7 @@ function createTypeChecker(host) {
let groundClauseTypes;
for (let i = 0; i < clauseTypes.length; i += 1) {
const t = clauseTypes[i];
- if (t.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
+ if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
if (groundClauseTypes !== void 0) {
groundClauseTypes.push(t);
}
@@ -69246,52 +69818,58 @@ function createTypeChecker(host) {
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
return type;
}
- let targetType;
- const prototypeProperty = getPropertyOfType(rightType, "prototype");
- if (prototypeProperty) {
- const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
- if (!isTypeAny(prototypePropertyType)) {
- targetType = prototypePropertyType;
- }
- }
- if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
+ const instanceType = mapType(rightType, getInstanceType);
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
return type;
}
- if (!targetType) {
- const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
- targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
- }
- if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
- const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
- if (!nonConstructorTypeInUnion)
- return type;
- }
return getNarrowedType(
type,
- targetType,
+ instanceType,
assumeTrue,
/*checkDerived*/
true
);
}
+ function getInstanceType(constructorType) {
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
+ return prototypePropertyType;
+ }
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
+ if (constructSignatures.length) {
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
+ }
+ return emptyObjectType;
+ }
function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
var _a3;
const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
}
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
if (!assumeTrue) {
- return filterType(type, (t) => !isRelated(t, candidate));
+ if (checkDerived) {
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
+ }
+ const trueType2 = getNarrowedType(
+ type,
+ candidate,
+ /*assumeTrue*/
+ true,
+ /*checkDerived*/
+ false
+ );
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
}
if (type.flags & 3 /* AnyOrUnknown */) {
return candidate;
}
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
const narrowedType = mapType(candidate, (c) => {
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
+ const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
});
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -69395,7 +69973,7 @@ function createTypeChecker(host) {
}
}
function getTypeOfSymbolAtLocation(symbol, location) {
- symbol = symbol.exportSymbol || symbol;
+ symbol = getExportSymbolOfValueSymbolIfExported(symbol);
if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) {
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
@@ -69447,15 +70025,25 @@ function createTypeChecker(host) {
function isConstVariable(symbol) {
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
}
- function removeOptionalityFromDeclaredType(declaredType, declaration) {
- if (pushTypeResolution(declaration.symbol, 2 /* DeclaredType */)) {
- const annotationIncludesUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
- popTypeResolution();
- return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
- } else {
- reportCircularityError(declaration.symbol);
- return declaredType;
+ function parameterInitializerContainsUndefined(declaration) {
+ const links = getNodeLinks(declaration);
+ if (links.parameterInitializerContainsUndefined === void 0) {
+ if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
+ if (!popTypeResolution()) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ links.parameterInitializerContainsUndefined = containsUndefined;
}
+ return links.parameterInitializerContainsUndefined;
+ }
+ function removeOptionalityFromDeclaredType(declaredType, declaration) {
+ const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
+ return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
}
function isConstraintPosition(type, node) {
const parent2 = node.parent;
@@ -70566,9 +71154,18 @@ function createTypeChecker(host) {
if (prop) {
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
}
- if (isTupleType(t)) {
- const restType = getRestTypeOfTupleType(t);
- if (restType && isNumericLiteralName(name) && +name >= 0) {
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
+ const restType = getElementTypeOfSliceOfTupleType(
+ t,
+ t.target.fixedLength,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ );
+ if (restType) {
return restType;
}
}
@@ -70615,9 +71212,18 @@ function createTypeChecker(host) {
return void 0;
}
function getContextualTypeForElementExpression(arrayContextualType, index) {
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
arrayContextualType,
- (t) => getIteratedTypeOrElementType(
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
+ t,
+ 0,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ ) : getIteratedTypeOrElementType(
1 /* Element */,
t,
undefinedType,
@@ -70770,14 +71376,17 @@ function createTypeChecker(host) {
return type;
}
function getContextualType2(node, contextFlags) {
+ var _a2, _b;
if (node.flags & 33554432 /* InWithStatement */) {
return void 0;
}
- const index = findContextualNode(node);
+ const index = findContextualNode(
+ node,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
- const cached = contextualTypes[index];
- if (cached || !contextFlags)
- return cached;
+ return contextualTypes[index];
}
const { parent: parent2 } = node;
switch (parent2.kind) {
@@ -70812,7 +71421,9 @@ function createTypeChecker(host) {
case 206 /* ArrayLiteralExpression */: {
const arrayLiteral = parent2;
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
}
case 224 /* ConditionalExpression */:
return getContextualTypeForConditionalOperand(node, contextFlags);
@@ -70848,17 +71459,30 @@ function createTypeChecker(host) {
}
return void 0;
}
- function pushContextualType(node, type) {
+ function pushCachedContextualType(node) {
+ pushContextualType(
+ node,
+ getContextualType2(
+ node,
+ /*contextFlags*/
+ void 0
+ ),
+ /*isCache*/
+ true
+ );
+ }
+ function pushContextualType(node, type, isCache) {
contextualTypeNodes[contextualTypeCount] = node;
contextualTypes[contextualTypeCount] = type;
+ contextualIsCache[contextualTypeCount] = isCache;
contextualTypeCount++;
}
function popContextualType() {
contextualTypeCount--;
}
- function findContextualNode(node) {
+ function findContextualNode(node, includeCaches) {
for (let i = contextualTypeCount - 1; i >= 0; i--) {
- if (node === contextualTypeNodes[i]) {
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
return i;
}
}
@@ -70881,7 +71505,11 @@ function createTypeChecker(host) {
}
function getContextualJsxElementAttributesType(node, contextFlags) {
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
- const index = findContextualNode(node.parent);
+ const index = findContextualNode(
+ node.parent,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
return contextualTypes[index];
}
@@ -71152,11 +71780,7 @@ function createTypeChecker(host) {
const elementCount = elements.length;
const elementTypes = [];
const elementFlags = [];
- pushContextualType(node, getContextualType2(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const inDestructuringPattern = isAssignmentTarget(node);
const inConstContext = isConstContext(node);
const contextualType = getApparentTypeOfContextualType(
@@ -71319,11 +71943,7 @@ function createTypeChecker(host) {
let propertiesTable = createSymbolTable();
let propertiesArray = [];
let spread = emptyObjectType;
- pushContextualType(node, getContextualType2(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const contextualType = getApparentTypeOfContextualType(
node,
/*contextFlags*/
@@ -72610,7 +73230,7 @@ function createTypeChecker(host) {
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
let errorInfo;
let relatedInfo;
- if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 131068 /* Primitive */)) {
+ if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
for (const subtype of containingType.types) {
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
@@ -72663,26 +73283,22 @@ function createTypeChecker(host) {
function getSuggestedLibForNonExistentName(name) {
const missingName = diagnosticName(name);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const containingTypes = getOwnKeys(allFeatures[libTarget]);
- if (containingTypes !== void 0 && contains(containingTypes, missingName)) {
- return libTarget;
- }
- }
+ const typeFeatures = allFeatures.get(missingName);
+ return typeFeatures && firstIterator(typeFeatures.keys());
}
function getSuggestedLibForNonExistentProperty(missingProperty, containingType) {
const container = getApparentType(containingType).symbol;
if (!container) {
return void 0;
}
+ const containingTypeName = symbolName(container);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const featuresOfLib = allFeatures[libTarget];
- const featuresOfContainingType = featuresOfLib[symbolName(container)];
- if (featuresOfContainingType !== void 0 && contains(featuresOfContainingType, missingProperty)) {
- return libTarget;
+ const typeFeatures = allFeatures.get(containingTypeName);
+ if (typeFeatures) {
+ for (const [libTarget, featuresOfType] of typeFeatures) {
+ if (contains(featuresOfType, missingProperty)) {
+ return libTarget;
+ }
}
}
}
@@ -73211,7 +73827,7 @@ function createTypeChecker(host) {
} else {
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
- const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
flags.push(1 /* Required */);
}
@@ -73745,7 +74361,7 @@ function createTypeChecker(host) {
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
const isDecorator2 = node.kind === 167 /* Decorator */;
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
- const reportErrors2 = !candidatesOutArray;
+ const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
let typeArguments;
if (!isDecorator2 && !isSuperCall(node)) {
typeArguments = node.typeArguments;
@@ -74704,7 +75320,7 @@ function createTypeChecker(host) {
}
}
function checkCallExpression(node, checkMode) {
- var _a2;
+ var _a2, _b, _c;
checkGrammarTypeArguments(node, node.typeArguments);
const signature = getResolvedSignature(
node,
@@ -74721,7 +75337,7 @@ function createTypeChecker(host) {
}
if (node.kind === 211 /* NewExpression */) {
const declaration = signature.declaration;
- if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
+ if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
if (noImplicitAny) {
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
}
@@ -74749,7 +75365,7 @@ function createTypeChecker(host) {
/*allowDeclaration*/
false
);
- if ((_a2 = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _a2.size) {
+ if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
return getIntersectionType([returnType, jsAssignmentType]);
@@ -75035,6 +75651,9 @@ function createTypeChecker(host) {
checkGrammarExpressionWithTypeArguments(node);
forEach(node.typeArguments, checkSourceElement);
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
+ return getInstantiationExpressionType(exprType, node);
+ }
+ function getInstantiationExpressionType(exprType, node) {
const typeArguments = node.typeArguments;
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
return exprType;
@@ -76458,10 +77077,10 @@ function createTypeChecker(host) {
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 131068 /* Primitive */)) {
+ if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
}
return booleanType;
@@ -76983,8 +77602,8 @@ function createTypeChecker(host) {
case 32 /* LessThanEqualsToken */:
case 33 /* GreaterThanEqualsToken */:
if (checkForDisallowedESSymbolOperand(operator)) {
- leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
- rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
+ leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
+ rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
reportOperatorErrorUnless((left2, right2) => {
if (isTypeAny(left2) || isTypeAny(right2)) {
return true;
@@ -77044,7 +77663,7 @@ function createTypeChecker(host) {
return leftType;
} else {
checkAssignmentOperator(rightType);
- return getRegularTypeOfObjectLiteral(rightType);
+ return rightType;
}
case 27 /* CommaToken */:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -77335,14 +77954,19 @@ function createTypeChecker(host) {
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
}
function getContextNode2(node) {
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
return node.parent.parent;
}
return node;
}
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
const contextNode = getContextNode2(node);
- pushContextualType(contextNode, contextualType);
+ pushContextualType(
+ contextNode,
+ contextualType,
+ /*isCache*/
+ false
+ );
pushInferenceContext(contextNode, inferenceContext);
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -77673,7 +78297,7 @@ function createTypeChecker(host) {
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
return checkExpression(node);
}
return void 0;
@@ -77683,7 +78307,12 @@ function createTypeChecker(host) {
if (links.contextFreeType) {
return links.contextFreeType;
}
- pushContextualType(node, anyType);
+ pushContextualType(
+ node,
+ anyType,
+ /*isCache*/
+ false
+ );
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
popContextualType();
return type;
@@ -77898,7 +78527,7 @@ function createTypeChecker(host) {
error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
}
}
- if ((node.questionToken || isJSDocOptionalParameter(node)) && isBindingPattern(node.name) && func.body) {
+ if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
}
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
@@ -78420,8 +79049,8 @@ function createTypeChecker(host) {
}
return void 0;
}
- function getTypeParametersForTypeReference(node) {
- const type = getTypeFromTypeReference(node);
+ function getTypeParametersForTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
const symbol = getNodeLinks(node).resolvedSymbol;
if (symbol) {
@@ -78439,11 +79068,14 @@ function createTypeChecker(host) {
}
}
forEach(node.typeArguments, checkSourceElement);
- const type = getTypeFromTypeReference(node);
+ checkTypeReferenceOrImport(node);
+ }
+ function checkTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
if (node.typeArguments) {
addLazyDiagnostic(() => {
- const typeParameters = getTypeParametersForTypeReference(node);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(node);
if (typeParameters) {
checkTypeArgumentConstraints(node, typeParameters);
}
@@ -78465,7 +79097,7 @@ function createTypeChecker(host) {
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
if (!typeReferenceNode)
return void 0;
- const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReferenceNode);
if (!typeParameters)
return void 0;
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
@@ -78645,7 +79277,7 @@ function createTypeChecker(host) {
}
}
}
- getTypeFromTypeNode(node);
+ checkTypeReferenceOrImport(node);
}
function checkNamedTupleMember(node) {
if (node.dotDotDotToken && node.questionToken) {
@@ -78810,6 +79442,17 @@ function createTypeChecker(host) {
lastSeenNonAmbientDeclaration = node;
}
}
+ if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
+ for (const node2 of current.jsDoc) {
+ if (node2.tags) {
+ for (const tag of node2.tags) {
+ if (isJSDocOverloadTag(tag)) {
+ hasOverloads = true;
+ }
+ }
+ }
+ }
+ }
}
}
if (multipleConstructorImplementation) {
@@ -78847,8 +79490,9 @@ function createTypeChecker(host) {
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
for (const signature of signatures) {
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
+ const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
addRelatedInfo(
- error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
+ error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
);
break;
@@ -78941,6 +79585,9 @@ function createTypeChecker(host) {
case 273 /* ImportSpecifier */:
case 79 /* Identifier */:
return 1 /* ExportValue */;
+ case 170 /* MethodSignature */:
+ case 168 /* PropertySignature */:
+ return 2 /* ExportType */;
default:
return Debug.failBadSyntaxKind(d);
}
@@ -78964,7 +79611,7 @@ function createTypeChecker(host) {
))) {
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
}
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return void 0;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -79016,7 +79663,7 @@ function createTypeChecker(host) {
return awaitedType || errorType;
}
function isThenableType(type) {
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return false;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -79065,7 +79712,7 @@ function createTypeChecker(host) {
return awaitedType;
}
}
- Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
+ Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
return type;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -81878,20 +82525,19 @@ function createTypeChecker(host) {
}
}
}
- function getMemberOverrideModifierStatus(node, member) {
+ function getMemberOverrideModifierStatus(node, member, memberSymbol) {
if (!member.name) {
return 0 /* Ok */;
}
- const symbol = getSymbolOfDeclaration(node);
- const type = getDeclaredTypeOfSymbol(symbol);
+ const classSymbol = getSymbolOfDeclaration(node);
+ const type = getDeclaredTypeOfSymbol(classSymbol);
const typeWithThis = getTypeWithThisArgument(type);
- const staticType = getTypeOfSymbol(symbol);
+ const staticType = getTypeOfSymbol(classSymbol);
const baseTypeNode = getEffectiveBaseTypeNode(node);
const baseTypes = baseTypeNode && getBaseTypes(type);
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
const baseStaticType = getBaseConstructorTypeOfClass(type);
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
- const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
return checkMemberForOverrideModifier(
node,
staticType,
@@ -81904,7 +82550,7 @@ function createTypeChecker(host) {
isStatic(member),
/* memberIsParameterProperty */
false,
- memberName
+ symbolName(memberSymbol)
);
}
function getTargetSymbol(s) {
@@ -82456,7 +83102,7 @@ function createTypeChecker(host) {
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
}
}
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
if (exportModifier) {
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -82787,8 +83433,6 @@ function createTypeChecker(host) {
} else {
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
- } else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
- grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
}
@@ -82943,7 +83587,7 @@ function createTypeChecker(host) {
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
- const sym = resolveEntityName(
+ const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
id,
67108863 /* All */,
/*ignoreErrors*/
@@ -82951,7 +83595,7 @@ function createTypeChecker(host) {
/*dontResolveAlias*/
true,
node
- );
+ ));
if (sym) {
markAliasReferenced(sym, id);
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
@@ -82995,8 +83639,6 @@ function createTypeChecker(host) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
- } else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
- grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
}
}
}
@@ -83324,6 +83966,8 @@ function createTypeChecker(host) {
if (!(links.flags & 1 /* TypeChecked */)) {
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
links.deferredNodes.add(node);
+ } else {
+ Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
}
}
function checkDeferredNodes(context) {
@@ -83331,6 +83975,7 @@ function createTypeChecker(host) {
if (links.deferredNodes) {
links.deferredNodes.forEach(checkDeferredNode);
}
+ links.deferredNodes = void 0;
}
function checkDeferredNode(node) {
var _a2, _b;
@@ -83586,7 +84231,7 @@ function createTypeChecker(host) {
}
return node.parent.kind === 180 /* TypeReference */;
}
- function isHeritageClauseElementIdentifier(node) {
+ function isInNameOfExpressionWithTypeArguments(node) {
while (node.parent.kind === 208 /* PropertyAccessExpression */) {
node = node.parent;
}
@@ -83696,10 +84341,10 @@ function createTypeChecker(host) {
while (isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
name = name.parent;
}
- if (isHeritageClauseElementIdentifier(name)) {
+ if (isInNameOfExpressionWithTypeArguments(name)) {
let meaning = 0 /* None */;
if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) {
- meaning = 788968 /* Type */;
+ meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */;
if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
meaning |= 111551 /* Value */;
}
@@ -84105,8 +84750,8 @@ function createTypeChecker(host) {
}
return getNamedMembers(propsByName);
}
- function typeHasCallOrConstructSignatures2(type) {
- return typeHasCallOrConstructSignatures(type, checker);
+ function typeHasCallOrConstructSignatures(type) {
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
}
function getRootSymbols(symbol) {
const roots = getImmediateRootSymbols(symbol);
@@ -84411,7 +85056,7 @@ function createTypeChecker(host) {
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
}
function getTypeReferenceSerializationKind(typeNameIn, location) {
- var _a2, _b;
+ var _a2;
const typeName = getParseTreeNode(typeNameIn, isEntityName);
if (!typeName)
return 0 /* Unknown */;
@@ -84443,7 +85088,7 @@ function createTypeChecker(host) {
location
);
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
- isTypeOnly || (isTypeOnly = !!((_b = valueSymbol == null ? void 0 : valueSymbol.declarations) == null ? void 0 : _b.every(isTypeOnlyImportOrExportDeclaration)));
+ isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
const typeSymbol = resolveEntityName(
typeName,
788968 /* Type */,
@@ -84594,7 +85239,7 @@ function createTypeChecker(host) {
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- const enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
type.symbol,
111551 /* Value */,
enclosing,
@@ -85137,6 +85782,7 @@ function createTypeChecker(host) {
let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator;
let flags = 0 /* None */;
let sawExportBeforeDecorators = false;
+ let hasLeadingDecorators = false;
for (const modifier of node.modifiers) {
if (isDecorator(modifier)) {
if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) {
@@ -85154,8 +85800,22 @@ function createTypeChecker(host) {
if (flags & ~(1025 /* ExportDefault */ | 131072 /* Decorator */)) {
return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
}
+ if (hasLeadingDecorators && flags & 126975 /* Modifier */) {
+ Debug.assertIsDefined(firstDecorator);
+ const sourceFile = getSourceFileOfNode(modifier);
+ if (!hasParseDiagnostics(sourceFile)) {
+ addRelatedInfo(
+ error(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
+ );
+ return true;
+ }
+ return false;
+ }
flags |= 131072 /* Decorator */;
- if (flags & 1 /* Export */) {
+ if (!(flags & 126975 /* Modifier */)) {
+ hasLeadingDecorators = true;
+ } else if (flags & 1 /* Export */) {
sawExportBeforeDecorators = true;
}
firstDecorator != null ? firstDecorator : firstDecorator = modifier;
@@ -85443,7 +86103,6 @@ function createTypeChecker(host) {
case 299 /* PropertyAssignment */:
case 300 /* ShorthandPropertyAssignment */:
case 267 /* NamespaceExportDeclaration */:
- case 181 /* FunctionType */:
case 279 /* MissingDeclaration */:
return find(node.modifiers, isModifier);
default:
@@ -86140,7 +86799,7 @@ function createTypeChecker(host) {
}
function isSimpleLiteralEnumReference(expr) {
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
- return !!(checkExpressionCached(expr).flags & 1024 /* EnumLiteral */);
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
}
}
function checkAmbientInitializer(node) {
@@ -86542,10 +87201,10 @@ function createTypeChecker(host) {
}
function findMostOverlappyType(source, unionTarget) {
let bestMatch;
- if (!(source.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
let matchingCount = 0;
for (const target of unionTarget.types) {
- if (!(target.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
if (overlap.flags & 4194304 /* Index */) {
return target;
@@ -86563,7 +87222,7 @@ function createTypeChecker(host) {
}
function filterPrimitivesIfContainsNonPrimitive(type) {
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
- const result = filterType(type, (t) => !(t.flags & 131068 /* Primitive */));
+ const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
if (!(result.flags & 131072 /* Never */)) {
return result;
}
@@ -87966,7 +88625,7 @@ var visitEachChildTable = {
[291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
return context.factory.updateJsxExpression(
node,
- Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
+ nodeVisitor(node.expression, visitor, isExpression)
);
},
// Clauses
@@ -88053,31 +88712,31 @@ function extractSingleNode(nodes) {
// src/compiler/sourcemap.ts
function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
- const { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
- const rawSources = [];
- const sources = [];
- const sourceToSourceIndexMap = /* @__PURE__ */ new Map();
- let sourcesContent;
- const names = [];
- let nameToNameIndexMap;
- const mappingCharCodes = [];
- let mappings = "";
- let lastGeneratedLine = 0;
- let lastGeneratedCharacter = 0;
- let lastSourceIndex = 0;
- let lastSourceLine = 0;
- let lastSourceCharacter = 0;
- let lastNameIndex = 0;
- let hasLast = false;
- let pendingGeneratedLine = 0;
- let pendingGeneratedCharacter = 0;
- let pendingSourceIndex = 0;
- let pendingSourceLine = 0;
- let pendingSourceCharacter = 0;
- let pendingNameIndex = 0;
- let hasPending = false;
- let hasPendingSource = false;
- let hasPendingName = false;
+ var { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
+ var rawSources = [];
+ var sources = [];
+ var sourceToSourceIndexMap = /* @__PURE__ */ new Map();
+ var sourcesContent;
+ var names = [];
+ var nameToNameIndexMap;
+ var mappingCharCodes = [];
+ var mappings = "";
+ var lastGeneratedLine = 0;
+ var lastGeneratedCharacter = 0;
+ var lastSourceIndex = 0;
+ var lastSourceLine = 0;
+ var lastSourceCharacter = 0;
+ var lastNameIndex = 0;
+ var hasLast = false;
+ var pendingGeneratedLine = 0;
+ var pendingGeneratedCharacter = 0;
+ var pendingSourceIndex = 0;
+ var pendingSourceLine = 0;
+ var pendingSourceCharacter = 0;
+ var pendingNameIndex = 0;
+ var hasPending = false;
+ var hasPendingSource = false;
+ var hasPendingName = false;
return {
getSources: () => rawSources,
addSource,
@@ -91312,7 +91971,7 @@ function transformTypeScript(context) {
return node;
}
function tryGetConstEnumValue(node) {
- if (compilerOptions.isolatedModules) {
+ if (getIsolatedModules(compilerOptions)) {
return void 0;
}
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
@@ -91861,7 +92520,16 @@ function transformClassFields(context) {
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
);
}
- return visitEachChild(node, visitor, context);
+ return factory2.updatePropertyDeclaration(
+ node,
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
+ visitNode(node.name, propertyNameVisitor, isPropertyName),
+ /*questionOrExclamationToken*/
+ void 0,
+ /*type*/
+ void 0,
+ visitNode(node.initializer, visitor, isExpression)
+ );
}
function transformPublicFieldInitializer(node) {
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
@@ -97194,7 +97862,7 @@ function transformES2018(context) {
);
}
function visitBinaryExpression(node, expressionResultIsUnused2) {
- if (isDestructuringAssignment(node) && node.left.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (isDestructuringAssignment(node) && containsObjectRestOrSpread(node.left)) {
return flattenDestructuringAssignment(
node,
visitor,
@@ -97326,7 +97994,7 @@ function transformES2018(context) {
}
function visitForOfStatement(node, outermostLabeledStatement) {
const ancestorFacts = enterSubtree(0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */);
- if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */ || isAssignmentPattern(node.initializer) && containsObjectRestOrSpread(node.initializer)) {
node = transformForOfStatementWithObjectRest(node);
}
const result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory2.restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
@@ -105163,6 +105831,9 @@ function transformModule(context) {
return visitEachChild(node, visitor, context);
}
function visitImportCallExpression(node) {
+ if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
+ return visitEachChild(node, visitor, context);
+ }
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
@@ -107639,7 +108310,7 @@ function transformECMAScriptModule(context) {
if (node.isDeclarationFile) {
return node;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
currentSourceFile = node;
importRequireStatements = void 0;
let result = updateExternalModule(node);
@@ -107846,7 +108517,7 @@ function transformECMAScriptModule(context) {
}
function onEmitNode(hint, node, emitCallback) {
if (isSourceFile(node)) {
- if ((isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) {
+ if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
helperNameSubstitutions = /* @__PURE__ */ new Map();
}
previousOnEmitNode(hint, node, emitCallback);
@@ -108698,7 +109369,7 @@ function transformDeclarations(context) {
if (elem.kind === 229 /* OmittedExpression */) {
return elem;
}
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
return factory2.updateBindingElement(
elem,
elem.dotDotDotToken,
@@ -110571,15 +111242,15 @@ function getFirstProjectOutput(configFile, ignoreCase) {
return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
}
function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
- const compilerOptions = host.getCompilerOptions();
- const sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
- const emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
- const emitterDiagnostics = createDiagnosticCollection();
- const newLine = getNewLineCharacter(compilerOptions);
- const writer = createTextWriter(newLine);
- const { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
- let bundleBuildInfo;
- let emitSkipped = false;
+ var compilerOptions = host.getCompilerOptions();
+ var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
+ var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
+ var emitterDiagnostics = createDiagnosticCollection();
+ var newLine = getNewLineCharacter(compilerOptions);
+ var writer = createTextWriter(newLine);
+ var { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
+ var bundleBuildInfo;
+ var emitSkipped = false;
enter();
forEachEmittedFile(
host,
@@ -111141,12 +111812,12 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
);
return outputFiles;
}
-var createPrinterWithDefaults = memoize(() => createPrinter({}));
-var createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
-var createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
-var createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
+var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
+var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
+var createPrinterWithRemoveCommentsNeverAsciiEscape = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
+var createPrinterWithRemoveCommentsOmitTrailingSemicolon = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
function createPrinter(printerOptions = {}, handlers = {}) {
- const {
+ var {
hasGlobalName,
onEmitNode = noEmitNotification,
isEmitNotificationEnabled,
@@ -111158,57 +111829,57 @@ function createPrinter(printerOptions = {}, handlers = {}) {
onBeforeEmitToken,
onAfterEmitToken
} = handlers;
- const extendedDiagnostics = !!printerOptions.extendedDiagnostics;
- const newLine = getNewLineCharacter(printerOptions);
- const moduleKind = getEmitModuleKind(printerOptions);
- const bundledHelpers = /* @__PURE__ */ new Map();
- let currentSourceFile;
- let nodeIdToGeneratedName;
- let nodeIdToGeneratedPrivateName;
- let autoGeneratedIdToGeneratedName;
- let generatedNames;
- let formattedNameTempFlagsStack;
- let formattedNameTempFlags;
- let privateNameTempFlagsStack;
- let privateNameTempFlags;
- let tempFlagsStack;
- let tempFlags;
- let reservedNamesStack;
- let reservedNames;
- let reservedPrivateNamesStack;
- let reservedPrivateNames;
- let preserveSourceNewlines = printerOptions.preserveSourceNewlines;
- let nextListElementPos;
- let writer;
- let ownWriter;
- let write = writeBase;
- let isOwnFileEmit;
- const bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
- const relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
- const recordInternalSection = printerOptions.recordInternalSection;
- let sourceFileTextPos = 0;
- let sourceFileTextKind = "text" /* Text */;
- let sourceMapsDisabled = true;
- let sourceMapGenerator;
- let sourceMapSource;
- let sourceMapSourceIndex = -1;
- let mostRecentlyAddedSourceMapSource;
- let mostRecentlyAddedSourceMapSourceIndex = -1;
- let containerPos = -1;
- let containerEnd = -1;
- let declarationListContainerEnd = -1;
- let currentLineMap;
- let detachedCommentsInfo;
- let hasWrittenComment = false;
- let commentsDisabled = !!printerOptions.removeComments;
- let lastSubstitution;
- let currentParenthesizerRule;
- const { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
- const parenthesizer = factory.parenthesizer;
- const typeArgumentParenthesizerRuleSelector = {
+ var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
+ var newLine = getNewLineCharacter(printerOptions);
+ var moduleKind = getEmitModuleKind(printerOptions);
+ var bundledHelpers = /* @__PURE__ */ new Map();
+ var currentSourceFile;
+ var nodeIdToGeneratedName;
+ var nodeIdToGeneratedPrivateName;
+ var autoGeneratedIdToGeneratedName;
+ var generatedNames;
+ var formattedNameTempFlagsStack;
+ var formattedNameTempFlags;
+ var privateNameTempFlagsStack;
+ var privateNameTempFlags;
+ var tempFlagsStack;
+ var tempFlags;
+ var reservedNamesStack;
+ var reservedNames;
+ var reservedPrivateNamesStack;
+ var reservedPrivateNames;
+ var preserveSourceNewlines = printerOptions.preserveSourceNewlines;
+ var nextListElementPos;
+ var writer;
+ var ownWriter;
+ var write = writeBase;
+ var isOwnFileEmit;
+ var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
+ var relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
+ var recordInternalSection = printerOptions.recordInternalSection;
+ var sourceFileTextPos = 0;
+ var sourceFileTextKind = "text" /* Text */;
+ var sourceMapsDisabled = true;
+ var sourceMapGenerator;
+ var sourceMapSource;
+ var sourceMapSourceIndex = -1;
+ var mostRecentlyAddedSourceMapSource;
+ var mostRecentlyAddedSourceMapSourceIndex = -1;
+ var containerPos = -1;
+ var containerEnd = -1;
+ var declarationListContainerEnd = -1;
+ var currentLineMap;
+ var detachedCommentsInfo;
+ var hasWrittenComment = false;
+ var commentsDisabled = !!printerOptions.removeComments;
+ var lastSubstitution;
+ var currentParenthesizerRule;
+ var { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
+ var parenthesizer = factory.parenthesizer;
+ var typeArgumentParenthesizerRuleSelector = {
select: (index) => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : void 0
};
- const emitBinaryExpression = createEmitBinaryExpression();
+ var emitBinaryExpression = createEmitBinaryExpression();
reset2();
return {
// public API
@@ -111467,9 +112138,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
formattedNameTempFlagsStack = [];
formattedNameTempFlags = /* @__PURE__ */ new Map();
privateNameTempFlagsStack = [];
- privateNameTempFlags = TempFlags.Auto;
+ privateNameTempFlags = 0 /* Auto */;
tempFlagsStack = [];
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
reservedNamesStack = [];
reservedNames = void 0;
reservedPrivateNamesStack = [];
@@ -112438,7 +113109,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitTypeLiteral(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -112627,7 +113298,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitObjectLiteralExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -113393,7 +114064,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitClassDeclarationOrExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -113426,7 +114097,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
function emitInterfaceDeclaration(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -114869,7 +115540,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
return;
}
tempFlagsStack.push(tempFlags);
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
formattedNameTempFlagsStack.push(formattedNameTempFlags);
formattedNameTempFlags = void 0;
reservedNamesStack.push(reservedNames);
@@ -115055,7 +115726,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
case "#":
return privateNameTempFlags;
default:
- return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : TempFlags.Auto;
+ return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : 0 /* Auto */;
}
}
function setTempFlags(formattedNameKey, flags) {
@@ -115079,7 +115750,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
const key = formatGeneratedName(privateName, prefix, "", suffix);
let tempFlags2 = getTempFlags(key);
if (flags && !(tempFlags2 & flags)) {
- const name = flags === TempFlags._i ? "_i" : "_n";
+ const name = flags === 268435456 /* _i */ ? "_i" : "_n";
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
if (isUniqueName(fullName, privateName)) {
tempFlags2 |= flags;
@@ -115093,7 +115764,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
}
}
while (true) {
- const count = tempFlags2 & TempFlags.CountMask;
+ const count = tempFlags2 & 268435455 /* CountMask */;
tempFlags2++;
if (count !== 8 && count !== 13) {
const name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
@@ -115237,7 +115908,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
return generateNameCached(node.name, privateName);
}
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reservedInNestedScopes*/
false,
privateName,
@@ -115294,7 +115965,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
return generateNameForMethodOrAccessor(node, privateName, prefix, suffix);
case 164 /* ComputedPropertyName */:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
true,
privateName,
@@ -115303,7 +115974,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
);
default:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
false,
privateName,
@@ -115318,11 +115989,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
const suffix = formatGeneratedNamePart(autoGenerate.suffix);
switch (autoGenerate.flags & 7 /* KindMask */) {
case 1 /* Auto */:
- return makeTempVariableName(TempFlags.Auto, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
+ return makeTempVariableName(0 /* Auto */, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
case 2 /* Loop */:
Debug.assertNode(name, isIdentifier);
return makeTempVariableName(
- TempFlags._i,
+ 268435456 /* _i */,
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
/*privateName*/
false,
@@ -115792,12 +116463,6 @@ function getOpeningBracket(format) {
function getClosingBracket(format) {
return brackets[format & 15360 /* BracketsMask */][1];
}
-var TempFlags = /* @__PURE__ */ ((TempFlags2) => {
- TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
- TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
- TempFlags2[TempFlags2["_i"] = 268435456] = "_i";
- return TempFlags2;
-})(TempFlags || {});
function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
emit(node);
}
@@ -116775,14 +117440,14 @@ var moduleResolutionNameAndModeGetter = {
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
return {
nameAndMode: moduleResolutionNameAndModeGetter,
- resolve: (moduleName, resoluionMode) => resolveModuleName(
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
moduleName,
containingFile,
options,
host,
cache,
redirectedReference,
- resoluionMode
+ resolutionMode
)
};
}
@@ -118321,11 +118986,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
} else if (isClassDeclaration(parent2)) {
const exportIndex = findIndex(parent2.modifiers, isExportModifier);
- const defaultIndex = findIndex(parent2.modifiers, isDefaultModifier);
- if (exportIndex >= 0 && decoratorIndex < exportIndex) {
- diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_must_come_after_export_or_export_default_in_JavaScript_files));
- } else if (defaultIndex >= 0 && decoratorIndex < defaultIndex) {
- diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ if (exportIndex >= 0) {
+ const defaultIndex = findIndex(parent2.modifiers, isDefaultModifier);
+ if (decoratorIndex > exportIndex && defaultIndex >= 0 && decoratorIndex < defaultIndex) {
+ diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ } else if (exportIndex >= 0 && decoratorIndex < exportIndex) {
+ const trailingDecoratorIndex = findIndex(parent2.modifiers, isDecorator, exportIndex);
+ if (trailingDecoratorIndex >= 0) {
+ diagnostics.push(addRelatedInfo(
+ createDiagnosticForNode2(parent2.modifiers[trailingDecoratorIndex], Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorator_used_before_export_here)
+ ));
+ }
+ }
}
}
}
@@ -118503,7 +119176,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
let imports;
let moduleAugmentations;
let ambientModules;
- if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) {
+ if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
if (options.importHelpers) {
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
}
@@ -119224,12 +119897,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
}
- if (options.isolatedModules) {
+ if (options.isolatedModules || options.verbatimModuleSyntax) {
if (options.out) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
if (options.outFile) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
}
if (options.inlineSourceMap) {
@@ -119440,10 +120113,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
}
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
- createDiagnosticForOptionName(Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
}
+ const moduleKind = getEmitModuleKind(options);
if (options.verbatimModuleSyntax) {
- const moduleKind = getEmitModuleKind(options);
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
}
@@ -119462,13 +120135,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
}
const moduleResolution = getEmitModuleResolutionKind(options);
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
}
if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
}
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ }
+ if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
}
if (!options.noEmit && !options.suppressOutputPathCheck) {
const emitHost = getEmitHost();
@@ -119623,7 +120299,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
if (version2 === "6.0" /* v6_0 */) {
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
} else {
- createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
+ createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
}
}
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
@@ -120644,7 +121320,7 @@ var BuilderState;
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
}
const compilerOptions = programOfThisState.getCompilerOptions();
- if (compilerOptions && (compilerOptions.isolatedModules || outFile(compilerOptions))) {
+ if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
return [sourceFileWithUpdatedShape];
}
const seenFileNamesMap = /* @__PURE__ */ new Map();
@@ -121069,7 +121745,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
return;
if (!isChangedSignature(state, affectedFile.resolvedPath))
return;
- if (state.compilerOptions.isolatedModules) {
+ if (getIsolatedModules(state.compilerOptions)) {
const seenFileNamesMap = /* @__PURE__ */ new Map();
seenFileNamesMap.set(affectedFile.resolvedPath, true);
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
@@ -121162,14 +121838,17 @@ function getBuildInfo2(state, bundle) {
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
const fileNames = [];
const fileNameToFileId = /* @__PURE__ */ new Map();
+ const root = [];
if (outFile(state.compilerOptions)) {
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
- toFileId(key);
+ const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
});
const program2 = {
fileNames,
fileInfos: fileInfos2,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
outSignature: state.outSignature,
latestChangedDtsFile,
@@ -121197,6 +121876,7 @@ function getBuildInfo2(state, bundle) {
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
var _a3, _b2;
const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
const oldSignature = (_a3 = state.oldSignatures) == null ? void 0 : _a3.get(key);
const actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value.signature;
@@ -121296,6 +121976,7 @@ function getBuildInfo2(state, bundle) {
const program = {
fileNames,
fileInfos,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
fileIdsList,
referencedMap,
@@ -121331,6 +122012,24 @@ function getBuildInfo2(state, bundle) {
}
return fileIdListId;
}
+ function tryAddRoot(path, fileId) {
+ const file = state.program.getSourceFile(path);
+ if (!state.program.getFileIncludeReasons().get(file.path).some((r) => r.kind === 0 /* RootFile */))
+ return;
+ if (!root.length)
+ return root.push(fileId);
+ const last2 = root[root.length - 1];
+ const isLastStartEnd = isArray(last2);
+ if (isLastStartEnd && last2[1] === fileId - 1)
+ return last2[1] = fileId;
+ if (isLastStartEnd || root.length === 1 || last2 !== fileId - 1)
+ return root.push(fileId);
+ const lastButOne = root[root.length - 2];
+ if (!isNumber(lastButOne) || lastButOne !== last2 - 1)
+ return root.push(fileId);
+ root[root.length - 2] = [lastButOne, fileId];
+ return root.length = root.length - 1;
+ }
function convertToProgramBuildInfoCompilerOptions(options) {
let result;
const { optionsNameMap } = getOptionsNameMap();
@@ -121843,12 +122542,28 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
const fileInfos = /* @__PURE__ */ new Map();
+ let rootIndex = 0;
+ const roots = [];
program.fileInfos.forEach((fileInfo, index) => {
const path = toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
const version2 = isString(fileInfo) ? fileInfo : fileInfo.version;
fileInfos.set(path, version2);
+ if (rootIndex < program.root.length) {
+ const current = program.root[rootIndex];
+ const fileId = index + 1;
+ if (isArray(current)) {
+ if (current[0] <= fileId && fileId <= current[1]) {
+ roots.push(path);
+ if (current[1] === fileId)
+ rootIndex++;
+ }
+ } else if (current === fileId) {
+ roots.push(path);
+ rootIndex++;
+ }
+ }
});
- return fileInfos;
+ return { fileInfos, roots };
}
function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
return {
@@ -122763,7 +123478,7 @@ function getPlainDiagnosticFollowingNewLines(diagnostic, newLine) {
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
}
function getLocaleTimeString(system) {
- return !system.now ? new Date().toLocaleTimeString() : (
+ return !system.now ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : (
// On some systems / builds of Node, there's a non-breaking space between the time and AM/PM.
// This branch is solely for testing, so just switch it to a normal space for baseline stability.
// See:
@@ -124118,13 +124833,14 @@ var UpToDateStatusType = /* @__PURE__ */ ((UpToDateStatusType2) => {
UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 9] = "OutOfDateOptions";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 10] = "UpstreamOutOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 11] = "UpstreamBlocked";
- UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 12] = "ComputingUpstream";
- UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 13] = "TsVersionOutputOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 14] = "UpToDateWithInputFileText";
- UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 15] = "ContainerOnly";
- UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 16] = "ForceBuild";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 10] = "OutOfDateRoots";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 11] = "UpstreamOutOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 12] = "UpstreamBlocked";
+ UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 13] = "ComputingUpstream";
+ UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 14] = "TsVersionOutputOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 15] = "UpToDateWithInputFileText";
+ UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 16] = "ContainerOnly";
+ UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 17] = "ForceBuild";
return UpToDateStatusType2;
})(UpToDateStatusType || {});
function resolveConfigFileProjectName(project) {
@@ -124135,8 +124851,8 @@ function resolveConfigFileProjectName(project) {
}
// src/compiler/tsbuildPublic.ts
-var minimumDate = new Date(-864e13);
-var maximumDate = new Date(864e13);
+var minimumDate = /* @__PURE__ */ new Date(-864e13);
+var maximumDate = /* @__PURE__ */ new Date(864e13);
function getOrCreateValueFromConfigFileMap(configFileMap, resolved, createT) {
const existingValue = configFileMap.get(resolved);
let newValue;
@@ -124150,7 +124866,7 @@ function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, () => /* @__PURE__ */ new Map());
}
function getCurrentTime(host) {
- return host.now ? host.now() : new Date();
+ return host.now ? host.now() : /* @__PURE__ */ new Date();
}
function isCircularBuildOrder(buildOrder) {
return !!buildOrder && !!buildOrder.buildOrder;
@@ -125018,7 +125734,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
}
continue;
}
- if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 14 /* UpToDateWithInputFileText */) {
+ if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
return {
kind: 2 /* UpdateOutputFileStamps */,
@@ -125030,7 +125746,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
};
}
}
- if (status.type === 11 /* UpstreamBlocked */) {
+ if (status.type === 12 /* UpstreamBlocked */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -125044,7 +125760,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
}
continue;
}
- if (status.type === 15 /* ContainerOnly */) {
+ if (status.type === 16 /* ContainerOnly */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -125231,31 +125947,31 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
var _a2, _b;
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
return {
- type: 15 /* ContainerOnly */
+ type: 16 /* ContainerOnly */
};
}
let referenceStatuses;
const force = !!state.options.force;
if (project.projectReferences) {
- state.projectStatus.set(resolvedPath, { type: 12 /* ComputingUpstream */ });
+ state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
for (const ref of project.projectReferences) {
const resolvedRef = resolveProjectReferencePath(ref);
const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
- if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
+ if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
continue;
}
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
+ if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */) {
return {
- type: 11 /* UpstreamBlocked */,
+ type: 12 /* UpstreamBlocked */,
upstreamProjectName: ref.path,
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
+ upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
};
}
if (refStatus.type !== 1 /* UpToDate */) {
return {
- type: 10 /* UpstreamOutOfDate */,
+ type: 11 /* UpstreamOutOfDate */,
upstreamProjectName: ref.path
};
}
@@ -125264,7 +125980,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
}
}
if (force)
- return { type: 16 /* ForceBuild */ };
+ return { type: 17 /* ForceBuild */ };
const { host } = state;
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
let oldestOutputFileName;
@@ -125297,7 +126013,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
}
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== version) {
return {
- type: 13 /* TsVersionOutputOfDate */,
+ type: 14 /* TsVersionOutputOfDate */,
version: buildInfo.version
};
}
@@ -125322,6 +126038,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
let newestInputFileName = void 0;
let newestInputFileTime = minimumDate;
let pseudoInputUpToDate = false;
+ const seenRoots = /* @__PURE__ */ new Set();
for (const inputFile of project.fileNames) {
const inputTime = getModifiedTime2(state, inputFile);
if (inputTime === missingFileModifiedTime) {
@@ -125336,7 +126053,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
if (buildInfoProgram) {
if (!buildInfoVersionMap)
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
- version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
+ version2 = buildInfoVersionMap.fileInfos.get(toPath2(state, inputFile));
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
if (version2 && version2 === currentVersion)
@@ -125354,6 +126071,21 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
newestInputFileName = inputFile;
newestInputFileTime = inputTime;
}
+ if (buildInfoProgram)
+ seenRoots.add(toPath2(state, inputFile));
+ }
+ if (buildInfoProgram) {
+ if (!buildInfoVersionMap)
+ buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
+ for (const existingRoot of buildInfoVersionMap.roots) {
+ if (!seenRoots.has(existingRoot)) {
+ return {
+ type: 10 /* OutOfDateRoots */,
+ buildInfoFile: buildInfoPath,
+ inputFile: existingRoot
+ };
+ }
+ }
}
if (!buildInfoPath) {
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
@@ -125435,7 +126167,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
};
}
return {
- type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 14 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
+ type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
newestInputFileTime,
newestInputFileName,
oldestOutputFileName
@@ -125554,7 +126286,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
}
break;
}
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
case 2 /* UpToDateWithUpstreamTypes */:
case 3 /* OutOfDateWithPrepend */:
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -125565,7 +126297,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
});
}
break;
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
clearProjectStatus(state, nextProjectPath);
}
@@ -126016,6 +126748,14 @@ function reportUpToDateStatus(state, configFileName, status) {
relName(state, configFileName),
relName(state, status.buildInfoFile)
);
+ case 10 /* OutOfDateRoots */:
+ return reportStatus(
+ state,
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
+ relName(state, configFileName),
+ relName(state, status.buildInfoFile),
+ relName(state, status.inputFile)
+ );
case 1 /* UpToDate */:
if (status.newestInputFileTime !== void 0) {
return reportStatus(
@@ -126040,20 +126780,20 @@ function reportUpToDateStatus(state, configFileName, status) {
Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
relName(state, configFileName)
);
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
return reportStatus(
state,
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
relName(state, configFileName)
);
- case 10 /* UpstreamOutOfDate */:
+ case 11 /* UpstreamOutOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
return reportStatus(
state,
status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
@@ -126067,7 +126807,7 @@ function reportUpToDateStatus(state, configFileName, status) {
relName(state, configFileName),
status.reason
);
- case 13 /* TsVersionOutputOfDate */:
+ case 14 /* TsVersionOutputOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
@@ -126075,14 +126815,14 @@ function reportUpToDateStatus(state, configFileName, status) {
status.version,
version
);
- case 16 /* ForceBuild */:
+ case 17 /* ForceBuild */:
return reportStatus(
state,
Diagnostics.Project_0_is_being_forcibly_rebuilt,
relName(state, configFileName)
);
- case 15 /* ContainerOnly */:
- case 12 /* ComputingUpstream */:
+ case 16 /* ContainerOnly */:
+ case 13 /* ComputingUpstream */:
break;
default:
assertType(status);
@@ -126441,2655 +127181,316 @@ function findArgument(argumentName) {
return index >= 0 && index < sys.args.length - 1 ? sys.args[index + 1] : void 0;
}
function nowString() {
- const d = new Date();
+ const d = /* @__PURE__ */ new Date();
return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`;
}
-// src/server/_namespaces/ts.server.ts
-var ts_server_exports2 = {};
-__export(ts_server_exports2, {
- ActionInvalidate: () => ActionInvalidate,
- ActionPackageInstalled: () => ActionPackageInstalled,
- ActionSet: () => ActionSet,
- Arguments: () => Arguments,
- AutoImportProviderProject: () => AutoImportProviderProject,
- CharRangeSection: () => CharRangeSection,
- CommandNames: () => CommandNames,
- ConfigFileDiagEvent: () => ConfigFileDiagEvent,
- ConfiguredProject: () => ConfiguredProject2,
- Errors: () => Errors,
- EventBeginInstallTypes: () => EventBeginInstallTypes,
- EventEndInstallTypes: () => EventEndInstallTypes,
- EventInitializationFailed: () => EventInitializationFailed,
- EventTypesRegistry: () => EventTypesRegistry,
- ExternalProject: () => ExternalProject2,
- GcTimer: () => GcTimer,
- InferredProject: () => InferredProject2,
- LargeFileReferencedEvent: () => LargeFileReferencedEvent,
- LineIndex: () => LineIndex,
- LineLeaf: () => LineLeaf,
- LineNode: () => LineNode,
- LogLevel: () => LogLevel2,
- Msg: () => Msg,
- OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
- Project: () => Project3,
- ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
- ProjectKind: () => ProjectKind,
- ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
- ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
- ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
- ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
- ProjectService: () => ProjectService3,
- ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
- ScriptInfo: () => ScriptInfo,
- ScriptVersionCache: () => ScriptVersionCache,
- Session: () => Session3,
- TextStorage: () => TextStorage,
- ThrottledOperations: () => ThrottledOperations,
- TypingsCache: () => TypingsCache,
- allFilesAreJsOrDts: () => allFilesAreJsOrDts,
- allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
- asNormalizedPath: () => asNormalizedPath,
- convertCompilerOptions: () => convertCompilerOptions,
- convertFormatOptions: () => convertFormatOptions,
- convertScriptKindName: () => convertScriptKindName,
- convertTypeAcquisition: () => convertTypeAcquisition,
- convertUserPreferences: () => convertUserPreferences,
- convertWatchOptions: () => convertWatchOptions,
- countEachFileTypes: () => countEachFileTypes,
- createInstallTypingsRequest: () => createInstallTypingsRequest,
- createModuleSpecifierCache: () => createModuleSpecifierCache,
- createNormalizedPathMap: () => createNormalizedPathMap,
- createPackageJsonCache: () => createPackageJsonCache,
- createSortedArray: () => createSortedArray2,
- emptyArray: () => emptyArray2,
- findArgument: () => findArgument,
- forEachResolvedProjectReferenceProject: () => forEachResolvedProjectReferenceProject,
- formatMessage: () => formatMessage2,
- getBaseConfigFileName: () => getBaseConfigFileName,
- getLocationInNewDocument: () => getLocationInNewDocument,
- hasArgument: () => hasArgument,
- hasNoTypeScriptSource: () => hasNoTypeScriptSource,
- indent: () => indent2,
- isConfigFile: () => isConfigFile,
- isConfiguredProject: () => isConfiguredProject,
- isDynamicFileName: () => isDynamicFileName,
- isExternalProject: () => isExternalProject,
- isInferredProject: () => isInferredProject,
- isInferredProjectName: () => isInferredProjectName,
- makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
- makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
- makeInferredProjectName: () => makeInferredProjectName,
- maxFileSize: () => maxFileSize,
- maxProgramSizeForNonTsFiles: () => maxProgramSizeForNonTsFiles,
- normalizedPathToPath: () => normalizedPathToPath,
- nowString: () => nowString,
- nullCancellationToken: () => nullCancellationToken,
- nullTypingsInstaller: () => nullTypingsInstaller,
- projectContainsInfoDirectly: () => projectContainsInfoDirectly,
- protocol: () => ts_server_protocol_exports,
- removeSorted: () => removeSorted,
- stringifyIndented: () => stringifyIndented,
- toEvent: () => toEvent,
- toNormalizedPath: () => toNormalizedPath,
- tryConvertScriptKindName: () => tryConvertScriptKindName,
- updateProjectIfDirty: () => updateProjectIfDirty
-});
-
-// src/server/_namespaces/ts.ts
-var ts_exports3 = {};
-__export(ts_exports3, {
- ANONYMOUS: () => ANONYMOUS,
- AccessFlags: () => AccessFlags,
- AssertionLevel: () => AssertionLevel,
- AssignmentDeclarationKind: () => AssignmentDeclarationKind,
- AssignmentKind: () => AssignmentKind,
- Associativity: () => Associativity,
- BreakpointResolver: () => ts_BreakpointResolver_exports,
- BuilderFileEmit: () => BuilderFileEmit,
- BuilderProgramKind: () => BuilderProgramKind,
- BuilderState: () => BuilderState,
- BundleFileSectionKind: () => BundleFileSectionKind,
- CallHierarchy: () => ts_CallHierarchy_exports,
- CharacterCodes: () => CharacterCodes,
- CheckFlags: () => CheckFlags,
- CheckMode: () => CheckMode,
- ClassificationType: () => ClassificationType,
- ClassificationTypeNames: () => ClassificationTypeNames,
- CommentDirectiveType: () => CommentDirectiveType,
- Comparison: () => Comparison,
- CompletionInfoFlags: () => CompletionInfoFlags,
- CompletionTriggerKind: () => CompletionTriggerKind,
- Completions: () => ts_Completions_exports,
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
- ContextFlags: () => ContextFlags,
- CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
- Debug: () => Debug,
- DeprecationVersion: () => DeprecationVersion,
- DiagnosticCategory: () => DiagnosticCategory,
- Diagnostics: () => Diagnostics,
- DocumentHighlights: () => DocumentHighlights,
- ElementFlags: () => ElementFlags,
- EmitFlags: () => EmitFlags,
- EmitHint: () => EmitHint,
- EmitOnly: () => EmitOnly,
- EndOfLineState: () => EndOfLineState,
- EnumKind: () => EnumKind,
- ExitStatus: () => ExitStatus,
- ExportKind: () => ExportKind,
- Extension: () => Extension,
- ExternalEmitHelpers: () => ExternalEmitHelpers,
- FileIncludeKind: () => FileIncludeKind,
- FilePreprocessingDiagnosticsKind: () => FilePreprocessingDiagnosticsKind,
- FileSystemEntryKind: () => FileSystemEntryKind,
- FileWatcherEventKind: () => FileWatcherEventKind,
- FindAllReferences: () => ts_FindAllReferences_exports,
- FlattenLevel: () => FlattenLevel,
- FlowFlags: () => FlowFlags,
- ForegroundColorEscapeSequences: () => ForegroundColorEscapeSequences,
- FunctionFlags: () => FunctionFlags,
- GeneratedIdentifierFlags: () => GeneratedIdentifierFlags,
- GetLiteralTextFlags: () => GetLiteralTextFlags,
- GoToDefinition: () => ts_GoToDefinition_exports,
- HighlightSpanKind: () => HighlightSpanKind,
- ImportKind: () => ImportKind,
- ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
- IndentStyle: () => IndentStyle,
- IndexKind: () => IndexKind,
- InferenceFlags: () => InferenceFlags,
- InferencePriority: () => InferencePriority,
- InlayHintKind: () => InlayHintKind,
- InlayHints: () => ts_InlayHints_exports,
- InternalEmitFlags: () => InternalEmitFlags,
- InternalSymbolName: () => InternalSymbolName,
- InvalidatedProjectKind: () => InvalidatedProjectKind,
- JsDoc: () => ts_JsDoc_exports,
- JsTyping: () => ts_JsTyping_exports,
- JsxEmit: () => JsxEmit,
- JsxFlags: () => JsxFlags,
- JsxReferenceKind: () => JsxReferenceKind,
- LanguageServiceMode: () => LanguageServiceMode,
- LanguageServiceShimHostAdapter: () => LanguageServiceShimHostAdapter,
- LanguageVariant: () => LanguageVariant,
- LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
- ListFormat: () => ListFormat,
- LogLevel: () => LogLevel,
- MemberOverrideStatus: () => MemberOverrideStatus,
- ModifierFlags: () => ModifierFlags,
- ModuleDetectionKind: () => ModuleDetectionKind,
- ModuleInstanceState: () => ModuleInstanceState,
- ModuleKind: () => ModuleKind,
- ModuleResolutionKind: () => ModuleResolutionKind,
- ModuleSpecifierEnding: () => ModuleSpecifierEnding,
- NavigateTo: () => ts_NavigateTo_exports,
- NavigationBar: () => ts_NavigationBar_exports,
- NewLineKind: () => NewLineKind,
- NodeBuilderFlags: () => NodeBuilderFlags,
- NodeCheckFlags: () => NodeCheckFlags,
- NodeFactoryFlags: () => NodeFactoryFlags,
- NodeFlags: () => NodeFlags,
- NodeResolutionFeatures: () => NodeResolutionFeatures,
- ObjectFlags: () => ObjectFlags,
- OperationCanceledException: () => OperationCanceledException,
- OperatorPrecedence: () => OperatorPrecedence,
- OrganizeImports: () => ts_OrganizeImports_exports,
- OrganizeImportsMode: () => OrganizeImportsMode,
- OuterExpressionKinds: () => OuterExpressionKinds,
- OutliningElementsCollector: () => ts_OutliningElementsCollector_exports,
- OutliningSpanKind: () => OutliningSpanKind,
- OutputFileType: () => OutputFileType,
- PackageJsonAutoImportPreference: () => PackageJsonAutoImportPreference,
- PackageJsonDependencyGroup: () => PackageJsonDependencyGroup,
- PatternMatchKind: () => PatternMatchKind,
- PollingInterval: () => PollingInterval,
- PollingWatchKind: () => PollingWatchKind,
- PragmaKindFlags: () => PragmaKindFlags,
- PrivateIdentifierKind: () => PrivateIdentifierKind,
- ProcessLevel: () => ProcessLevel,
- QuotePreference: () => QuotePreference,
- RelationComparisonResult: () => RelationComparisonResult,
- Rename: () => ts_Rename_exports,
- ScriptElementKind: () => ScriptElementKind,
- ScriptElementKindModifier: () => ScriptElementKindModifier,
- ScriptKind: () => ScriptKind,
- ScriptSnapshot: () => ScriptSnapshot,
- ScriptTarget: () => ScriptTarget,
- SemanticClassificationFormat: () => SemanticClassificationFormat,
- SemanticMeaning: () => SemanticMeaning,
- SemicolonPreference: () => SemicolonPreference,
- SignatureCheckMode: () => SignatureCheckMode,
- SignatureFlags: () => SignatureFlags,
- SignatureHelp: () => ts_SignatureHelp_exports,
- SignatureKind: () => SignatureKind,
- SmartSelectionRange: () => ts_SmartSelectionRange_exports,
- SnippetKind: () => SnippetKind,
- SortKind: () => SortKind,
- StructureIsReused: () => StructureIsReused,
- SymbolAccessibility: () => SymbolAccessibility,
- SymbolDisplay: () => ts_SymbolDisplay_exports,
- SymbolDisplayPartKind: () => SymbolDisplayPartKind,
- SymbolFlags: () => SymbolFlags,
- SymbolFormatFlags: () => SymbolFormatFlags,
- SyntaxKind: () => SyntaxKind,
- SyntheticSymbolKind: () => SyntheticSymbolKind,
- Ternary: () => Ternary,
- ThrottledCancellationToken: () => ThrottledCancellationToken,
- TokenClass: () => TokenClass,
- TokenFlags: () => TokenFlags,
- TransformFlags: () => TransformFlags,
- TypeFacts: () => TypeFacts,
- TypeFlags: () => TypeFlags,
- TypeFormatFlags: () => TypeFormatFlags,
- TypeMapKind: () => TypeMapKind,
- TypePredicateKind: () => TypePredicateKind,
- TypeReferenceSerializationKind: () => TypeReferenceSerializationKind,
- TypeScriptServicesFactory: () => TypeScriptServicesFactory,
- UnionReduction: () => UnionReduction,
- UpToDateStatusType: () => UpToDateStatusType,
- VarianceFlags: () => VarianceFlags,
- Version: () => Version,
- VersionRange: () => VersionRange,
- WatchDirectoryFlags: () => WatchDirectoryFlags,
- WatchDirectoryKind: () => WatchDirectoryKind,
- WatchFileKind: () => WatchFileKind,
- WatchLogLevel: () => WatchLogLevel,
- WatchType: () => WatchType,
- accessPrivateIdentifier: () => accessPrivateIdentifier,
- addEmitFlags: () => addEmitFlags,
- addEmitHelper: () => addEmitHelper,
- addEmitHelpers: () => addEmitHelpers,
- addInternalEmitFlags: () => addInternalEmitFlags,
- addNodeFactoryPatcher: () => addNodeFactoryPatcher,
- addObjectAllocatorPatcher: () => addObjectAllocatorPatcher,
- addRange: () => addRange,
- addRelatedInfo: () => addRelatedInfo,
- addSyntheticLeadingComment: () => addSyntheticLeadingComment,
- addSyntheticTrailingComment: () => addSyntheticTrailingComment,
- addToSeen: () => addToSeen,
- advancedAsyncSuperHelper: () => advancedAsyncSuperHelper,
- affectsDeclarationPathOptionDeclarations: () => affectsDeclarationPathOptionDeclarations,
- affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
- allKeysStartWithDot: () => allKeysStartWithDot,
- altDirectorySeparator: () => altDirectorySeparator,
- and: () => and,
- append: () => append,
- appendIfUnique: () => appendIfUnique,
- arrayFrom: () => arrayFrom,
- arrayIsEqualTo: () => arrayIsEqualTo,
- arrayIsHomogeneous: () => arrayIsHomogeneous,
- arrayIsSorted: () => arrayIsSorted,
- arrayOf: () => arrayOf,
- arrayReverseIterator: () => arrayReverseIterator,
- arrayToMap: () => arrayToMap,
- arrayToMultiMap: () => arrayToMultiMap,
- arrayToNumericMap: () => arrayToNumericMap,
- arraysEqual: () => arraysEqual,
- assertType: () => assertType,
- assign: () => assign,
- assignHelper: () => assignHelper,
- asyncDelegator: () => asyncDelegator,
- asyncGeneratorHelper: () => asyncGeneratorHelper,
- asyncSuperHelper: () => asyncSuperHelper,
- asyncValues: () => asyncValues,
- attachFileToDiagnostics: () => attachFileToDiagnostics,
- awaitHelper: () => awaitHelper,
- awaiterHelper: () => awaiterHelper,
- base64decode: () => base64decode,
- base64encode: () => base64encode,
- binarySearch: () => binarySearch,
- binarySearchKey: () => binarySearchKey,
- bindSourceFile: () => bindSourceFile,
- breakIntoCharacterSpans: () => breakIntoCharacterSpans,
- breakIntoWordSpans: () => breakIntoWordSpans,
- buildLinkParts: () => buildLinkParts,
- buildOpts: () => buildOpts,
- buildOverload: () => buildOverload,
- bundlerModuleNameResolver: () => bundlerModuleNameResolver,
- canBeConvertedToAsync: () => canBeConvertedToAsync,
- canHaveDecorators: () => canHaveDecorators,
- canHaveExportModifier: () => canHaveExportModifier,
- canHaveFlowNode: () => canHaveFlowNode,
- canHaveIllegalDecorators: () => canHaveIllegalDecorators,
- canHaveIllegalModifiers: () => canHaveIllegalModifiers,
- canHaveIllegalType: () => canHaveIllegalType,
- canHaveIllegalTypeParameters: () => canHaveIllegalTypeParameters,
- canHaveJSDoc: () => canHaveJSDoc,
- canHaveLocals: () => canHaveLocals,
- canHaveModifiers: () => canHaveModifiers,
- canHaveSymbol: () => canHaveSymbol,
- canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
- canProduceDiagnostics: () => canProduceDiagnostics,
- canUsePropertyAccess: () => canUsePropertyAccess,
- canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
- cartesianProduct: () => cartesianProduct,
- cast: () => cast,
- chainBundle: () => chainBundle,
- chainDiagnosticMessages: () => chainDiagnosticMessages,
- changeAnyExtension: () => changeAnyExtension,
- changeCompilerHostLikeToUseCache: () => changeCompilerHostLikeToUseCache,
- changeExtension: () => changeExtension,
- changesAffectModuleResolution: () => changesAffectModuleResolution,
- changesAffectingProgramStructure: () => changesAffectingProgramStructure,
- childIsDecorated: () => childIsDecorated,
- classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
- classOrConstructorParameterIsDecorated: () => classOrConstructorParameterIsDecorated,
- classPrivateFieldGetHelper: () => classPrivateFieldGetHelper,
- classPrivateFieldInHelper: () => classPrivateFieldInHelper,
- classPrivateFieldSetHelper: () => classPrivateFieldSetHelper,
- classicNameResolver: () => classicNameResolver,
- classifier: () => ts_classifier_exports,
- cleanExtendedConfigCache: () => cleanExtendedConfigCache,
- clear: () => clear,
- clearMap: () => clearMap,
- clearSharedExtendedConfigFileWatcher: () => clearSharedExtendedConfigFileWatcher,
- climbPastPropertyAccess: () => climbPastPropertyAccess,
- climbPastPropertyOrElementAccess: () => climbPastPropertyOrElementAccess,
- clone: () => clone,
- cloneCompilerOptions: () => cloneCompilerOptions,
- closeFileWatcher: () => closeFileWatcher,
- closeFileWatcherOf: () => closeFileWatcherOf,
- codefix: () => ts_codefix_exports,
- collapseTextChangeRangesAcrossMultipleVersions: () => collapseTextChangeRangesAcrossMultipleVersions,
- collectExternalModuleInfo: () => collectExternalModuleInfo,
- combine: () => combine,
- combinePaths: () => combinePaths,
- commentPragmas: () => commentPragmas,
- commonOptionsWithBuild: () => commonOptionsWithBuild,
- commonPackageFolders: () => commonPackageFolders,
- compact: () => compact,
- compareBooleans: () => compareBooleans,
- compareDataObjects: () => compareDataObjects,
- compareDiagnostics: () => compareDiagnostics,
- compareDiagnosticsSkipRelatedInformation: () => compareDiagnosticsSkipRelatedInformation,
- compareEmitHelpers: () => compareEmitHelpers,
- compareNumberOfDirectorySeparators: () => compareNumberOfDirectorySeparators,
- comparePaths: () => comparePaths,
- comparePathsCaseInsensitive: () => comparePathsCaseInsensitive,
- comparePathsCaseSensitive: () => comparePathsCaseSensitive,
- comparePatternKeys: () => comparePatternKeys,
- compareProperties: () => compareProperties,
- compareStringsCaseInsensitive: () => compareStringsCaseInsensitive,
- compareStringsCaseInsensitiveEslintCompatible: () => compareStringsCaseInsensitiveEslintCompatible,
- compareStringsCaseSensitive: () => compareStringsCaseSensitive,
- compareStringsCaseSensitiveUI: () => compareStringsCaseSensitiveUI,
- compareTextSpans: () => compareTextSpans,
- compareValues: () => compareValues,
- compileOnSaveCommandLineOption: () => compileOnSaveCommandLineOption,
- compilerOptionsAffectDeclarationPath: () => compilerOptionsAffectDeclarationPath,
- compilerOptionsAffectEmit: () => compilerOptionsAffectEmit,
- compilerOptionsAffectSemanticDiagnostics: () => compilerOptionsAffectSemanticDiagnostics,
- compilerOptionsDidYouMeanDiagnostics: () => compilerOptionsDidYouMeanDiagnostics,
- compilerOptionsIndicateEsModules: () => compilerOptionsIndicateEsModules,
- compose: () => compose,
- computeCommonSourceDirectoryOfFilenames: () => computeCommonSourceDirectoryOfFilenames,
- computeLineAndCharacterOfPosition: () => computeLineAndCharacterOfPosition,
- computeLineOfPosition: () => computeLineOfPosition,
- computeLineStarts: () => computeLineStarts,
- computePositionOfLineAndCharacter: () => computePositionOfLineAndCharacter,
- computeSignature: () => computeSignature,
- computeSignatureWithDiagnostics: () => computeSignatureWithDiagnostics,
- computeSuggestionDiagnostics: () => computeSuggestionDiagnostics,
- concatenate: () => concatenate,
- concatenateDiagnosticMessageChains: () => concatenateDiagnosticMessageChains,
- consumesNodeCoreModules: () => consumesNodeCoreModules,
- contains: () => contains,
- containsIgnoredPath: () => containsIgnoredPath,
- containsParseError: () => containsParseError,
- containsPath: () => containsPath,
- convertCompilerOptionsForTelemetry: () => convertCompilerOptionsForTelemetry,
- convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
- convertJsonOption: () => convertJsonOption,
- convertToBase64: () => convertToBase64,
- convertToObject: () => convertToObject,
- convertToObjectWorker: () => convertToObjectWorker,
- convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
- convertToRelativePath: () => convertToRelativePath,
- convertToTSConfig: () => convertToTSConfig,
- convertTypeAcquisitionFromJson: () => convertTypeAcquisitionFromJson,
- copyComments: () => copyComments,
- copyEntries: () => copyEntries,
- copyLeadingComments: () => copyLeadingComments,
- copyProperties: () => copyProperties,
- copyTrailingAsLeadingComments: () => copyTrailingAsLeadingComments,
- copyTrailingComments: () => copyTrailingComments,
- couldStartTrivia: () => couldStartTrivia,
- countWhere: () => countWhere,
- createAbstractBuilder: () => createAbstractBuilder,
- createAccessorPropertyBackingField: () => createAccessorPropertyBackingField,
- createAccessorPropertyGetRedirector: () => createAccessorPropertyGetRedirector,
- createAccessorPropertySetRedirector: () => createAccessorPropertySetRedirector,
- createBaseNodeFactory: () => createBaseNodeFactory,
- createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
- createBindingHelper: () => createBindingHelper,
- createBuildInfo: () => createBuildInfo,
- createBuilderProgram: () => createBuilderProgram,
- createBuilderProgramUsingProgramBuildInfo: () => createBuilderProgramUsingProgramBuildInfo,
- createBuilderStatusReporter: () => createBuilderStatusReporter,
- createCacheWithRedirects: () => createCacheWithRedirects,
- createCacheableExportInfoMap: () => createCacheableExportInfoMap,
- createCachedDirectoryStructureHost: () => createCachedDirectoryStructureHost,
- createClassifier: () => createClassifier,
- createCommentDirectivesMap: () => createCommentDirectivesMap,
- createCompilerDiagnostic: () => createCompilerDiagnostic,
- createCompilerDiagnosticForInvalidCustomType: () => createCompilerDiagnosticForInvalidCustomType,
- createCompilerDiagnosticFromMessageChain: () => createCompilerDiagnosticFromMessageChain,
- createCompilerHost: () => createCompilerHost,
- createCompilerHostFromProgramHost: () => createCompilerHostFromProgramHost,
- createCompilerHostWorker: () => createCompilerHostWorker,
- createDetachedDiagnostic: () => createDetachedDiagnostic,
- createDiagnosticCollection: () => createDiagnosticCollection,
- createDiagnosticForFileFromMessageChain: () => createDiagnosticForFileFromMessageChain,
- createDiagnosticForNode: () => createDiagnosticForNode,
- createDiagnosticForNodeArray: () => createDiagnosticForNodeArray,
- createDiagnosticForNodeArrayFromMessageChain: () => createDiagnosticForNodeArrayFromMessageChain,
- createDiagnosticForNodeFromMessageChain: () => createDiagnosticForNodeFromMessageChain,
- createDiagnosticForNodeInSourceFile: () => createDiagnosticForNodeInSourceFile,
- createDiagnosticForRange: () => createDiagnosticForRange,
- createDiagnosticMessageChainFromDiagnostic: () => createDiagnosticMessageChainFromDiagnostic,
- createDiagnosticReporter: () => createDiagnosticReporter,
- createDocumentPositionMapper: () => createDocumentPositionMapper,
- createDocumentRegistry: () => createDocumentRegistry,
- createDocumentRegistryInternal: () => createDocumentRegistryInternal,
- createEmitAndSemanticDiagnosticsBuilderProgram: () => createEmitAndSemanticDiagnosticsBuilderProgram,
- createEmitHelperFactory: () => createEmitHelperFactory,
- createEmptyExports: () => createEmptyExports,
- createExpressionForJsxElement: () => createExpressionForJsxElement,
- createExpressionForJsxFragment: () => createExpressionForJsxFragment,
- createExpressionForObjectLiteralElementLike: () => createExpressionForObjectLiteralElementLike,
- createExpressionForPropertyName: () => createExpressionForPropertyName,
- createExpressionFromEntityName: () => createExpressionFromEntityName,
- createExternalHelpersImportDeclarationIfNeeded: () => createExternalHelpersImportDeclarationIfNeeded,
- createFileDiagnostic: () => createFileDiagnostic,
- createFileDiagnosticFromMessageChain: () => createFileDiagnosticFromMessageChain,
- createForOfBindingStatement: () => createForOfBindingStatement,
- createGetCanonicalFileName: () => createGetCanonicalFileName,
- createGetSourceFile: () => createGetSourceFile,
- createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
- createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
- createGetSymbolWalker: () => createGetSymbolWalker,
- createIncrementalCompilerHost: () => createIncrementalCompilerHost,
- createIncrementalProgram: () => createIncrementalProgram,
- createInputFiles: () => createInputFiles,
- createInputFilesWithFilePaths: () => createInputFilesWithFilePaths,
- createInputFilesWithFileTexts: () => createInputFilesWithFileTexts,
- createJsxFactoryExpression: () => createJsxFactoryExpression,
- createLanguageService: () => createLanguageService,
- createLanguageServiceSourceFile: () => createLanguageServiceSourceFile,
- createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
- createModeAwareCache: () => createModeAwareCache,
- createModeAwareCacheKey: () => createModeAwareCacheKey,
- createModuleResolutionCache: () => createModuleResolutionCache,
- createModuleResolutionLoader: () => createModuleResolutionLoader,
- createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
- createMultiMap: () => createMultiMap,
- createNodeConverters: () => createNodeConverters,
- createNodeFactory: () => createNodeFactory,
- createOptionNameMap: () => createOptionNameMap,
- createOverload: () => createOverload,
- createPackageJsonImportFilter: () => createPackageJsonImportFilter,
- createPackageJsonInfo: () => createPackageJsonInfo,
- createParenthesizerRules: () => createParenthesizerRules,
- createPatternMatcher: () => createPatternMatcher,
- createPrependNodes: () => createPrependNodes,
- createPrinter: () => createPrinter,
- createPrinterWithDefaults: () => createPrinterWithDefaults,
- createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
- createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
- createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
- createProgram: () => createProgram,
- createProgramHost: () => createProgramHost,
- createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
- createQueue: () => createQueue,
- createRange: () => createRange,
- createRedirectedBuilderProgram: () => createRedirectedBuilderProgram,
- createResolutionCache: () => createResolutionCache,
- createRuntimeTypeSerializer: () => createRuntimeTypeSerializer,
- createScanner: () => createScanner,
- createSemanticDiagnosticsBuilderProgram: () => createSemanticDiagnosticsBuilderProgram,
- createSet: () => createSet,
- createSolutionBuilder: () => createSolutionBuilder,
- createSolutionBuilderHost: () => createSolutionBuilderHost,
- createSolutionBuilderWithWatch: () => createSolutionBuilderWithWatch,
- createSolutionBuilderWithWatchHost: () => createSolutionBuilderWithWatchHost,
- createSortedArray: () => createSortedArray,
- createSourceFile: () => createSourceFile,
- createSourceMapGenerator: () => createSourceMapGenerator,
- createSourceMapSource: () => createSourceMapSource,
- createSuperAccessVariableStatement: () => createSuperAccessVariableStatement,
- createSymbolTable: () => createSymbolTable,
- createSymlinkCache: () => createSymlinkCache,
- createSystemWatchFunctions: () => createSystemWatchFunctions,
- createTextChange: () => createTextChange,
- createTextChangeFromStartLength: () => createTextChangeFromStartLength,
- createTextChangeRange: () => createTextChangeRange,
- createTextRangeFromNode: () => createTextRangeFromNode,
- createTextRangeFromSpan: () => createTextRangeFromSpan,
- createTextSpan: () => createTextSpan,
- createTextSpanFromBounds: () => createTextSpanFromBounds,
- createTextSpanFromNode: () => createTextSpanFromNode,
- createTextSpanFromRange: () => createTextSpanFromRange,
- createTextSpanFromStringLiteralLikeContent: () => createTextSpanFromStringLiteralLikeContent,
- createTextWriter: () => createTextWriter,
- createTokenRange: () => createTokenRange,
- createTypeChecker: () => createTypeChecker,
- createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
- createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
- createUnparsedSourceFile: () => createUnparsedSourceFile,
- createWatchCompilerHost: () => createWatchCompilerHost2,
- createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
- createWatchCompilerHostOfFilesAndCompilerOptions: () => createWatchCompilerHostOfFilesAndCompilerOptions,
- createWatchFactory: () => createWatchFactory,
- createWatchHost: () => createWatchHost,
- createWatchProgram: () => createWatchProgram,
- createWatchStatusReporter: () => createWatchStatusReporter,
- createWriteFileMeasuringIO: () => createWriteFileMeasuringIO,
- declarationNameToString: () => declarationNameToString,
- decodeMappings: () => decodeMappings,
- decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
- decorateHelper: () => decorateHelper,
- deduplicate: () => deduplicate,
- defaultIncludeSpec: () => defaultIncludeSpec,
- defaultInitCompilerOptions: () => defaultInitCompilerOptions,
- defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
- detectSortCaseSensitivity: () => detectSortCaseSensitivity,
- diagnosticCategoryName: () => diagnosticCategoryName,
- diagnosticToString: () => diagnosticToString,
- directoryProbablyExists: () => directoryProbablyExists,
- directorySeparator: () => directorySeparator,
- displayPart: () => displayPart,
- displayPartsToString: () => displayPartsToString,
- disposeEmitNodes: () => disposeEmitNodes,
- documentSpansEqual: () => documentSpansEqual,
- dumpTracingLegend: () => dumpTracingLegend,
- elementAt: () => elementAt,
- elideNodes: () => elideNodes,
- emitComments: () => emitComments,
- emitDetachedComments: () => emitDetachedComments,
- emitFiles: () => emitFiles,
- emitFilesAndReportErrors: () => emitFilesAndReportErrors,
- emitFilesAndReportErrorsAndGetExitStatus: () => emitFilesAndReportErrorsAndGetExitStatus,
- emitModuleKindIsNonNodeESM: () => emitModuleKindIsNonNodeESM,
- emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
- emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
- emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
- emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
- emitUsingBuildInfo: () => emitUsingBuildInfo,
- emptyArray: () => emptyArray,
- emptyFileSystemEntries: () => emptyFileSystemEntries,
- emptyMap: () => emptyMap,
- emptyOptions: () => emptyOptions,
- emptySet: () => emptySet,
- endsWith: () => endsWith,
- ensurePathIsNonModuleName: () => ensurePathIsNonModuleName,
- ensureScriptKind: () => ensureScriptKind,
- ensureTrailingDirectorySeparator: () => ensureTrailingDirectorySeparator,
- entityNameToString: () => entityNameToString,
- enumerateInsertsAndDeletes: () => enumerateInsertsAndDeletes,
- equalOwnProperties: () => equalOwnProperties,
- equateStringsCaseInsensitive: () => equateStringsCaseInsensitive,
- equateStringsCaseSensitive: () => equateStringsCaseSensitive,
- equateValues: () => equateValues,
- esDecorateHelper: () => esDecorateHelper,
- escapeJsxAttributeString: () => escapeJsxAttributeString,
- escapeLeadingUnderscores: () => escapeLeadingUnderscores,
- escapeNonAsciiString: () => escapeNonAsciiString,
- escapeSnippetText: () => escapeSnippetText,
- escapeString: () => escapeString,
- every: () => every,
- expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
- explainFiles: () => explainFiles,
- explainIfFileIsRedirectAndImpliedFormat: () => explainIfFileIsRedirectAndImpliedFormat,
- exportAssignmentIsAlias: () => exportAssignmentIsAlias,
- exportStarHelper: () => exportStarHelper,
- expressionResultIsUnused: () => expressionResultIsUnused,
- extend: () => extend,
- extendsHelper: () => extendsHelper,
- extensionFromPath: () => extensionFromPath,
- extensionIsTS: () => extensionIsTS,
- externalHelpersModuleNameText: () => externalHelpersModuleNameText,
- factory: () => factory,
- fileExtensionIs: () => fileExtensionIs,
- fileExtensionIsOneOf: () => fileExtensionIsOneOf,
- fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
- filter: () => filter,
- filterMutate: () => filterMutate,
- filterSemanticDiagnostics: () => filterSemanticDiagnostics,
- find: () => find,
- findAncestor: () => findAncestor,
- findBestPatternMatch: () => findBestPatternMatch,
- findChildOfKind: () => findChildOfKind,
- findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
- findConfigFile: () => findConfigFile,
- findContainingList: () => findContainingList,
- findDiagnosticForNode: () => findDiagnosticForNode,
- findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
- findIndex: () => findIndex,
- findLast: () => findLast,
- findLastIndex: () => findLastIndex,
- findListItemInfo: () => findListItemInfo,
- findMap: () => findMap,
- findModifier: () => findModifier,
- findNextToken: () => findNextToken,
- findPackageJson: () => findPackageJson,
- findPackageJsons: () => findPackageJsons,
- findPrecedingMatchingToken: () => findPrecedingMatchingToken,
- findPrecedingToken: () => findPrecedingToken,
- findSuperStatementIndex: () => findSuperStatementIndex,
- findTokenOnLeftOfPosition: () => findTokenOnLeftOfPosition,
- findUseStrictPrologue: () => findUseStrictPrologue,
- first: () => first,
- firstDefined: () => firstDefined,
- firstDefinedIterator: () => firstDefinedIterator,
- firstIterator: () => firstIterator,
- firstOrOnly: () => firstOrOnly,
- firstOrUndefined: () => firstOrUndefined,
- firstOrUndefinedIterator: () => firstOrUndefinedIterator,
- fixupCompilerOptions: () => fixupCompilerOptions,
- flatMap: () => flatMap,
- flatMapIterator: () => flatMapIterator,
- flatMapToMutable: () => flatMapToMutable,
- flatten: () => flatten,
- flattenCommaList: () => flattenCommaList,
- flattenDestructuringAssignment: () => flattenDestructuringAssignment,
- flattenDestructuringBinding: () => flattenDestructuringBinding,
- flattenDiagnosticMessageText: () => flattenDiagnosticMessageText,
- forEach: () => forEach,
- forEachAncestor: () => forEachAncestor,
- forEachAncestorDirectory: () => forEachAncestorDirectory,
- forEachChild: () => forEachChild,
- forEachChildRecursively: () => forEachChildRecursively,
- forEachEmittedFile: () => forEachEmittedFile,
- forEachEnclosingBlockScopeContainer: () => forEachEnclosingBlockScopeContainer,
- forEachEntry: () => forEachEntry,
- forEachExternalModuleToImportFrom: () => forEachExternalModuleToImportFrom,
- forEachImportClauseDeclaration: () => forEachImportClauseDeclaration,
- forEachKey: () => forEachKey,
- forEachLeadingCommentRange: () => forEachLeadingCommentRange,
- forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
- forEachResolvedProjectReference: () => forEachResolvedProjectReference,
- forEachReturnStatement: () => forEachReturnStatement,
- forEachRight: () => forEachRight,
- forEachTrailingCommentRange: () => forEachTrailingCommentRange,
- forEachUnique: () => forEachUnique,
- forEachYieldExpression: () => forEachYieldExpression,
- forSomeAncestorDirectory: () => forSomeAncestorDirectory,
- formatColorAndReset: () => formatColorAndReset,
- formatDiagnostic: () => formatDiagnostic,
- formatDiagnostics: () => formatDiagnostics,
- formatDiagnosticsWithColorAndContext: () => formatDiagnosticsWithColorAndContext,
- formatGeneratedName: () => formatGeneratedName,
- formatGeneratedNamePart: () => formatGeneratedNamePart,
- formatLocation: () => formatLocation,
- formatMessage: () => formatMessage,
- formatStringFromArgs: () => formatStringFromArgs,
- formatting: () => ts_formatting_exports,
- fullTripleSlashAMDReferencePathRegEx: () => fullTripleSlashAMDReferencePathRegEx,
- fullTripleSlashReferencePathRegEx: () => fullTripleSlashReferencePathRegEx,
- generateDjb2Hash: () => generateDjb2Hash,
- generateTSConfig: () => generateTSConfig,
- generatorHelper: () => generatorHelper,
- getAdjustedReferenceLocation: () => getAdjustedReferenceLocation,
- getAdjustedRenameLocation: () => getAdjustedRenameLocation,
- getAliasDeclarationFromName: () => getAliasDeclarationFromName,
- getAllAccessorDeclarations: () => getAllAccessorDeclarations,
- getAllDecoratorsOfClass: () => getAllDecoratorsOfClass,
- getAllDecoratorsOfClassElement: () => getAllDecoratorsOfClassElement,
- getAllJSDocTags: () => getAllJSDocTags,
- getAllJSDocTagsOfKind: () => getAllJSDocTagsOfKind,
- getAllKeys: () => getAllKeys,
- getAllProjectOutputs: () => getAllProjectOutputs,
- getAllSuperTypeNodes: () => getAllSuperTypeNodes,
- getAllUnscopedEmitHelpers: () => getAllUnscopedEmitHelpers,
- getAllowJSCompilerOption: () => getAllowJSCompilerOption,
- getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
- getAncestor: () => getAncestor,
- getAnyExtensionFromPath: () => getAnyExtensionFromPath,
- getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled,
- getAssignedExpandoInitializer: () => getAssignedExpandoInitializer,
- getAssignedName: () => getAssignedName,
- getAssignmentDeclarationKind: () => getAssignmentDeclarationKind,
- getAssignmentDeclarationPropertyAccessKind: () => getAssignmentDeclarationPropertyAccessKind,
- getAssignmentTargetKind: () => getAssignmentTargetKind,
- getAutomaticTypeDirectiveNames: () => getAutomaticTypeDirectiveNames,
- getBaseFileName: () => getBaseFileName,
- getBinaryOperatorPrecedence: () => getBinaryOperatorPrecedence,
- getBuildInfo: () => getBuildInfo,
- getBuildInfoFileVersionMap: () => getBuildInfoFileVersionMap,
- getBuildInfoText: () => getBuildInfoText,
- getBuildOrderFromAnyBuildOrder: () => getBuildOrderFromAnyBuildOrder,
- getBuilderCreationParameters: () => getBuilderCreationParameters,
- getBuilderFileEmit: () => getBuilderFileEmit,
- getCheckFlags: () => getCheckFlags,
- getClassExtendsHeritageElement: () => getClassExtendsHeritageElement,
- getClassLikeDeclarationOfSymbol: () => getClassLikeDeclarationOfSymbol,
- getCombinedLocalAndExportSymbolFlags: () => getCombinedLocalAndExportSymbolFlags,
- getCombinedModifierFlags: () => getCombinedModifierFlags,
- getCombinedNodeFlags: () => getCombinedNodeFlags,
- getCombinedNodeFlagsAlwaysIncludeJSDoc: () => getCombinedNodeFlagsAlwaysIncludeJSDoc,
- getCommentRange: () => getCommentRange,
- getCommonSourceDirectory: () => getCommonSourceDirectory,
- getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig,
- getCompilerOptionValue: () => getCompilerOptionValue,
- getCompilerOptionsDiffValue: () => getCompilerOptionsDiffValue,
- getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics,
- getConstantValue: () => getConstantValue,
- getContainerNode: () => getContainerNode,
- getContainingClass: () => getContainingClass,
- getContainingClassStaticBlock: () => getContainingClassStaticBlock,
- getContainingFunction: () => getContainingFunction,
- getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
- getContainingFunctionOrClassStaticBlock: () => getContainingFunctionOrClassStaticBlock,
- getContainingNodeArray: () => getContainingNodeArray,
- getContainingObjectLiteralElement: () => getContainingObjectLiteralElement,
- getContextualTypeFromParent: () => getContextualTypeFromParent,
- getContextualTypeFromParentOrAncestorTypeNode: () => getContextualTypeFromParentOrAncestorTypeNode,
- getCurrentTime: () => getCurrentTime,
- getDeclarationDiagnostics: () => getDeclarationDiagnostics,
- getDeclarationEmitExtensionForPath: () => getDeclarationEmitExtensionForPath,
- getDeclarationEmitOutputFilePath: () => getDeclarationEmitOutputFilePath,
- getDeclarationEmitOutputFilePathWorker: () => getDeclarationEmitOutputFilePathWorker,
- getDeclarationFromName: () => getDeclarationFromName,
- getDeclarationModifierFlagsFromSymbol: () => getDeclarationModifierFlagsFromSymbol,
- getDeclarationOfKind: () => getDeclarationOfKind,
- getDeclarationsOfKind: () => getDeclarationsOfKind,
- getDeclaredExpandoInitializer: () => getDeclaredExpandoInitializer,
- getDecorators: () => getDecorators,
- getDefaultCompilerOptions: () => getDefaultCompilerOptions2,
- getDefaultExportInfoWorker: () => getDefaultExportInfoWorker,
- getDefaultFormatCodeSettings: () => getDefaultFormatCodeSettings,
- getDefaultLibFileName: () => getDefaultLibFileName,
- getDefaultLibFilePath: () => getDefaultLibFilePath,
- getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
- getDiagnosticText: () => getDiagnosticText,
- getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
- getDirectoryPath: () => getDirectoryPath,
- getDocumentPositionMapper: () => getDocumentPositionMapper,
- getESModuleInterop: () => getESModuleInterop,
- getEditsForFileRename: () => getEditsForFileRename,
- getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
- getEffectiveConstraintOfTypeParameter: () => getEffectiveConstraintOfTypeParameter,
- getEffectiveContainerForJSDocTemplateTag: () => getEffectiveContainerForJSDocTemplateTag,
- getEffectiveImplementsTypeNodes: () => getEffectiveImplementsTypeNodes,
- getEffectiveInitializer: () => getEffectiveInitializer,
- getEffectiveJSDocHost: () => getEffectiveJSDocHost,
- getEffectiveModifierFlags: () => getEffectiveModifierFlags,
- getEffectiveModifierFlagsAlwaysIncludeJSDoc: () => getEffectiveModifierFlagsAlwaysIncludeJSDoc,
- getEffectiveModifierFlagsNoCache: () => getEffectiveModifierFlagsNoCache,
- getEffectiveReturnTypeNode: () => getEffectiveReturnTypeNode,
- getEffectiveSetAccessorTypeAnnotationNode: () => getEffectiveSetAccessorTypeAnnotationNode,
- getEffectiveTypeAnnotationNode: () => getEffectiveTypeAnnotationNode,
- getEffectiveTypeParameterDeclarations: () => getEffectiveTypeParameterDeclarations,
- getEffectiveTypeRoots: () => getEffectiveTypeRoots,
- getElementOrPropertyAccessArgumentExpressionOrName: () => getElementOrPropertyAccessArgumentExpressionOrName,
- getElementOrPropertyAccessName: () => getElementOrPropertyAccessName,
- getElementsOfBindingOrAssignmentPattern: () => getElementsOfBindingOrAssignmentPattern,
- getEmitDeclarations: () => getEmitDeclarations,
- getEmitFlags: () => getEmitFlags,
- getEmitHelpers: () => getEmitHelpers,
- getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
- getEmitModuleKind: () => getEmitModuleKind,
- getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
- getEmitScriptTarget: () => getEmitScriptTarget,
- getEnclosingBlockScopeContainer: () => getEnclosingBlockScopeContainer,
- getEncodedSemanticClassifications: () => getEncodedSemanticClassifications,
- getEncodedSyntacticClassifications: () => getEncodedSyntacticClassifications,
- getEndLinePosition: () => getEndLinePosition,
- getEntityNameFromTypeNode: () => getEntityNameFromTypeNode,
- getEntrypointsFromPackageJsonInfo: () => getEntrypointsFromPackageJsonInfo,
- getErrorCountForSummary: () => getErrorCountForSummary,
- getErrorSpanForNode: () => getErrorSpanForNode,
- getErrorSummaryText: () => getErrorSummaryText,
- getEscapedTextOfIdentifierOrLiteral: () => getEscapedTextOfIdentifierOrLiteral,
- getExpandoInitializer: () => getExpandoInitializer,
- getExportAssignmentExpression: () => getExportAssignmentExpression,
- getExportInfoMap: () => getExportInfoMap,
- getExportNeedsImportStarHelper: () => getExportNeedsImportStarHelper,
- getExpressionAssociativity: () => getExpressionAssociativity,
- getExpressionPrecedence: () => getExpressionPrecedence,
- getExternalHelpersModuleName: () => getExternalHelpersModuleName,
- getExternalModuleImportEqualsDeclarationExpression: () => getExternalModuleImportEqualsDeclarationExpression,
- getExternalModuleName: () => getExternalModuleName,
- getExternalModuleNameFromDeclaration: () => getExternalModuleNameFromDeclaration,
- getExternalModuleNameFromPath: () => getExternalModuleNameFromPath,
- getExternalModuleNameLiteral: () => getExternalModuleNameLiteral,
- getExternalModuleRequireArgument: () => getExternalModuleRequireArgument,
- getFallbackOptions: () => getFallbackOptions,
- getFileEmitOutput: () => getFileEmitOutput,
- getFileMatcherPatterns: () => getFileMatcherPatterns,
- getFileNamesFromConfigSpecs: () => getFileNamesFromConfigSpecs,
- getFileWatcherEventKind: () => getFileWatcherEventKind,
- getFilesInErrorForSummary: () => getFilesInErrorForSummary,
- getFirstConstructorWithBody: () => getFirstConstructorWithBody,
- getFirstIdentifier: () => getFirstIdentifier,
- getFirstNonSpaceCharacterPosition: () => getFirstNonSpaceCharacterPosition,
- getFirstProjectOutput: () => getFirstProjectOutput,
- getFixableErrorSpanExpression: () => getFixableErrorSpanExpression,
- getFormatCodeSettingsForWriting: () => getFormatCodeSettingsForWriting,
- getFullWidth: () => getFullWidth,
- getFunctionFlags: () => getFunctionFlags,
- getHeritageClause: () => getHeritageClause,
- getHostSignatureFromJSDoc: () => getHostSignatureFromJSDoc,
- getIdentifierAutoGenerate: () => getIdentifierAutoGenerate,
- getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
- getIdentifierTypeArguments: () => getIdentifierTypeArguments,
- getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
- getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
- getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
- getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
- getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
- getIndentSize: () => getIndentSize,
- getIndentString: () => getIndentString,
- getInitializedVariables: () => getInitializedVariables,
- getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
- getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
- getInterfaceBaseTypeNodes: () => getInterfaceBaseTypeNodes,
- getInternalEmitFlags: () => getInternalEmitFlags,
- getInvokedExpression: () => getInvokedExpression,
- getIsolatedModules: () => getIsolatedModules,
- getJSDocAugmentsTag: () => getJSDocAugmentsTag,
- getJSDocClassTag: () => getJSDocClassTag,
- getJSDocCommentRanges: () => getJSDocCommentRanges,
- getJSDocCommentsAndTags: () => getJSDocCommentsAndTags,
- getJSDocDeprecatedTag: () => getJSDocDeprecatedTag,
- getJSDocDeprecatedTagNoCache: () => getJSDocDeprecatedTagNoCache,
- getJSDocEnumTag: () => getJSDocEnumTag,
- getJSDocHost: () => getJSDocHost,
- getJSDocImplementsTags: () => getJSDocImplementsTags,
- getJSDocOverrideTagNoCache: () => getJSDocOverrideTagNoCache,
- getJSDocParameterTags: () => getJSDocParameterTags,
- getJSDocParameterTagsNoCache: () => getJSDocParameterTagsNoCache,
- getJSDocPrivateTag: () => getJSDocPrivateTag,
- getJSDocPrivateTagNoCache: () => getJSDocPrivateTagNoCache,
- getJSDocProtectedTag: () => getJSDocProtectedTag,
- getJSDocProtectedTagNoCache: () => getJSDocProtectedTagNoCache,
- getJSDocPublicTag: () => getJSDocPublicTag,
- getJSDocPublicTagNoCache: () => getJSDocPublicTagNoCache,
- getJSDocReadonlyTag: () => getJSDocReadonlyTag,
- getJSDocReadonlyTagNoCache: () => getJSDocReadonlyTagNoCache,
- getJSDocReturnTag: () => getJSDocReturnTag,
- getJSDocReturnType: () => getJSDocReturnType,
- getJSDocRoot: () => getJSDocRoot,
- getJSDocSatisfiesExpressionType: () => getJSDocSatisfiesExpressionType,
- getJSDocSatisfiesTag: () => getJSDocSatisfiesTag,
- getJSDocTags: () => getJSDocTags,
- getJSDocTagsNoCache: () => getJSDocTagsNoCache,
- getJSDocTemplateTag: () => getJSDocTemplateTag,
- getJSDocThisTag: () => getJSDocThisTag,
- getJSDocType: () => getJSDocType,
- getJSDocTypeAliasName: () => getJSDocTypeAliasName,
- getJSDocTypeAssertionType: () => getJSDocTypeAssertionType,
- getJSDocTypeParameterDeclarations: () => getJSDocTypeParameterDeclarations,
- getJSDocTypeParameterTags: () => getJSDocTypeParameterTags,
- getJSDocTypeParameterTagsNoCache: () => getJSDocTypeParameterTagsNoCache,
- getJSDocTypeTag: () => getJSDocTypeTag,
- getJSXImplicitImportBase: () => getJSXImplicitImportBase,
- getJSXRuntimeImport: () => getJSXRuntimeImport,
- getJSXTransformEnabled: () => getJSXTransformEnabled,
- getKeyForCompilerOptions: () => getKeyForCompilerOptions,
- getLanguageVariant: () => getLanguageVariant,
- getLastChild: () => getLastChild,
- getLeadingCommentRanges: () => getLeadingCommentRanges,
- getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
- getLeftmostAccessExpression: () => getLeftmostAccessExpression,
- getLeftmostExpression: () => getLeftmostExpression,
- getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
- getLineInfo: () => getLineInfo,
- getLineOfLocalPosition: () => getLineOfLocalPosition,
- getLineOfLocalPositionFromLineMap: () => getLineOfLocalPositionFromLineMap,
- getLineStartPositionForPosition: () => getLineStartPositionForPosition,
- getLineStarts: () => getLineStarts,
- getLinesBetweenPositionAndNextNonWhitespaceCharacter: () => getLinesBetweenPositionAndNextNonWhitespaceCharacter,
- getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter: () => getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter,
- getLinesBetweenPositions: () => getLinesBetweenPositions,
- getLinesBetweenRangeEndAndRangeStart: () => getLinesBetweenRangeEndAndRangeStart,
- getLinesBetweenRangeEndPositions: () => getLinesBetweenRangeEndPositions,
- getLiteralText: () => getLiteralText,
- getLocalNameForExternalImport: () => getLocalNameForExternalImport,
- getLocalSymbolForExportDefault: () => getLocalSymbolForExportDefault,
- getLocaleSpecificMessage: () => getLocaleSpecificMessage,
- getLocaleTimeString: () => getLocaleTimeString,
- getMappedContextSpan: () => getMappedContextSpan,
- getMappedDocumentSpan: () => getMappedDocumentSpan,
- getMappedLocation: () => getMappedLocation,
- getMatchedFileSpec: () => getMatchedFileSpec,
- getMatchedIncludeSpec: () => getMatchedIncludeSpec,
- getMeaningFromDeclaration: () => getMeaningFromDeclaration,
- getMeaningFromLocation: () => getMeaningFromLocation,
- getMembersOfDeclaration: () => getMembersOfDeclaration,
- getModeForFileReference: () => getModeForFileReference,
- getModeForResolutionAtIndex: () => getModeForResolutionAtIndex,
- getModeForUsageLocation: () => getModeForUsageLocation,
- getModifiedTime: () => getModifiedTime,
- getModifiers: () => getModifiers,
- getModuleInstanceState: () => getModuleInstanceState,
- getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt,
- getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
- getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
- getNameForExportedSymbol: () => getNameForExportedSymbol,
- getNameFromIndexInfo: () => getNameFromIndexInfo,
- getNameFromPropertyName: () => getNameFromPropertyName,
- getNameOfAccessExpression: () => getNameOfAccessExpression,
- getNameOfCompilerOptionValue: () => getNameOfCompilerOptionValue,
- getNameOfDeclaration: () => getNameOfDeclaration,
- getNameOfExpando: () => getNameOfExpando,
- getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
- getNameOrArgument: () => getNameOrArgument,
- getNameTable: () => getNameTable,
- getNamesForExportedSymbol: () => getNamesForExportedSymbol,
- getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
- getNewLineCharacter: () => getNewLineCharacter,
- getNewLineKind: () => getNewLineKind,
- getNewLineOrDefaultFromHost: () => getNewLineOrDefaultFromHost,
- getNewTargetContainer: () => getNewTargetContainer,
- getNextJSDocCommentLocation: () => getNextJSDocCommentLocation,
- getNodeForGeneratedName: () => getNodeForGeneratedName,
- getNodeId: () => getNodeId,
- getNodeKind: () => getNodeKind,
- getNodeMajorVersion: () => getNodeMajorVersion,
- getNodeModifiers: () => getNodeModifiers,
- getNodeModulePathParts: () => getNodeModulePathParts,
- getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
- getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
- getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
- getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
- getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
- getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
- getNormalizedPathComponents: () => getNormalizedPathComponents,
- getObjectFlags: () => getObjectFlags,
- getOperator: () => getOperator,
- getOperatorAssociativity: () => getOperatorAssociativity,
- getOperatorPrecedence: () => getOperatorPrecedence,
- getOptionFromName: () => getOptionFromName,
- getOptionsNameMap: () => getOptionsNameMap,
- getOrCreateEmitNode: () => getOrCreateEmitNode,
- getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
- getOrUpdate: () => getOrUpdate,
- getOriginalNode: () => getOriginalNode,
- getOriginalNodeId: () => getOriginalNodeId,
- getOriginalSourceFile: () => getOriginalSourceFile,
- getOutputDeclarationFileName: () => getOutputDeclarationFileName,
- getOutputExtension: () => getOutputExtension,
- getOutputFileNames: () => getOutputFileNames,
- getOutputPathsFor: () => getOutputPathsFor,
- getOutputPathsForBundle: () => getOutputPathsForBundle,
- getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
- getOwnKeys: () => getOwnKeys,
- getOwnValues: () => getOwnValues,
- getPackageJsonInfo: () => getPackageJsonInfo,
- getPackageJsonTypesVersionsPaths: () => getPackageJsonTypesVersionsPaths,
- getPackageJsonsVisibleToFile: () => getPackageJsonsVisibleToFile,
- getPackageNameFromTypesPackageName: () => getPackageNameFromTypesPackageName,
- getPackageScopeForPath: () => getPackageScopeForPath,
- getParameterSymbolFromJSDoc: () => getParameterSymbolFromJSDoc,
- getParameterTypeNode: () => getParameterTypeNode,
- getParentNodeInSpan: () => getParentNodeInSpan,
- getParseTreeNode: () => getParseTreeNode,
- getParsedCommandLineOfConfigFile: () => getParsedCommandLineOfConfigFile,
- getPathComponents: () => getPathComponents,
- getPathComponentsRelativeTo: () => getPathComponentsRelativeTo,
- getPathFromPathComponents: () => getPathFromPathComponents,
- getPathUpdater: () => getPathUpdater,
- getPathsBasePath: () => getPathsBasePath,
- getPatternFromSpec: () => getPatternFromSpec,
- getPendingEmitKind: () => getPendingEmitKind,
- getPositionOfLineAndCharacter: () => getPositionOfLineAndCharacter,
- getPossibleGenericSignatures: () => getPossibleGenericSignatures,
- getPossibleOriginalInputExtensionForExtension: () => getPossibleOriginalInputExtensionForExtension,
- getPossibleTypeArgumentsInfo: () => getPossibleTypeArgumentsInfo,
- getPreEmitDiagnostics: () => getPreEmitDiagnostics,
- getPrecedingNonSpaceCharacterPosition: () => getPrecedingNonSpaceCharacterPosition,
- getPrivateIdentifier: () => getPrivateIdentifier,
- getProperties: () => getProperties,
- getProperty: () => getProperty,
- getPropertyArrayElementValue: () => getPropertyArrayElementValue,
- getPropertyAssignment: () => getPropertyAssignment,
- getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
- getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
- getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
- getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
- getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
- getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
- getQuoteFromPreference: () => getQuoteFromPreference,
- getQuotePreference: () => getQuotePreference,
- getRangesWhere: () => getRangesWhere,
- getRefactorContextSpan: () => getRefactorContextSpan,
- getReferencedFileLocation: () => getReferencedFileLocation,
- getRegexFromPattern: () => getRegexFromPattern,
- getRegularExpressionForWildcard: () => getRegularExpressionForWildcard,
- getRegularExpressionsForWildcards: () => getRegularExpressionsForWildcards,
- getRelativePathFromDirectory: () => getRelativePathFromDirectory,
- getRelativePathFromFile: () => getRelativePathFromFile,
- getRelativePathToDirectoryOrUrl: () => getRelativePathToDirectoryOrUrl,
- getRenameLocation: () => getRenameLocation,
- getReplacementSpanForContextToken: () => getReplacementSpanForContextToken,
- getResolutionDiagnostic: () => getResolutionDiagnostic,
- getResolutionModeOverrideForClause: () => getResolutionModeOverrideForClause,
- getResolveJsonModule: () => getResolveJsonModule,
- getResolvePackageJsonExports: () => getResolvePackageJsonExports,
- getResolvePackageJsonImports: () => getResolvePackageJsonImports,
- getResolvedExternalModuleName: () => getResolvedExternalModuleName,
- getResolvedModule: () => getResolvedModule,
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
- getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
- getRestParameterElementType: () => getRestParameterElementType,
- getRightMostAssignedExpression: () => getRightMostAssignedExpression,
- getRootDeclaration: () => getRootDeclaration,
- getRootLength: () => getRootLength,
- getScriptKind: () => getScriptKind,
- getScriptKindFromFileName: () => getScriptKindFromFileName,
- getScriptTargetFeatures: () => getScriptTargetFeatures,
- getSelectedEffectiveModifierFlags: () => getSelectedEffectiveModifierFlags,
- getSelectedSyntacticModifierFlags: () => getSelectedSyntacticModifierFlags,
- getSemanticClassifications: () => getSemanticClassifications,
- getSemanticJsxChildren: () => getSemanticJsxChildren,
- getSetAccessorTypeAnnotationNode: () => getSetAccessorTypeAnnotationNode,
- getSetAccessorValueParameter: () => getSetAccessorValueParameter,
- getSetExternalModuleIndicator: () => getSetExternalModuleIndicator,
- getShebang: () => getShebang,
- getSingleInitializerOfVariableStatementOrPropertyDeclaration: () => getSingleInitializerOfVariableStatementOrPropertyDeclaration,
- getSingleVariableOfVariableStatement: () => getSingleVariableOfVariableStatement,
- getSnapshotText: () => getSnapshotText,
- getSnippetElement: () => getSnippetElement,
- getSourceFileOfModule: () => getSourceFileOfModule,
- getSourceFileOfNode: () => getSourceFileOfNode,
- getSourceFilePathInNewDir: () => getSourceFilePathInNewDir,
- getSourceFilePathInNewDirWorker: () => getSourceFilePathInNewDirWorker,
- getSourceFileVersionAsHashFromText: () => getSourceFileVersionAsHashFromText,
- getSourceFilesToEmit: () => getSourceFilesToEmit,
- getSourceMapRange: () => getSourceMapRange,
- getSourceMapper: () => getSourceMapper,
- getSourceTextOfNodeFromSourceFile: () => getSourceTextOfNodeFromSourceFile,
- getSpanOfTokenAtPosition: () => getSpanOfTokenAtPosition,
- getSpellingSuggestion: () => getSpellingSuggestion,
- getStartPositionOfLine: () => getStartPositionOfLine,
- getStartPositionOfRange: () => getStartPositionOfRange,
- getStartsOnNewLine: () => getStartsOnNewLine,
- getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
- getStrictOptionValue: () => getStrictOptionValue,
- getStringComparer: () => getStringComparer,
- getSuperCallFromStatement: () => getSuperCallFromStatement,
- getSuperContainer: () => getSuperContainer,
- getSupportedCodeFixes: () => getSupportedCodeFixes,
- getSupportedExtensions: () => getSupportedExtensions,
- getSupportedExtensionsWithJsonIfResolveJsonModule: () => getSupportedExtensionsWithJsonIfResolveJsonModule,
- getSwitchedType: () => getSwitchedType,
- getSymbolId: () => getSymbolId,
- getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
- getSymbolTarget: () => getSymbolTarget,
- getSyntacticClassifications: () => getSyntacticClassifications,
- getSyntacticModifierFlags: () => getSyntacticModifierFlags,
- getSyntacticModifierFlagsNoCache: () => getSyntacticModifierFlagsNoCache,
- getSynthesizedDeepClone: () => getSynthesizedDeepClone,
- getSynthesizedDeepCloneWithReplacements: () => getSynthesizedDeepCloneWithReplacements,
- getSynthesizedDeepClones: () => getSynthesizedDeepClones,
- getSynthesizedDeepClonesWithReplacements: () => getSynthesizedDeepClonesWithReplacements,
- getSyntheticLeadingComments: () => getSyntheticLeadingComments,
- getSyntheticTrailingComments: () => getSyntheticTrailingComments,
- getTargetLabel: () => getTargetLabel,
- getTargetOfBindingOrAssignmentElement: () => getTargetOfBindingOrAssignmentElement,
- getTemporaryModuleResolutionState: () => getTemporaryModuleResolutionState,
- getTextOfConstantValue: () => getTextOfConstantValue,
- getTextOfIdentifierOrLiteral: () => getTextOfIdentifierOrLiteral,
- getTextOfJSDocComment: () => getTextOfJSDocComment,
- getTextOfNode: () => getTextOfNode,
- getTextOfNodeFromSourceText: () => getTextOfNodeFromSourceText,
- getTextOfPropertyName: () => getTextOfPropertyName,
- getThisContainer: () => getThisContainer,
- getThisParameter: () => getThisParameter,
- getTokenAtPosition: () => getTokenAtPosition,
- getTokenPosOfNode: () => getTokenPosOfNode,
- getTokenSourceMapRange: () => getTokenSourceMapRange,
- getTouchingPropertyName: () => getTouchingPropertyName,
- getTouchingToken: () => getTouchingToken,
- getTrailingCommentRanges: () => getTrailingCommentRanges,
- getTrailingSemicolonDeferringWriter: () => getTrailingSemicolonDeferringWriter,
- getTransformFlagsSubtreeExclusions: () => getTransformFlagsSubtreeExclusions,
- getTransformers: () => getTransformers,
- getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
- getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
- getTsConfigPropArray: () => getTsConfigPropArray,
- getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
- getTypeAnnotationNode: () => getTypeAnnotationNode,
- getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
- getTypeKeywordOfTypeOnlyImport: () => getTypeKeywordOfTypeOnlyImport,
- getTypeNode: () => getTypeNode,
- getTypeNodeIfAccessible: () => getTypeNodeIfAccessible,
- getTypeParameterFromJsDoc: () => getTypeParameterFromJsDoc,
- getTypeParameterOwner: () => getTypeParameterOwner,
- getTypesPackageName: () => getTypesPackageName,
- getUILocale: () => getUILocale,
- getUniqueName: () => getUniqueName,
- getUniqueSymbolId: () => getUniqueSymbolId,
- getUseDefineForClassFields: () => getUseDefineForClassFields,
- getWatchErrorSummaryDiagnosticMessage: () => getWatchErrorSummaryDiagnosticMessage,
- getWatchFactory: () => getWatchFactory,
- group: () => group,
- groupBy: () => groupBy,
- guessIndentation: () => guessIndentation,
- handleNoEmitOptions: () => handleNoEmitOptions,
- hasAbstractModifier: () => hasAbstractModifier,
- hasAccessorModifier: () => hasAccessorModifier,
- hasAmbientModifier: () => hasAmbientModifier,
- hasChangesInResolutions: () => hasChangesInResolutions,
- hasChildOfKind: () => hasChildOfKind,
- hasContextSensitiveParameters: () => hasContextSensitiveParameters,
- hasDecorators: () => hasDecorators,
- hasDocComment: () => hasDocComment,
- hasDynamicName: () => hasDynamicName,
- hasEffectiveModifier: () => hasEffectiveModifier,
- hasEffectiveModifiers: () => hasEffectiveModifiers,
- hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
- hasExtension: () => hasExtension,
- hasIndexSignature: () => hasIndexSignature,
- hasInitializer: () => hasInitializer,
- hasInvalidEscape: () => hasInvalidEscape,
- hasJSDocNodes: () => hasJSDocNodes,
- hasJSDocParameterTags: () => hasJSDocParameterTags,
- hasJSFileExtension: () => hasJSFileExtension,
- hasJsonModuleEmitEnabled: () => hasJsonModuleEmitEnabled,
- hasOnlyExpressionInitializer: () => hasOnlyExpressionInitializer,
- hasOverrideModifier: () => hasOverrideModifier,
- hasPossibleExternalModuleReference: () => hasPossibleExternalModuleReference,
- hasProperty: () => hasProperty,
- hasPropertyAccessExpressionWithName: () => hasPropertyAccessExpressionWithName,
- hasQuestionToken: () => hasQuestionToken,
- hasRecordedExternalHelpers: () => hasRecordedExternalHelpers,
- hasRestParameter: () => hasRestParameter,
- hasScopeMarker: () => hasScopeMarker,
- hasStaticModifier: () => hasStaticModifier,
- hasSyntacticModifier: () => hasSyntacticModifier,
- hasSyntacticModifiers: () => hasSyntacticModifiers,
- hasTSFileExtension: () => hasTSFileExtension,
- hasTabstop: () => hasTabstop,
- hasTrailingDirectorySeparator: () => hasTrailingDirectorySeparator,
- hasType: () => hasType,
- hasTypeArguments: () => hasTypeArguments,
- hasZeroOrOneAsteriskCharacter: () => hasZeroOrOneAsteriskCharacter,
- helperString: () => helperString,
- hostGetCanonicalFileName: () => hostGetCanonicalFileName,
- hostUsesCaseSensitiveFileNames: () => hostUsesCaseSensitiveFileNames,
- idText: () => idText,
- identifierIsThisKeyword: () => identifierIsThisKeyword,
- identifierToKeywordKind: () => identifierToKeywordKind,
- identity: () => identity,
- identitySourceMapConsumer: () => identitySourceMapConsumer,
- ignoreSourceNewlines: () => ignoreSourceNewlines,
- ignoredPaths: () => ignoredPaths,
- importDefaultHelper: () => importDefaultHelper,
- importFromModuleSpecifier: () => importFromModuleSpecifier,
- importNameElisionDisabled: () => importNameElisionDisabled,
- importStarHelper: () => importStarHelper,
- indexOfAnyCharCode: () => indexOfAnyCharCode,
- indexOfNode: () => indexOfNode,
- indicesOf: () => indicesOf,
- inferredTypesContainingFile: () => inferredTypesContainingFile,
- insertImports: () => insertImports,
- insertLeadingStatement: () => insertLeadingStatement,
- insertSorted: () => insertSorted,
- insertStatementAfterCustomPrologue: () => insertStatementAfterCustomPrologue,
- insertStatementAfterStandardPrologue: () => insertStatementAfterStandardPrologue,
- insertStatementsAfterCustomPrologue: () => insertStatementsAfterCustomPrologue,
- insertStatementsAfterStandardPrologue: () => insertStatementsAfterStandardPrologue,
- intersperse: () => intersperse,
- introducesArgumentsExoticObject: () => introducesArgumentsExoticObject,
- inverseJsxOptionMap: () => inverseJsxOptionMap,
- isAbstractConstructorSymbol: () => isAbstractConstructorSymbol,
- isAbstractModifier: () => isAbstractModifier,
- isAccessExpression: () => isAccessExpression,
- isAccessibilityModifier: () => isAccessibilityModifier,
- isAccessor: () => isAccessor,
- isAccessorModifier: () => isAccessorModifier,
- isAliasSymbolDeclaration: () => isAliasSymbolDeclaration,
- isAliasableExpression: () => isAliasableExpression,
- isAmbientModule: () => isAmbientModule,
- isAmbientPropertyDeclaration: () => isAmbientPropertyDeclaration,
- isAnonymousFunctionDefinition: () => isAnonymousFunctionDefinition,
- isAnyDirectorySeparator: () => isAnyDirectorySeparator,
- isAnyImportOrBareOrAccessedRequire: () => isAnyImportOrBareOrAccessedRequire,
- isAnyImportOrReExport: () => isAnyImportOrReExport,
- isAnyImportSyntax: () => isAnyImportSyntax,
- isAnySupportedFileExtension: () => isAnySupportedFileExtension,
- isApplicableVersionedTypesKey: () => isApplicableVersionedTypesKey,
- isArgumentExpressionOfElementAccess: () => isArgumentExpressionOfElementAccess,
- isArray: () => isArray,
- isArrayBindingElement: () => isArrayBindingElement,
- isArrayBindingOrAssignmentElement: () => isArrayBindingOrAssignmentElement,
- isArrayBindingOrAssignmentPattern: () => isArrayBindingOrAssignmentPattern,
- isArrayBindingPattern: () => isArrayBindingPattern,
- isArrayLiteralExpression: () => isArrayLiteralExpression,
- isArrayLiteralOrObjectLiteralDestructuringPattern: () => isArrayLiteralOrObjectLiteralDestructuringPattern,
- isArrayTypeNode: () => isArrayTypeNode,
- isArrowFunction: () => isArrowFunction,
- isAsExpression: () => isAsExpression,
- isAssertClause: () => isAssertClause,
- isAssertEntry: () => isAssertEntry,
- isAssertionExpression: () => isAssertionExpression,
- isAssertionKey: () => isAssertionKey,
- isAssertsKeyword: () => isAssertsKeyword,
- isAssignmentDeclaration: () => isAssignmentDeclaration,
- isAssignmentExpression: () => isAssignmentExpression,
- isAssignmentOperator: () => isAssignmentOperator,
- isAssignmentPattern: () => isAssignmentPattern,
- isAssignmentTarget: () => isAssignmentTarget,
- isAsteriskToken: () => isAsteriskToken,
- isAsyncFunction: () => isAsyncFunction,
- isAsyncModifier: () => isAsyncModifier,
- isAutoAccessorPropertyDeclaration: () => isAutoAccessorPropertyDeclaration,
- isAwaitExpression: () => isAwaitExpression,
- isAwaitKeyword: () => isAwaitKeyword,
- isBigIntLiteral: () => isBigIntLiteral,
- isBinaryExpression: () => isBinaryExpression,
- isBinaryOperatorToken: () => isBinaryOperatorToken,
- isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
- isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
- isBindableStaticElementAccessExpression: () => isBindableStaticElementAccessExpression,
- isBindableStaticNameExpression: () => isBindableStaticNameExpression,
- isBindingElement: () => isBindingElement,
- isBindingElementOfBareOrAccessedRequire: () => isBindingElementOfBareOrAccessedRequire,
- isBindingName: () => isBindingName,
- isBindingOrAssignmentElement: () => isBindingOrAssignmentElement,
- isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
- isBindingPattern: () => isBindingPattern,
- isBlock: () => isBlock,
- isBlockOrCatchScoped: () => isBlockOrCatchScoped,
- isBlockScope: () => isBlockScope,
- isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
- isBooleanLiteral: () => isBooleanLiteral,
- isBreakOrContinueStatement: () => isBreakOrContinueStatement,
- isBreakStatement: () => isBreakStatement,
- isBuildInfoFile: () => isBuildInfoFile,
- isBuilderProgram: () => isBuilderProgram2,
- isBundle: () => isBundle,
- isBundleFileTextLike: () => isBundleFileTextLike,
- isCallChain: () => isCallChain,
- isCallExpression: () => isCallExpression,
- isCallExpressionTarget: () => isCallExpressionTarget,
- isCallLikeExpression: () => isCallLikeExpression,
- isCallOrNewExpression: () => isCallOrNewExpression,
- isCallOrNewExpressionTarget: () => isCallOrNewExpressionTarget,
- isCallSignatureDeclaration: () => isCallSignatureDeclaration,
- isCallToHelper: () => isCallToHelper,
- isCaseBlock: () => isCaseBlock,
- isCaseClause: () => isCaseClause,
- isCaseKeyword: () => isCaseKeyword,
- isCaseOrDefaultClause: () => isCaseOrDefaultClause,
- isCatchClause: () => isCatchClause,
- isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
- isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
- isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
- isChildOfNodeWithKind: () => isChildOfNodeWithKind,
- isCircularBuildOrder: () => isCircularBuildOrder,
- isClassDeclaration: () => isClassDeclaration,
- isClassElement: () => isClassElement,
- isClassExpression: () => isClassExpression,
- isClassLike: () => isClassLike,
- isClassMemberModifier: () => isClassMemberModifier,
- isClassOrTypeElement: () => isClassOrTypeElement,
- isClassStaticBlockDeclaration: () => isClassStaticBlockDeclaration,
- isCollapsedRange: () => isCollapsedRange,
- isColonToken: () => isColonToken,
- isCommaExpression: () => isCommaExpression,
- isCommaListExpression: () => isCommaListExpression,
- isCommaSequence: () => isCommaSequence,
- isCommaToken: () => isCommaToken,
- isComment: () => isComment,
- isCommonJsExportPropertyAssignment: () => isCommonJsExportPropertyAssignment,
- isCommonJsExportedExpression: () => isCommonJsExportedExpression,
- isCompoundAssignment: () => isCompoundAssignment,
- isComputedNonLiteralName: () => isComputedNonLiteralName,
- isComputedPropertyName: () => isComputedPropertyName,
- isConciseBody: () => isConciseBody,
- isConditionalExpression: () => isConditionalExpression,
- isConditionalTypeNode: () => isConditionalTypeNode,
- isConstTypeReference: () => isConstTypeReference,
- isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
- isConstructorDeclaration: () => isConstructorDeclaration,
- isConstructorTypeNode: () => isConstructorTypeNode,
- isContextualKeyword: () => isContextualKeyword,
- isContinueStatement: () => isContinueStatement,
- isCustomPrologue: () => isCustomPrologue,
- isDebuggerStatement: () => isDebuggerStatement,
- isDeclaration: () => isDeclaration,
- isDeclarationBindingElement: () => isDeclarationBindingElement,
- isDeclarationFileName: () => isDeclarationFileName,
- isDeclarationName: () => isDeclarationName,
- isDeclarationNameOfEnumOrNamespace: () => isDeclarationNameOfEnumOrNamespace,
- isDeclarationReadonly: () => isDeclarationReadonly,
- isDeclarationStatement: () => isDeclarationStatement,
- isDeclarationWithTypeParameterChildren: () => isDeclarationWithTypeParameterChildren,
- isDeclarationWithTypeParameters: () => isDeclarationWithTypeParameters,
- isDecorator: () => isDecorator,
- isDecoratorTarget: () => isDecoratorTarget,
- isDefaultClause: () => isDefaultClause,
- isDefaultImport: () => isDefaultImport,
- isDefaultModifier: () => isDefaultModifier,
- isDefaultedExpandoInitializer: () => isDefaultedExpandoInitializer,
- isDeleteExpression: () => isDeleteExpression,
- isDeleteTarget: () => isDeleteTarget,
- isDeprecatedDeclaration: () => isDeprecatedDeclaration,
- isDestructuringAssignment: () => isDestructuringAssignment,
- isDiagnosticWithLocation: () => isDiagnosticWithLocation,
- isDiskPathRoot: () => isDiskPathRoot,
- isDoStatement: () => isDoStatement,
- isDotDotDotToken: () => isDotDotDotToken,
- isDottedName: () => isDottedName,
- isDynamicName: () => isDynamicName,
- isESSymbolIdentifier: () => isESSymbolIdentifier,
- isEffectiveExternalModule: () => isEffectiveExternalModule,
- isEffectiveModuleDeclaration: () => isEffectiveModuleDeclaration,
- isEffectiveStrictModeSourceFile: () => isEffectiveStrictModeSourceFile,
- isElementAccessChain: () => isElementAccessChain,
- isElementAccessExpression: () => isElementAccessExpression,
- isEmittedFileOfProgram: () => isEmittedFileOfProgram,
- isEmptyArrayLiteral: () => isEmptyArrayLiteral,
- isEmptyBindingElement: () => isEmptyBindingElement,
- isEmptyBindingPattern: () => isEmptyBindingPattern,
- isEmptyObjectLiteral: () => isEmptyObjectLiteral,
- isEmptyStatement: () => isEmptyStatement,
- isEmptyStringLiteral: () => isEmptyStringLiteral,
- isEndOfDeclarationMarker: () => isEndOfDeclarationMarker,
- isEntityName: () => isEntityName,
- isEntityNameExpression: () => isEntityNameExpression,
- isEnumConst: () => isEnumConst,
- isEnumDeclaration: () => isEnumDeclaration,
- isEnumMember: () => isEnumMember,
- isEqualityOperatorKind: () => isEqualityOperatorKind,
- isEqualsGreaterThanToken: () => isEqualsGreaterThanToken,
- isExclamationToken: () => isExclamationToken,
- isExcludedFile: () => isExcludedFile,
- isExclusivelyTypeOnlyImportOrExport: () => isExclusivelyTypeOnlyImportOrExport,
- isExportAssignment: () => isExportAssignment,
- isExportDeclaration: () => isExportDeclaration,
- isExportModifier: () => isExportModifier,
- isExportName: () => isExportName,
- isExportNamespaceAsDefaultDeclaration: () => isExportNamespaceAsDefaultDeclaration,
- isExportOrDefaultModifier: () => isExportOrDefaultModifier,
- isExportSpecifier: () => isExportSpecifier,
- isExportsIdentifier: () => isExportsIdentifier,
- isExportsOrModuleExportsOrAlias: () => isExportsOrModuleExportsOrAlias,
- isExpression: () => isExpression,
- isExpressionNode: () => isExpressionNode,
- isExpressionOfExternalModuleImportEqualsDeclaration: () => isExpressionOfExternalModuleImportEqualsDeclaration,
- isExpressionOfOptionalChainRoot: () => isExpressionOfOptionalChainRoot,
- isExpressionStatement: () => isExpressionStatement,
- isExpressionWithTypeArguments: () => isExpressionWithTypeArguments,
- isExpressionWithTypeArgumentsInClassExtendsClause: () => isExpressionWithTypeArgumentsInClassExtendsClause,
- isExternalModule: () => isExternalModule,
- isExternalModuleAugmentation: () => isExternalModuleAugmentation,
- isExternalModuleImportEqualsDeclaration: () => isExternalModuleImportEqualsDeclaration,
- isExternalModuleIndicator: () => isExternalModuleIndicator,
- isExternalModuleNameRelative: () => isExternalModuleNameRelative,
- isExternalModuleReference: () => isExternalModuleReference,
- isExternalModuleSymbol: () => isExternalModuleSymbol,
- isExternalOrCommonJsModule: () => isExternalOrCommonJsModule,
- isFileLevelUniqueName: () => isFileLevelUniqueName,
- isFileProbablyExternalModule: () => isFileProbablyExternalModule,
- isFirstDeclarationOfSymbolParameter: () => isFirstDeclarationOfSymbolParameter,
- isFixablePromiseHandler: () => isFixablePromiseHandler,
- isForInOrOfStatement: () => isForInOrOfStatement,
- isForInStatement: () => isForInStatement,
- isForInitializer: () => isForInitializer,
- isForOfStatement: () => isForOfStatement,
- isForStatement: () => isForStatement,
- isFunctionBlock: () => isFunctionBlock,
- isFunctionBody: () => isFunctionBody,
- isFunctionDeclaration: () => isFunctionDeclaration,
- isFunctionExpression: () => isFunctionExpression,
- isFunctionExpressionOrArrowFunction: () => isFunctionExpressionOrArrowFunction,
- isFunctionLike: () => isFunctionLike,
- isFunctionLikeDeclaration: () => isFunctionLikeDeclaration,
- isFunctionLikeKind: () => isFunctionLikeKind,
- isFunctionLikeOrClassStaticBlockDeclaration: () => isFunctionLikeOrClassStaticBlockDeclaration,
- isFunctionOrConstructorTypeNode: () => isFunctionOrConstructorTypeNode,
- isFunctionOrModuleBlock: () => isFunctionOrModuleBlock,
- isFunctionSymbol: () => isFunctionSymbol,
- isFunctionTypeNode: () => isFunctionTypeNode,
- isFutureReservedKeyword: () => isFutureReservedKeyword,
- isGeneratedIdentifier: () => isGeneratedIdentifier,
- isGeneratedPrivateIdentifier: () => isGeneratedPrivateIdentifier,
- isGetAccessor: () => isGetAccessor,
- isGetAccessorDeclaration: () => isGetAccessorDeclaration,
- isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
- isGlobalDeclaration: () => isGlobalDeclaration,
- isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
- isHeritageClause: () => isHeritageClause,
- isHoistedFunction: () => isHoistedFunction,
- isHoistedVariableStatement: () => isHoistedVariableStatement,
- isIdentifier: () => isIdentifier,
- isIdentifierANonContextualKeyword: () => isIdentifierANonContextualKeyword,
- isIdentifierName: () => isIdentifierName,
- isIdentifierOrThisTypeNode: () => isIdentifierOrThisTypeNode,
- isIdentifierPart: () => isIdentifierPart,
- isIdentifierStart: () => isIdentifierStart,
- isIdentifierText: () => isIdentifierText,
- isIdentifierTypePredicate: () => isIdentifierTypePredicate,
- isIdentifierTypeReference: () => isIdentifierTypeReference,
- isIfStatement: () => isIfStatement,
- isIgnoredFileFromWildCardWatching: () => isIgnoredFileFromWildCardWatching,
- isImplicitGlob: () => isImplicitGlob,
- isImportCall: () => isImportCall,
- isImportClause: () => isImportClause,
- isImportDeclaration: () => isImportDeclaration,
- isImportEqualsDeclaration: () => isImportEqualsDeclaration,
- isImportKeyword: () => isImportKeyword,
- isImportMeta: () => isImportMeta,
- isImportOrExportSpecifier: () => isImportOrExportSpecifier,
- isImportOrExportSpecifierName: () => isImportOrExportSpecifierName,
- isImportSpecifier: () => isImportSpecifier,
- isImportTypeAssertionContainer: () => isImportTypeAssertionContainer,
- isImportTypeNode: () => isImportTypeNode,
- isImportableFile: () => isImportableFile,
- isInComment: () => isInComment,
- isInExpressionContext: () => isInExpressionContext,
- isInJSDoc: () => isInJSDoc,
- isInJSFile: () => isInJSFile,
- isInJSXText: () => isInJSXText,
- isInJsonFile: () => isInJsonFile,
- isInNonReferenceComment: () => isInNonReferenceComment,
- isInReferenceComment: () => isInReferenceComment,
- isInRightSideOfInternalImportEqualsDeclaration: () => isInRightSideOfInternalImportEqualsDeclaration,
- isInString: () => isInString,
- isInTemplateString: () => isInTemplateString,
- isInTopLevelContext: () => isInTopLevelContext,
- isIncrementalCompilation: () => isIncrementalCompilation,
- isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
- isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
- isInferTypeNode: () => isInferTypeNode,
- isInfinityOrNaNString: () => isInfinityOrNaNString,
- isInitializedProperty: () => isInitializedProperty,
- isInitializedVariable: () => isInitializedVariable,
- isInsideJsxElement: () => isInsideJsxElement,
- isInsideJsxElementOrAttribute: () => isInsideJsxElementOrAttribute,
- isInsideNodeModules: () => isInsideNodeModules,
- isInsideTemplateLiteral: () => isInsideTemplateLiteral,
- isInstantiatedModule: () => isInstantiatedModule,
- isInterfaceDeclaration: () => isInterfaceDeclaration,
- isInternalDeclaration: () => isInternalDeclaration,
- isInternalModuleImportEqualsDeclaration: () => isInternalModuleImportEqualsDeclaration,
- isInternalName: () => isInternalName,
- isIntersectionTypeNode: () => isIntersectionTypeNode,
- isIntrinsicJsxName: () => isIntrinsicJsxName,
- isIterationStatement: () => isIterationStatement,
- isJSDoc: () => isJSDoc,
- isJSDocAllType: () => isJSDocAllType,
- isJSDocAugmentsTag: () => isJSDocAugmentsTag,
- isJSDocAuthorTag: () => isJSDocAuthorTag,
- isJSDocCallbackTag: () => isJSDocCallbackTag,
- isJSDocClassTag: () => isJSDocClassTag,
- isJSDocCommentContainingNode: () => isJSDocCommentContainingNode,
- isJSDocConstructSignature: () => isJSDocConstructSignature,
- isJSDocDeprecatedTag: () => isJSDocDeprecatedTag,
- isJSDocEnumTag: () => isJSDocEnumTag,
- isJSDocFunctionType: () => isJSDocFunctionType,
- isJSDocImplementsTag: () => isJSDocImplementsTag,
- isJSDocIndexSignature: () => isJSDocIndexSignature,
- isJSDocLikeText: () => isJSDocLikeText,
- isJSDocLink: () => isJSDocLink,
- isJSDocLinkCode: () => isJSDocLinkCode,
- isJSDocLinkLike: () => isJSDocLinkLike,
- isJSDocLinkPlain: () => isJSDocLinkPlain,
- isJSDocMemberName: () => isJSDocMemberName,
- isJSDocNameReference: () => isJSDocNameReference,
- isJSDocNamepathType: () => isJSDocNamepathType,
- isJSDocNamespaceBody: () => isJSDocNamespaceBody,
- isJSDocNode: () => isJSDocNode,
- isJSDocNonNullableType: () => isJSDocNonNullableType,
- isJSDocNullableType: () => isJSDocNullableType,
- isJSDocOptionalParameter: () => isJSDocOptionalParameter,
- isJSDocOptionalType: () => isJSDocOptionalType,
- isJSDocOverloadTag: () => isJSDocOverloadTag,
- isJSDocOverrideTag: () => isJSDocOverrideTag,
- isJSDocParameterTag: () => isJSDocParameterTag,
- isJSDocPrivateTag: () => isJSDocPrivateTag,
- isJSDocPropertyLikeTag: () => isJSDocPropertyLikeTag,
- isJSDocPropertyTag: () => isJSDocPropertyTag,
- isJSDocProtectedTag: () => isJSDocProtectedTag,
- isJSDocPublicTag: () => isJSDocPublicTag,
- isJSDocReadonlyTag: () => isJSDocReadonlyTag,
- isJSDocReturnTag: () => isJSDocReturnTag,
- isJSDocSatisfiesExpression: () => isJSDocSatisfiesExpression,
- isJSDocSatisfiesTag: () => isJSDocSatisfiesTag,
- isJSDocSeeTag: () => isJSDocSeeTag,
- isJSDocSignature: () => isJSDocSignature,
- isJSDocTag: () => isJSDocTag,
- isJSDocTemplateTag: () => isJSDocTemplateTag,
- isJSDocThisTag: () => isJSDocThisTag,
- isJSDocThrowsTag: () => isJSDocThrowsTag,
- isJSDocTypeAlias: () => isJSDocTypeAlias,
- isJSDocTypeAssertion: () => isJSDocTypeAssertion,
- isJSDocTypeExpression: () => isJSDocTypeExpression,
- isJSDocTypeLiteral: () => isJSDocTypeLiteral,
- isJSDocTypeTag: () => isJSDocTypeTag,
- isJSDocTypedefTag: () => isJSDocTypedefTag,
- isJSDocUnknownTag: () => isJSDocUnknownTag,
- isJSDocUnknownType: () => isJSDocUnknownType,
- isJSDocVariadicType: () => isJSDocVariadicType,
- isJSXTagName: () => isJSXTagName,
- isJsonEqual: () => isJsonEqual,
- isJsonSourceFile: () => isJsonSourceFile,
- isJsxAttribute: () => isJsxAttribute,
- isJsxAttributeLike: () => isJsxAttributeLike,
- isJsxAttributes: () => isJsxAttributes,
- isJsxChild: () => isJsxChild,
- isJsxClosingElement: () => isJsxClosingElement,
- isJsxClosingFragment: () => isJsxClosingFragment,
- isJsxElement: () => isJsxElement,
- isJsxExpression: () => isJsxExpression,
- isJsxFragment: () => isJsxFragment,
- isJsxOpeningElement: () => isJsxOpeningElement,
- isJsxOpeningFragment: () => isJsxOpeningFragment,
- isJsxOpeningLikeElement: () => isJsxOpeningLikeElement,
- isJsxOpeningLikeElementTagName: () => isJsxOpeningLikeElementTagName,
- isJsxSelfClosingElement: () => isJsxSelfClosingElement,
- isJsxSpreadAttribute: () => isJsxSpreadAttribute,
- isJsxTagNameExpression: () => isJsxTagNameExpression,
- isJsxText: () => isJsxText,
- isJumpStatementTarget: () => isJumpStatementTarget,
- isKeyword: () => isKeyword,
- isKnownSymbol: () => isKnownSymbol,
- isLabelName: () => isLabelName,
- isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
- isLabeledStatement: () => isLabeledStatement,
- isLateVisibilityPaintedStatement: () => isLateVisibilityPaintedStatement,
- isLeftHandSideExpression: () => isLeftHandSideExpression,
- isLeftHandSideOfAssignment: () => isLeftHandSideOfAssignment,
- isLet: () => isLet,
- isLineBreak: () => isLineBreak,
- isLiteralComputedPropertyDeclarationName: () => isLiteralComputedPropertyDeclarationName,
- isLiteralExpression: () => isLiteralExpression,
- isLiteralExpressionOfObject: () => isLiteralExpressionOfObject,
- isLiteralImportTypeNode: () => isLiteralImportTypeNode,
- isLiteralKind: () => isLiteralKind,
- isLiteralLikeAccess: () => isLiteralLikeAccess,
- isLiteralLikeElementAccess: () => isLiteralLikeElementAccess,
- isLiteralNameOfPropertyDeclarationOrIndexAccess: () => isLiteralNameOfPropertyDeclarationOrIndexAccess,
- isLiteralTypeLikeExpression: () => isLiteralTypeLikeExpression,
- isLiteralTypeLiteral: () => isLiteralTypeLiteral,
- isLiteralTypeNode: () => isLiteralTypeNode,
- isLocalName: () => isLocalName,
- isLogicalOperator: () => isLogicalOperator,
- isLogicalOrCoalescingAssignmentExpression: () => isLogicalOrCoalescingAssignmentExpression,
- isLogicalOrCoalescingAssignmentOperator: () => isLogicalOrCoalescingAssignmentOperator,
- isLogicalOrCoalescingBinaryExpression: () => isLogicalOrCoalescingBinaryExpression,
- isLogicalOrCoalescingBinaryOperator: () => isLogicalOrCoalescingBinaryOperator,
- isMappedTypeNode: () => isMappedTypeNode,
- isMemberName: () => isMemberName,
- isMergeDeclarationMarker: () => isMergeDeclarationMarker,
- isMetaProperty: () => isMetaProperty,
- isMethodDeclaration: () => isMethodDeclaration,
- isMethodOrAccessor: () => isMethodOrAccessor,
- isMethodSignature: () => isMethodSignature,
- isMinusToken: () => isMinusToken,
- isMissingDeclaration: () => isMissingDeclaration,
- isModifier: () => isModifier,
- isModifierKind: () => isModifierKind,
- isModifierLike: () => isModifierLike,
- isModuleAugmentationExternal: () => isModuleAugmentationExternal,
- isModuleBlock: () => isModuleBlock,
- isModuleBody: () => isModuleBody,
- isModuleDeclaration: () => isModuleDeclaration,
- isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
- isModuleIdentifier: () => isModuleIdentifier,
- isModuleName: () => isModuleName,
- isModuleOrEnumDeclaration: () => isModuleOrEnumDeclaration,
- isModuleReference: () => isModuleReference,
- isModuleSpecifierLike: () => isModuleSpecifierLike,
- isModuleWithStringLiteralName: () => isModuleWithStringLiteralName,
- isNameOfFunctionDeclaration: () => isNameOfFunctionDeclaration,
- isNameOfModuleDeclaration: () => isNameOfModuleDeclaration,
- isNamedClassElement: () => isNamedClassElement,
- isNamedDeclaration: () => isNamedDeclaration,
- isNamedEvaluation: () => isNamedEvaluation,
- isNamedEvaluationSource: () => isNamedEvaluationSource,
- isNamedExportBindings: () => isNamedExportBindings,
- isNamedExports: () => isNamedExports,
- isNamedImportBindings: () => isNamedImportBindings,
- isNamedImports: () => isNamedImports,
- isNamedImportsOrExports: () => isNamedImportsOrExports,
- isNamedTupleMember: () => isNamedTupleMember,
- isNamespaceBody: () => isNamespaceBody,
- isNamespaceExport: () => isNamespaceExport,
- isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
- isNamespaceImport: () => isNamespaceImport,
- isNamespaceReexportDeclaration: () => isNamespaceReexportDeclaration,
- isNewExpression: () => isNewExpression,
- isNewExpressionTarget: () => isNewExpressionTarget,
- isNightly: () => isNightly,
- isNoSubstitutionTemplateLiteral: () => isNoSubstitutionTemplateLiteral,
- isNode: () => isNode,
- isNodeArray: () => isNodeArray,
- isNodeArrayMultiLine: () => isNodeArrayMultiLine,
- isNodeDescendantOf: () => isNodeDescendantOf,
- isNodeKind: () => isNodeKind,
- isNodeLikeSystem: () => isNodeLikeSystem,
- isNodeModulesDirectory: () => isNodeModulesDirectory,
- isNodeWithPossibleHoistedDeclaration: () => isNodeWithPossibleHoistedDeclaration,
- isNonContextualKeyword: () => isNonContextualKeyword,
- isNonExportDefaultModifier: () => isNonExportDefaultModifier,
- isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
- isNonGlobalDeclaration: () => isNonGlobalDeclaration,
- isNonNullAccess: () => isNonNullAccess,
- isNonNullChain: () => isNonNullChain,
- isNonNullExpression: () => isNonNullExpression,
- isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
- isNotEmittedOrPartiallyEmittedNode: () => isNotEmittedOrPartiallyEmittedNode,
- isNotEmittedStatement: () => isNotEmittedStatement,
- isNullishCoalesce: () => isNullishCoalesce,
- isNumber: () => isNumber,
- isNumericLiteral: () => isNumericLiteral,
- isNumericLiteralName: () => isNumericLiteralName,
- isObjectBindingElementWithoutPropertyName: () => isObjectBindingElementWithoutPropertyName,
- isObjectBindingOrAssignmentElement: () => isObjectBindingOrAssignmentElement,
- isObjectBindingOrAssignmentPattern: () => isObjectBindingOrAssignmentPattern,
- isObjectBindingPattern: () => isObjectBindingPattern,
- isObjectLiteralElement: () => isObjectLiteralElement,
- isObjectLiteralElementLike: () => isObjectLiteralElementLike,
- isObjectLiteralExpression: () => isObjectLiteralExpression,
- isObjectLiteralMethod: () => isObjectLiteralMethod,
- isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor,
- isObjectTypeDeclaration: () => isObjectTypeDeclaration,
- isOctalDigit: () => isOctalDigit,
- isOmittedExpression: () => isOmittedExpression,
- isOptionalChain: () => isOptionalChain,
- isOptionalChainRoot: () => isOptionalChainRoot,
- isOptionalDeclaration: () => isOptionalDeclaration,
- isOptionalJSDocPropertyLikeTag: () => isOptionalJSDocPropertyLikeTag,
- isOptionalTypeNode: () => isOptionalTypeNode,
- isOuterExpression: () => isOuterExpression,
- isOutermostOptionalChain: () => isOutermostOptionalChain,
- isOverrideModifier: () => isOverrideModifier,
- isPackedArrayLiteral: () => isPackedArrayLiteral,
- isParameter: () => isParameter,
- isParameterDeclaration: () => isParameterDeclaration,
- isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
- isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
- isParameterPropertyModifier: () => isParameterPropertyModifier,
- isParenthesizedExpression: () => isParenthesizedExpression,
- isParenthesizedTypeNode: () => isParenthesizedTypeNode,
- isParseTreeNode: () => isParseTreeNode,
- isPartOfTypeNode: () => isPartOfTypeNode,
- isPartOfTypeQuery: () => isPartOfTypeQuery,
- isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
- isPatternMatch: () => isPatternMatch,
- isPinnedComment: () => isPinnedComment,
- isPlainJsFile: () => isPlainJsFile,
- isPlusToken: () => isPlusToken,
- isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition,
- isPostfixUnaryExpression: () => isPostfixUnaryExpression,
- isPrefixUnaryExpression: () => isPrefixUnaryExpression,
- isPrivateIdentifier: () => isPrivateIdentifier,
- isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
- isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
- isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
- isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
- isProgramUptoDate: () => isProgramUptoDate,
- isPrologueDirective: () => isPrologueDirective,
- isPropertyAccessChain: () => isPropertyAccessChain,
- isPropertyAccessEntityNameExpression: () => isPropertyAccessEntityNameExpression,
- isPropertyAccessExpression: () => isPropertyAccessExpression,
- isPropertyAccessOrQualifiedName: () => isPropertyAccessOrQualifiedName,
- isPropertyAccessOrQualifiedNameOrImportTypeNode: () => isPropertyAccessOrQualifiedNameOrImportTypeNode,
- isPropertyAssignment: () => isPropertyAssignment,
- isPropertyDeclaration: () => isPropertyDeclaration,
- isPropertyName: () => isPropertyName,
- isPropertyNameLiteral: () => isPropertyNameLiteral,
- isPropertySignature: () => isPropertySignature,
- isProtoSetter: () => isProtoSetter,
- isPrototypeAccess: () => isPrototypeAccess,
- isPrototypePropertyAssignment: () => isPrototypePropertyAssignment,
- isPunctuation: () => isPunctuation,
- isPushOrUnshiftIdentifier: () => isPushOrUnshiftIdentifier,
- isQualifiedName: () => isQualifiedName,
- isQuestionDotToken: () => isQuestionDotToken,
- isQuestionOrExclamationToken: () => isQuestionOrExclamationToken,
- isQuestionOrPlusOrMinusToken: () => isQuestionOrPlusOrMinusToken,
- isQuestionToken: () => isQuestionToken,
- isRawSourceMap: () => isRawSourceMap,
- isReadonlyKeyword: () => isReadonlyKeyword,
- isReadonlyKeywordOrPlusOrMinusToken: () => isReadonlyKeywordOrPlusOrMinusToken,
- isRecognizedTripleSlashComment: () => isRecognizedTripleSlashComment,
- isReferenceFileLocation: () => isReferenceFileLocation,
- isReferencedFile: () => isReferencedFile,
- isRegularExpressionLiteral: () => isRegularExpressionLiteral,
- isRequireCall: () => isRequireCall,
- isRequireVariableStatement: () => isRequireVariableStatement,
- isRestParameter: () => isRestParameter,
- isRestTypeNode: () => isRestTypeNode,
- isReturnStatement: () => isReturnStatement,
- isReturnStatementWithFixablePromiseHandler: () => isReturnStatementWithFixablePromiseHandler,
- isRightSideOfAccessExpression: () => isRightSideOfAccessExpression,
- isRightSideOfPropertyAccess: () => isRightSideOfPropertyAccess,
- isRightSideOfQualifiedName: () => isRightSideOfQualifiedName,
- isRightSideOfQualifiedNameOrPropertyAccess: () => isRightSideOfQualifiedNameOrPropertyAccess,
- isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName: () => isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName,
- isRootedDiskPath: () => isRootedDiskPath,
- isSameEntityName: () => isSameEntityName,
- isSatisfiesExpression: () => isSatisfiesExpression,
- isScopeMarker: () => isScopeMarker,
- isSemicolonClassElement: () => isSemicolonClassElement,
- isSetAccessor: () => isSetAccessor,
- isSetAccessorDeclaration: () => isSetAccessorDeclaration,
- isShebangTrivia: () => isShebangTrivia,
- isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
- isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
- isSignedNumericLiteral: () => isSignedNumericLiteral,
- isSimpleCopiableExpression: () => isSimpleCopiableExpression,
- isSimpleInlineableExpression: () => isSimpleInlineableExpression,
- isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
- isSourceFile: () => isSourceFile,
- isSourceFileFromLibrary: () => isSourceFileFromLibrary,
- isSourceFileJS: () => isSourceFileJS,
- isSourceFileNotJS: () => isSourceFileNotJS,
- isSourceFileNotJson: () => isSourceFileNotJson,
- isSourceMapping: () => isSourceMapping,
- isSpecialPropertyDeclaration: () => isSpecialPropertyDeclaration,
- isSpreadAssignment: () => isSpreadAssignment,
- isSpreadElement: () => isSpreadElement,
- isStatement: () => isStatement,
- isStatementButNotDeclaration: () => isStatementButNotDeclaration,
- isStatementOrBlock: () => isStatementOrBlock,
- isStatementWithLocals: () => isStatementWithLocals,
- isStatic: () => isStatic,
- isStaticModifier: () => isStaticModifier,
- isString: () => isString,
- isStringAKeyword: () => isStringAKeyword,
- isStringANonContextualKeyword: () => isStringANonContextualKeyword,
- isStringDoubleQuoted: () => isStringDoubleQuoted,
- isStringLiteral: () => isStringLiteral,
- isStringLiteralLike: () => isStringLiteralLike,
- isStringLiteralOrJsxExpression: () => isStringLiteralOrJsxExpression,
- isStringLiteralOrTemplate: () => isStringLiteralOrTemplate,
- isStringOrNumericLiteralLike: () => isStringOrNumericLiteralLike,
- isStringOrRegularExpressionOrTemplateLiteral: () => isStringOrRegularExpressionOrTemplateLiteral,
- isStringTextContainingNode: () => isStringTextContainingNode,
- isSuperCall: () => isSuperCall,
- isSuperKeyword: () => isSuperKeyword,
- isSuperOrSuperProperty: () => isSuperOrSuperProperty,
- isSuperProperty: () => isSuperProperty,
- isSupportedSourceFileName: () => isSupportedSourceFileName,
- isSwitchStatement: () => isSwitchStatement,
- isSyntaxList: () => isSyntaxList,
- isSyntheticExpression: () => isSyntheticExpression,
- isSyntheticReference: () => isSyntheticReference,
- isTagName: () => isTagName,
- isTaggedTemplateExpression: () => isTaggedTemplateExpression,
- isTaggedTemplateTag: () => isTaggedTemplateTag,
- isTemplateExpression: () => isTemplateExpression,
- isTemplateHead: () => isTemplateHead,
- isTemplateLiteral: () => isTemplateLiteral,
- isTemplateLiteralKind: () => isTemplateLiteralKind,
- isTemplateLiteralToken: () => isTemplateLiteralToken,
- isTemplateLiteralTypeNode: () => isTemplateLiteralTypeNode,
- isTemplateLiteralTypeSpan: () => isTemplateLiteralTypeSpan,
- isTemplateMiddle: () => isTemplateMiddle,
- isTemplateMiddleOrTemplateTail: () => isTemplateMiddleOrTemplateTail,
- isTemplateSpan: () => isTemplateSpan,
- isTemplateTail: () => isTemplateTail,
- isTextWhiteSpaceLike: () => isTextWhiteSpaceLike,
- isThis: () => isThis,
- isThisContainerOrFunctionBlock: () => isThisContainerOrFunctionBlock,
- isThisIdentifier: () => isThisIdentifier,
- isThisInTypeQuery: () => isThisInTypeQuery,
- isThisInitializedDeclaration: () => isThisInitializedDeclaration,
- isThisInitializedObjectBindingExpression: () => isThisInitializedObjectBindingExpression,
- isThisProperty: () => isThisProperty,
- isThisTypeNode: () => isThisTypeNode,
- isThisTypeParameter: () => isThisTypeParameter,
- isThisTypePredicate: () => isThisTypePredicate,
- isThrowStatement: () => isThrowStatement,
- isToken: () => isToken,
- isTokenKind: () => isTokenKind,
- isTraceEnabled: () => isTraceEnabled,
- isTransientSymbol: () => isTransientSymbol,
- isTrivia: () => isTrivia,
- isTryStatement: () => isTryStatement,
- isTupleTypeNode: () => isTupleTypeNode,
- isTypeAlias: () => isTypeAlias,
- isTypeAliasDeclaration: () => isTypeAliasDeclaration,
- isTypeAssertionExpression: () => isTypeAssertionExpression,
- isTypeDeclaration: () => isTypeDeclaration,
- isTypeElement: () => isTypeElement,
- isTypeKeyword: () => isTypeKeyword,
- isTypeKeywordToken: () => isTypeKeywordToken,
- isTypeKeywordTokenOrIdentifier: () => isTypeKeywordTokenOrIdentifier,
- isTypeLiteralNode: () => isTypeLiteralNode,
- isTypeNode: () => isTypeNode,
- isTypeNodeKind: () => isTypeNodeKind,
- isTypeOfExpression: () => isTypeOfExpression,
- isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
- isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
- isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
- isTypeOperatorNode: () => isTypeOperatorNode,
- isTypeParameterDeclaration: () => isTypeParameterDeclaration,
- isTypePredicateNode: () => isTypePredicateNode,
- isTypeQueryNode: () => isTypeQueryNode,
- isTypeReferenceNode: () => isTypeReferenceNode,
- isTypeReferenceType: () => isTypeReferenceType,
- isUMDExportSymbol: () => isUMDExportSymbol,
- isUnaryExpression: () => isUnaryExpression,
- isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
- isUnicodeIdentifierStart: () => isUnicodeIdentifierStart,
- isUnionTypeNode: () => isUnionTypeNode,
- isUnparsedNode: () => isUnparsedNode,
- isUnparsedPrepend: () => isUnparsedPrepend,
- isUnparsedSource: () => isUnparsedSource,
- isUnparsedTextLike: () => isUnparsedTextLike,
- isUrl: () => isUrl,
- isValidBigIntString: () => isValidBigIntString,
- isValidESSymbolDeclaration: () => isValidESSymbolDeclaration,
- isValidTypeOnlyAliasUseSite: () => isValidTypeOnlyAliasUseSite,
- isValueSignatureDeclaration: () => isValueSignatureDeclaration,
- isVarConst: () => isVarConst,
- isVariableDeclaration: () => isVariableDeclaration,
- isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement,
- isVariableDeclarationInitializedToBareOrAccessedRequire: () => isVariableDeclarationInitializedToBareOrAccessedRequire,
- isVariableDeclarationInitializedToRequire: () => isVariableDeclarationInitializedToRequire,
- isVariableDeclarationList: () => isVariableDeclarationList,
- isVariableLike: () => isVariableLike,
- isVariableLikeOrAccessor: () => isVariableLikeOrAccessor,
- isVariableStatement: () => isVariableStatement,
- isVoidExpression: () => isVoidExpression,
- isWatchSet: () => isWatchSet,
- isWhileStatement: () => isWhileStatement,
- isWhiteSpaceLike: () => isWhiteSpaceLike,
- isWhiteSpaceSingleLine: () => isWhiteSpaceSingleLine,
- isWithStatement: () => isWithStatement,
- isWriteAccess: () => isWriteAccess,
- isWriteOnlyAccess: () => isWriteOnlyAccess,
- isYieldExpression: () => isYieldExpression,
- jsxModeNeedsExplicitImport: () => jsxModeNeedsExplicitImport,
- keywordPart: () => keywordPart,
- last: () => last,
- lastOrUndefined: () => lastOrUndefined,
- length: () => length,
- libMap: () => libMap,
- libs: () => libs,
- lineBreakPart: () => lineBreakPart,
- linkNamePart: () => linkNamePart,
- linkPart: () => linkPart,
- linkTextPart: () => linkTextPart,
- listFiles: () => listFiles,
- loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
- loadWithModeAwareCache: () => loadWithModeAwareCache,
- makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
- makeImport: () => makeImport,
- makeImportIfNecessary: () => makeImportIfNecessary,
- makeStringLiteral: () => makeStringLiteral,
- mangleScopedPackageName: () => mangleScopedPackageName,
- map: () => map,
- mapAllOrFail: () => mapAllOrFail,
- mapDefined: () => mapDefined,
- mapDefinedEntries: () => mapDefinedEntries,
- mapDefinedIterator: () => mapDefinedIterator,
- mapEntries: () => mapEntries,
- mapIterator: () => mapIterator,
- mapOneOrMany: () => mapOneOrMany,
- mapToDisplayParts: () => mapToDisplayParts,
- matchFiles: () => matchFiles,
- matchPatternOrExact: () => matchPatternOrExact,
- matchedText: () => matchedText,
- matchesExclude: () => matchesExclude,
- maybeBind: () => maybeBind,
- maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
- memoize: () => memoize,
- memoizeCached: () => memoizeCached,
- memoizeOne: () => memoizeOne,
- memoizeWeak: () => memoizeWeak,
- metadataHelper: () => metadataHelper,
- min: () => min,
- minAndMax: () => minAndMax,
- missingFileModifiedTime: () => missingFileModifiedTime,
- modifierToFlag: () => modifierToFlag,
- modifiersToFlags: () => modifiersToFlags,
- moduleOptionDeclaration: () => moduleOptionDeclaration,
- moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
- moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
- moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
- moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
- moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
- moduleSpecifiers: () => ts_moduleSpecifiers_exports,
- moveEmitHelpers: () => moveEmitHelpers,
- moveRangeEnd: () => moveRangeEnd,
- moveRangePastDecorators: () => moveRangePastDecorators,
- moveRangePastModifiers: () => moveRangePastModifiers,
- moveRangePos: () => moveRangePos,
- moveSyntheticComments: () => moveSyntheticComments,
- mutateMap: () => mutateMap,
- mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
- needsParentheses: () => needsParentheses,
- needsScopeMarker: () => needsScopeMarker,
- newPrivateEnvironment: () => newPrivateEnvironment,
- noEmitNotification: () => noEmitNotification,
- noEmitSubstitution: () => noEmitSubstitution,
- noTransformers: () => noTransformers,
- noTruncationMaximumTruncationLength: () => noTruncationMaximumTruncationLength,
- nodeCanBeDecorated: () => nodeCanBeDecorated,
- nodeHasName: () => nodeHasName,
- nodeIsDecorated: () => nodeIsDecorated,
- nodeIsMissing: () => nodeIsMissing,
- nodeIsPresent: () => nodeIsPresent,
- nodeIsSynthesized: () => nodeIsSynthesized,
- nodeModuleNameResolver: () => nodeModuleNameResolver,
- nodeModulesPathPart: () => nodeModulesPathPart,
- nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
- nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
- nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
- nodePosToString: () => nodePosToString,
- nodeSeenTracker: () => nodeSeenTracker,
- nodeStartsNewLexicalEnvironment: () => nodeStartsNewLexicalEnvironment,
- nodeToDisplayParts: () => nodeToDisplayParts,
- noop: () => noop,
- noopFileWatcher: () => noopFileWatcher,
- noopPush: () => noopPush,
- normalizePath: () => normalizePath,
- normalizeSlashes: () => normalizeSlashes,
- not: () => not,
- notImplemented: () => notImplemented,
- notImplementedResolver: () => notImplementedResolver,
- nullNodeConverters: () => nullNodeConverters,
- nullParenthesizerRules: () => nullParenthesizerRules,
- nullTransformationContext: () => nullTransformationContext,
- objectAllocator: () => objectAllocator,
- operatorPart: () => operatorPart,
- optionDeclarations: () => optionDeclarations,
- optionMapToObject: () => optionMapToObject,
- optionsAffectingProgramStructure: () => optionsAffectingProgramStructure,
- optionsForBuild: () => optionsForBuild,
- optionsForWatch: () => optionsForWatch,
- optionsHaveChanges: () => optionsHaveChanges,
- optionsHaveModuleResolutionChanges: () => optionsHaveModuleResolutionChanges,
- or: () => or,
- orderedRemoveItem: () => orderedRemoveItem,
- orderedRemoveItemAt: () => orderedRemoveItemAt,
- outFile: () => outFile,
- packageIdToPackageName: () => packageIdToPackageName,
- packageIdToString: () => packageIdToString,
- padLeft: () => padLeft,
- padRight: () => padRight,
- paramHelper: () => paramHelper,
- parameterIsThisKeyword: () => parameterIsThisKeyword,
- parameterNamePart: () => parameterNamePart,
- parseBaseNodeFactory: () => parseBaseNodeFactory,
- parseBigInt: () => parseBigInt,
- parseBuildCommand: () => parseBuildCommand,
- parseCommandLine: () => parseCommandLine,
- parseCommandLineWorker: () => parseCommandLineWorker,
- parseConfigFileTextToJson: () => parseConfigFileTextToJson,
- parseConfigFileWithSystem: () => parseConfigFileWithSystem,
- parseConfigHostFromCompilerHostLike: () => parseConfigHostFromCompilerHostLike,
- parseCustomTypeOption: () => parseCustomTypeOption,
- parseIsolatedEntityName: () => parseIsolatedEntityName,
- parseIsolatedJSDocComment: () => parseIsolatedJSDocComment,
- parseJSDocTypeExpressionForTests: () => parseJSDocTypeExpressionForTests,
- parseJsonConfigFileContent: () => parseJsonConfigFileContent,
- parseJsonSourceFileConfigFileContent: () => parseJsonSourceFileConfigFileContent,
- parseJsonText: () => parseJsonText,
- parseListTypeOption: () => parseListTypeOption,
- parseNodeFactory: () => parseNodeFactory,
- parseNodeModuleFromPath: () => parseNodeModuleFromPath,
- parsePackageName: () => parsePackageName,
- parsePseudoBigInt: () => parsePseudoBigInt,
- parseValidBigInt: () => parseValidBigInt,
- patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
- pathContainsNodeModules: () => pathContainsNodeModules,
- pathIsAbsolute: () => pathIsAbsolute,
- pathIsBareSpecifier: () => pathIsBareSpecifier,
- pathIsRelative: () => pathIsRelative,
- patternText: () => patternText,
- perfLogger: () => perfLogger,
- performIncrementalCompilation: () => performIncrementalCompilation,
- performance: () => ts_performance_exports,
- plainJSErrors: () => plainJSErrors,
- positionBelongsToNode: () => positionBelongsToNode,
- positionIsASICandidate: () => positionIsASICandidate,
- positionIsSynthesized: () => positionIsSynthesized,
- positionsAreOnSameLine: () => positionsAreOnSameLine,
- preProcessFile: () => preProcessFile,
- probablyUsesSemicolons: () => probablyUsesSemicolons,
- processCommentPragmas: () => processCommentPragmas,
- processPragmasIntoFields: () => processPragmasIntoFields,
- processTaggedTemplateExpression: () => processTaggedTemplateExpression,
- programContainsEsModules: () => programContainsEsModules,
- programContainsModules: () => programContainsModules,
- projectReferenceIsEqualTo: () => projectReferenceIsEqualTo,
- propKeyHelper: () => propKeyHelper,
- propertyNamePart: () => propertyNamePart,
- pseudoBigIntToString: () => pseudoBigIntToString,
- punctuationPart: () => punctuationPart,
- pushIfUnique: () => pushIfUnique,
- quote: () => quote,
- quotePreferenceFromString: () => quotePreferenceFromString,
- rangeContainsPosition: () => rangeContainsPosition,
- rangeContainsPositionExclusive: () => rangeContainsPositionExclusive,
- rangeContainsRange: () => rangeContainsRange,
- rangeContainsRangeExclusive: () => rangeContainsRangeExclusive,
- rangeContainsStartEnd: () => rangeContainsStartEnd,
- rangeEndIsOnSameLineAsRangeStart: () => rangeEndIsOnSameLineAsRangeStart,
- rangeEndPositionsAreOnSameLine: () => rangeEndPositionsAreOnSameLine,
- rangeEquals: () => rangeEquals,
- rangeIsOnSingleLine: () => rangeIsOnSingleLine,
- rangeOfNode: () => rangeOfNode,
- rangeOfTypeParameters: () => rangeOfTypeParameters,
- rangeOverlapsWithStartEnd: () => rangeOverlapsWithStartEnd,
- rangeStartIsOnSameLineAsRangeEnd: () => rangeStartIsOnSameLineAsRangeEnd,
- rangeStartPositionsAreOnSameLine: () => rangeStartPositionsAreOnSameLine,
- readBuilderProgram: () => readBuilderProgram,
- readConfigFile: () => readConfigFile,
- readHelper: () => readHelper,
- readJson: () => readJson,
- readJsonConfigFile: () => readJsonConfigFile,
- readJsonOrUndefined: () => readJsonOrUndefined,
- realizeDiagnostics: () => realizeDiagnostics,
- reduceEachLeadingCommentRange: () => reduceEachLeadingCommentRange,
- reduceEachTrailingCommentRange: () => reduceEachTrailingCommentRange,
- reduceLeft: () => reduceLeft,
- reduceLeftIterator: () => reduceLeftIterator,
- reducePathComponents: () => reducePathComponents,
- refactor: () => ts_refactor_exports,
- regExpEscape: () => regExpEscape,
- relativeComplement: () => relativeComplement,
- removeAllComments: () => removeAllComments,
- removeEmitHelper: () => removeEmitHelper,
- removeExtension: () => removeExtension,
- removeFileExtension: () => removeFileExtension,
- removeIgnoredPath: () => removeIgnoredPath,
- removeMinAndVersionNumbers: () => removeMinAndVersionNumbers,
- removeOptionality: () => removeOptionality,
- removePrefix: () => removePrefix,
- removeSuffix: () => removeSuffix,
- removeTrailingDirectorySeparator: () => removeTrailingDirectorySeparator,
- repeatString: () => repeatString,
- replaceElement: () => replaceElement,
- resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
- resolveConfigFileProjectName: () => resolveConfigFileProjectName,
- resolveJSModule: () => resolveJSModule,
- resolveModuleName: () => resolveModuleName,
- resolveModuleNameFromCache: () => resolveModuleNameFromCache,
- resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
- resolvePath: () => resolvePath,
- resolveProjectReferencePath: () => resolveProjectReferencePath,
- resolveTripleslashReference: () => resolveTripleslashReference,
- resolveTypeReferenceDirective: () => resolveTypeReferenceDirective,
- resolvingEmptyArray: () => resolvingEmptyArray,
- restHelper: () => restHelper,
- returnFalse: () => returnFalse,
- returnNoopFileWatcher: () => returnNoopFileWatcher,
- returnTrue: () => returnTrue,
- returnUndefined: () => returnUndefined,
- returnsPromise: () => returnsPromise,
- runInitializersHelper: () => runInitializersHelper,
- sameFlatMap: () => sameFlatMap,
- sameMap: () => sameMap,
- sameMapping: () => sameMapping,
- scanShebangTrivia: () => scanShebangTrivia,
- scanTokenAtPosition: () => scanTokenAtPosition,
- scanner: () => scanner,
- screenStartingMessageCodes: () => screenStartingMessageCodes,
- semanticDiagnosticsOptionDeclarations: () => semanticDiagnosticsOptionDeclarations,
- serializeCompilerOptions: () => serializeCompilerOptions,
- server: () => ts_server_exports2,
- servicesVersion: () => servicesVersion,
- setCommentRange: () => setCommentRange,
- setConfigFileInOptions: () => setConfigFileInOptions,
- setConstantValue: () => setConstantValue,
- setEachParent: () => setEachParent,
- setEmitFlags: () => setEmitFlags,
- setFunctionNameHelper: () => setFunctionNameHelper,
- setGetSourceFileAsHashVersioned: () => setGetSourceFileAsHashVersioned,
- setIdentifierAutoGenerate: () => setIdentifierAutoGenerate,
- setIdentifierGeneratedImportReference: () => setIdentifierGeneratedImportReference,
- setIdentifierTypeArguments: () => setIdentifierTypeArguments,
- setInternalEmitFlags: () => setInternalEmitFlags,
- setLocalizedDiagnosticMessages: () => setLocalizedDiagnosticMessages,
- setModuleDefaultHelper: () => setModuleDefaultHelper,
- setNodeFlags: () => setNodeFlags,
- setObjectAllocator: () => setObjectAllocator,
- setOriginalNode: () => setOriginalNode,
- setParent: () => setParent,
- setParentRecursive: () => setParentRecursive,
- setPrivateIdentifier: () => setPrivateIdentifier,
- setResolvedModule: () => setResolvedModule,
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
- setSnippetElement: () => setSnippetElement,
- setSourceMapRange: () => setSourceMapRange,
- setStackTraceLimit: () => setStackTraceLimit,
- setStartsOnNewLine: () => setStartsOnNewLine,
- setSyntheticLeadingComments: () => setSyntheticLeadingComments,
- setSyntheticTrailingComments: () => setSyntheticTrailingComments,
- setSys: () => setSys,
- setSysLog: () => setSysLog,
- setTextRange: () => setTextRange,
- setTextRangeEnd: () => setTextRangeEnd,
- setTextRangePos: () => setTextRangePos,
- setTextRangePosEnd: () => setTextRangePosEnd,
- setTextRangePosWidth: () => setTextRangePosWidth,
- setTokenSourceMapRange: () => setTokenSourceMapRange,
- setTypeNode: () => setTypeNode,
- setUILocale: () => setUILocale,
- setValueDeclaration: () => setValueDeclaration,
- shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
- shouldPreserveConstEnums: () => shouldPreserveConstEnums,
- shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
- showModuleSpecifier: () => showModuleSpecifier,
- signatureHasLiteralTypes: () => signatureHasLiteralTypes,
- signatureHasRestParameter: () => signatureHasRestParameter,
- signatureToDisplayParts: () => signatureToDisplayParts,
- single: () => single,
- singleElementArray: () => singleElementArray,
- singleIterator: () => singleIterator,
- singleOrMany: () => singleOrMany,
- singleOrUndefined: () => singleOrUndefined,
- skipAlias: () => skipAlias,
- skipAssertions: () => skipAssertions,
- skipConstraint: () => skipConstraint,
- skipOuterExpressions: () => skipOuterExpressions,
- skipParentheses: () => skipParentheses,
- skipPartiallyEmittedExpressions: () => skipPartiallyEmittedExpressions,
- skipTrivia: () => skipTrivia,
- skipTypeChecking: () => skipTypeChecking,
- skipTypeParentheses: () => skipTypeParentheses,
- skipWhile: () => skipWhile,
- sliceAfter: () => sliceAfter,
- some: () => some,
- sort: () => sort,
- sortAndDeduplicate: () => sortAndDeduplicate,
- sortAndDeduplicateDiagnostics: () => sortAndDeduplicateDiagnostics,
- sourceFileAffectingCompilerOptions: () => sourceFileAffectingCompilerOptions,
- sourceFileMayBeEmitted: () => sourceFileMayBeEmitted,
- sourceMapCommentRegExp: () => sourceMapCommentRegExp,
- sourceMapCommentRegExpDontCareLineStart: () => sourceMapCommentRegExpDontCareLineStart,
- spacePart: () => spacePart,
- spanMap: () => spanMap,
- spreadArrayHelper: () => spreadArrayHelper,
- stableSort: () => stableSort,
- startEndContainsRange: () => startEndContainsRange,
- startEndOverlapsWithStartEnd: () => startEndOverlapsWithStartEnd,
- startOnNewLine: () => startOnNewLine,
- startTracing: () => startTracing,
- startsWith: () => startsWith,
- startsWithDirectory: () => startsWithDirectory,
- startsWithUnderscore: () => startsWithUnderscore,
- startsWithUseStrict: () => startsWithUseStrict,
- stringContains: () => stringContains,
- stringContainsAt: () => stringContainsAt,
- stringToToken: () => stringToToken,
- stripQuotes: () => stripQuotes,
- supportedDeclarationExtensions: () => supportedDeclarationExtensions,
- supportedJSExtensions: () => supportedJSExtensions,
- supportedJSExtensionsFlat: () => supportedJSExtensionsFlat,
- supportedLocaleDirectories: () => supportedLocaleDirectories,
- supportedTSExtensions: () => supportedTSExtensions,
- supportedTSExtensionsFlat: () => supportedTSExtensionsFlat,
- supportedTSImplementationExtensions: () => supportedTSImplementationExtensions,
- suppressLeadingAndTrailingTrivia: () => suppressLeadingAndTrailingTrivia,
- suppressLeadingTrivia: () => suppressLeadingTrivia,
- suppressTrailingTrivia: () => suppressTrailingTrivia,
- symbolEscapedNameNoDefault: () => symbolEscapedNameNoDefault,
- symbolName: () => symbolName,
- symbolNameNoDefault: () => symbolNameNoDefault,
- symbolPart: () => symbolPart,
- symbolToDisplayParts: () => symbolToDisplayParts,
- syntaxMayBeASICandidate: () => syntaxMayBeASICandidate,
- syntaxRequiresTrailingSemicolonOrASI: () => syntaxRequiresTrailingSemicolonOrASI,
- sys: () => sys,
- sysLog: () => sysLog,
- tagNamesAreEquivalent: () => tagNamesAreEquivalent,
- takeWhile: () => takeWhile,
- targetOptionDeclaration: () => targetOptionDeclaration,
- templateObjectHelper: () => templateObjectHelper,
- testFormatSettings: () => testFormatSettings,
- textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
- textChangeRangeNewSpan: () => textChangeRangeNewSpan,
- textChanges: () => ts_textChanges_exports,
- textOrKeywordPart: () => textOrKeywordPart,
- textPart: () => textPart,
- textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
- textSpanContainsPosition: () => textSpanContainsPosition,
- textSpanContainsTextSpan: () => textSpanContainsTextSpan,
- textSpanEnd: () => textSpanEnd,
- textSpanIntersection: () => textSpanIntersection,
- textSpanIntersectsWith: () => textSpanIntersectsWith,
- textSpanIntersectsWithPosition: () => textSpanIntersectsWithPosition,
- textSpanIntersectsWithTextSpan: () => textSpanIntersectsWithTextSpan,
- textSpanIsEmpty: () => textSpanIsEmpty,
- textSpanOverlap: () => textSpanOverlap,
- textSpanOverlapsWith: () => textSpanOverlapsWith,
- textSpansEqual: () => textSpansEqual,
- textToKeywordObj: () => textToKeywordObj,
- timestamp: () => timestamp,
- toArray: () => toArray,
- toBuilderFileEmit: () => toBuilderFileEmit,
- toBuilderStateFileInfoForMultiEmit: () => toBuilderStateFileInfoForMultiEmit,
- toEditorSettings: () => toEditorSettings,
- toFileNameLowerCase: () => toFileNameLowerCase,
- toLowerCase: () => toLowerCase,
- toPath: () => toPath,
- toProgramEmitPending: () => toProgramEmitPending,
- tokenIsIdentifierOrKeyword: () => tokenIsIdentifierOrKeyword,
- tokenIsIdentifierOrKeywordOrGreaterThan: () => tokenIsIdentifierOrKeywordOrGreaterThan,
- tokenToString: () => tokenToString,
- trace: () => trace,
- tracing: () => tracing,
- tracingEnabled: () => tracingEnabled,
- transform: () => transform,
- transformClassFields: () => transformClassFields,
- transformDeclarations: () => transformDeclarations,
- transformECMAScriptModule: () => transformECMAScriptModule,
- transformES2015: () => transformES2015,
- transformES2016: () => transformES2016,
- transformES2017: () => transformES2017,
- transformES2018: () => transformES2018,
- transformES2019: () => transformES2019,
- transformES2020: () => transformES2020,
- transformES2021: () => transformES2021,
- transformES5: () => transformES5,
- transformESDecorators: () => transformESDecorators,
- transformESNext: () => transformESNext,
- transformGenerators: () => transformGenerators,
- transformJsx: () => transformJsx,
- transformLegacyDecorators: () => transformLegacyDecorators,
- transformModule: () => transformModule,
- transformNodeModule: () => transformNodeModule,
- transformNodes: () => transformNodes,
- transformSystemModule: () => transformSystemModule,
- transformTypeScript: () => transformTypeScript,
- transpile: () => transpile,
- transpileModule: () => transpileModule,
- transpileOptionValueCompilerOptions: () => transpileOptionValueCompilerOptions,
- trimString: () => trimString,
- trimStringEnd: () => trimStringEnd,
- trimStringStart: () => trimStringStart,
- tryAddToSet: () => tryAddToSet,
- tryAndIgnoreErrors: () => tryAndIgnoreErrors,
- tryCast: () => tryCast,
- tryDirectoryExists: () => tryDirectoryExists,
- tryExtractTSExtension: () => tryExtractTSExtension,
- tryFileExists: () => tryFileExists,
- tryGetClassExtendingExpressionWithTypeArguments: () => tryGetClassExtendingExpressionWithTypeArguments,
- tryGetClassImplementingOrExtendingExpressionWithTypeArguments: () => tryGetClassImplementingOrExtendingExpressionWithTypeArguments,
- tryGetDirectories: () => tryGetDirectories,
- tryGetExtensionFromPath: () => tryGetExtensionFromPath2,
- tryGetImportFromModuleSpecifier: () => tryGetImportFromModuleSpecifier,
- tryGetJSDocSatisfiesTypeNode: () => tryGetJSDocSatisfiesTypeNode,
- tryGetModuleNameFromFile: () => tryGetModuleNameFromFile,
- tryGetModuleSpecifierFromDeclaration: () => tryGetModuleSpecifierFromDeclaration,
- tryGetNativePerformanceHooks: () => tryGetNativePerformanceHooks,
- tryGetPropertyAccessOrIdentifierToString: () => tryGetPropertyAccessOrIdentifierToString,
- tryGetPropertyNameOfBindingOrAssignmentElement: () => tryGetPropertyNameOfBindingOrAssignmentElement,
- tryGetSourceMappingURL: () => tryGetSourceMappingURL,
- tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
- tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
- tryParsePattern: () => tryParsePattern,
- tryParsePatterns: () => tryParsePatterns,
- tryParseRawSourceMap: () => tryParseRawSourceMap,
- tryReadDirectory: () => tryReadDirectory,
- tryReadFile: () => tryReadFile,
- tryRemoveDirectoryPrefix: () => tryRemoveDirectoryPrefix,
- tryRemoveExtension: () => tryRemoveExtension,
- tryRemovePrefix: () => tryRemovePrefix,
- tryRemoveSuffix: () => tryRemoveSuffix,
- typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
- typeAliasNamePart: () => typeAliasNamePart,
- typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
- typeKeywords: () => typeKeywords,
- typeParameterNamePart: () => typeParameterNamePart,
- typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
- typeToDisplayParts: () => typeToDisplayParts,
- unchangedPollThresholds: () => unchangedPollThresholds,
- unchangedTextChangeRange: () => unchangedTextChangeRange,
- unescapeLeadingUnderscores: () => unescapeLeadingUnderscores,
- unmangleScopedPackageName: () => unmangleScopedPackageName,
- unorderedRemoveItem: () => unorderedRemoveItem,
- unorderedRemoveItemAt: () => unorderedRemoveItemAt,
- unreachableCodeIsError: () => unreachableCodeIsError,
- unusedLabelIsError: () => unusedLabelIsError,
- unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
- updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
- updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
- updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
- updatePackageJsonWatch: () => updatePackageJsonWatch,
- updateResolutionField: () => updateResolutionField,
- updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
- updateSourceFile: () => updateSourceFile,
- updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories,
- usesExtensionsOnImports: () => usesExtensionsOnImports,
- usingSingleLineStringWriter: () => usingSingleLineStringWriter,
- utf16EncodeAsString: () => utf16EncodeAsString,
- validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage,
- valuesHelper: () => valuesHelper,
- version: () => version,
- versionMajorMinor: () => versionMajorMinor,
- visitArray: () => visitArray,
- visitCommaListElements: () => visitCommaListElements,
- visitEachChild: () => visitEachChild,
- visitFunctionBody: () => visitFunctionBody,
- visitIterationBody: () => visitIterationBody,
- visitLexicalEnvironment: () => visitLexicalEnvironment,
- visitNode: () => visitNode,
- visitNodes: () => visitNodes2,
- visitParameterList: () => visitParameterList,
- walkUpBindingElementsAndPatterns: () => walkUpBindingElementsAndPatterns,
- walkUpLexicalEnvironments: () => walkUpLexicalEnvironments,
- walkUpOuterExpressions: () => walkUpOuterExpressions,
- walkUpParenthesizedExpressions: () => walkUpParenthesizedExpressions,
- walkUpParenthesizedTypes: () => walkUpParenthesizedTypes,
- walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
- whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
- writeCommentRange: () => writeCommentRange,
- writeFile: () => writeFile,
- writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
- zipToModeAwareCache: () => zipToModeAwareCache,
- zipWith: () => zipWith
-});
-
-// src/services/types.ts
-var ScriptSnapshot;
-((ScriptSnapshot2) => {
- class StringScriptSnapshot {
- constructor(text) {
- this.text = text;
- }
- getText(start2, end) {
- return start2 === 0 && end === this.text.length ? this.text : this.text.substring(start2, end);
- }
- getLength() {
- return this.text.length;
- }
- getChangeRange() {
- return void 0;
- }
- }
- function fromString(text) {
- return new StringScriptSnapshot(text);
- }
- ScriptSnapshot2.fromString = fromString;
-})(ScriptSnapshot || (ScriptSnapshot = {}));
-var PackageJsonDependencyGroup = /* @__PURE__ */ ((PackageJsonDependencyGroup2) => {
- PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["Dependencies"] = 1] = "Dependencies";
- PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["DevDependencies"] = 2] = "DevDependencies";
- PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["PeerDependencies"] = 4] = "PeerDependencies";
- PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["OptionalDependencies"] = 8] = "OptionalDependencies";
- PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["All"] = 15] = "All";
- return PackageJsonDependencyGroup2;
-})(PackageJsonDependencyGroup || {});
-var PackageJsonAutoImportPreference = /* @__PURE__ */ ((PackageJsonAutoImportPreference2) => {
- PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["Off"] = 0] = "Off";
- PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["On"] = 1] = "On";
- PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["Auto"] = 2] = "Auto";
- return PackageJsonAutoImportPreference2;
-})(PackageJsonAutoImportPreference || {});
-var LanguageServiceMode = /* @__PURE__ */ ((LanguageServiceMode2) => {
- LanguageServiceMode2[LanguageServiceMode2["Semantic"] = 0] = "Semantic";
- LanguageServiceMode2[LanguageServiceMode2["PartialSemantic"] = 1] = "PartialSemantic";
- LanguageServiceMode2[LanguageServiceMode2["Syntactic"] = 2] = "Syntactic";
- return LanguageServiceMode2;
-})(LanguageServiceMode || {});
-var emptyOptions = {};
-var SemanticClassificationFormat = /* @__PURE__ */ ((SemanticClassificationFormat3) => {
- SemanticClassificationFormat3["Original"] = "original";
- SemanticClassificationFormat3["TwentyTwenty"] = "2020";
- return SemanticClassificationFormat3;
-})(SemanticClassificationFormat || {});
-var OrganizeImportsMode = /* @__PURE__ */ ((OrganizeImportsMode3) => {
- OrganizeImportsMode3["All"] = "All";
- OrganizeImportsMode3["SortAndCombine"] = "SortAndCombine";
- OrganizeImportsMode3["RemoveUnused"] = "RemoveUnused";
- return OrganizeImportsMode3;
-})(OrganizeImportsMode || {});
-var CompletionTriggerKind = /* @__PURE__ */ ((CompletionTriggerKind4) => {
- CompletionTriggerKind4[CompletionTriggerKind4["Invoked"] = 1] = "Invoked";
- CompletionTriggerKind4[CompletionTriggerKind4["TriggerCharacter"] = 2] = "TriggerCharacter";
- CompletionTriggerKind4[CompletionTriggerKind4["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
- return CompletionTriggerKind4;
-})(CompletionTriggerKind || {});
-var InlayHintKind = /* @__PURE__ */ ((InlayHintKind2) => {
- InlayHintKind2["Type"] = "Type";
- InlayHintKind2["Parameter"] = "Parameter";
- InlayHintKind2["Enum"] = "Enum";
- return InlayHintKind2;
-})(InlayHintKind || {});
-var HighlightSpanKind = /* @__PURE__ */ ((HighlightSpanKind2) => {
- HighlightSpanKind2["none"] = "none";
- HighlightSpanKind2["definition"] = "definition";
- HighlightSpanKind2["reference"] = "reference";
- HighlightSpanKind2["writtenReference"] = "writtenReference";
- return HighlightSpanKind2;
-})(HighlightSpanKind || {});
-var IndentStyle = /* @__PURE__ */ ((IndentStyle3) => {
- IndentStyle3[IndentStyle3["None"] = 0] = "None";
- IndentStyle3[IndentStyle3["Block"] = 1] = "Block";
- IndentStyle3[IndentStyle3["Smart"] = 2] = "Smart";
- return IndentStyle3;
-})(IndentStyle || {});
-var SemicolonPreference = /* @__PURE__ */ ((SemicolonPreference3) => {
- SemicolonPreference3["Ignore"] = "ignore";
- SemicolonPreference3["Insert"] = "insert";
- SemicolonPreference3["Remove"] = "remove";
- return SemicolonPreference3;
-})(SemicolonPreference || {});
-function getDefaultFormatCodeSettings(newLineCharacter) {
- return {
- indentSize: 4,
- tabSize: 4,
- newLineCharacter: newLineCharacter || "\n",
- convertTabsToSpaces: true,
- indentStyle: 2 /* Smart */,
- insertSpaceAfterConstructor: false,
- insertSpaceAfterCommaDelimiter: true,
- insertSpaceAfterSemicolonInForStatements: true,
- insertSpaceBeforeAndAfterBinaryOperators: true,
- insertSpaceAfterKeywordsInControlFlowStatements: true,
- insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
- insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
- insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
- insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
- insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
- insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
- insertSpaceBeforeFunctionParenthesis: false,
- placeOpenBraceOnNewLineForFunctions: false,
- placeOpenBraceOnNewLineForControlBlocks: false,
- semicolons: "ignore" /* Ignore */,
- trimTrailingWhitespace: true
- };
-}
-var testFormatSettings = getDefaultFormatCodeSettings("\n");
-var SymbolDisplayPartKind = /* @__PURE__ */ ((SymbolDisplayPartKind2) => {
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["aliasName"] = 0] = "aliasName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["className"] = 1] = "className";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["enumName"] = 2] = "enumName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["fieldName"] = 3] = "fieldName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["interfaceName"] = 4] = "interfaceName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["keyword"] = 5] = "keyword";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["lineBreak"] = 6] = "lineBreak";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["numericLiteral"] = 7] = "numericLiteral";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["stringLiteral"] = 8] = "stringLiteral";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["localName"] = 9] = "localName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["methodName"] = 10] = "methodName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["moduleName"] = 11] = "moduleName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["operator"] = 12] = "operator";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["parameterName"] = 13] = "parameterName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["propertyName"] = 14] = "propertyName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["punctuation"] = 15] = "punctuation";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["space"] = 16] = "space";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["text"] = 17] = "text";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["typeParameterName"] = 18] = "typeParameterName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["enumMemberName"] = 19] = "enumMemberName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["functionName"] = 20] = "functionName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["regularExpressionLiteral"] = 21] = "regularExpressionLiteral";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["link"] = 22] = "link";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["linkName"] = 23] = "linkName";
- SymbolDisplayPartKind2[SymbolDisplayPartKind2["linkText"] = 24] = "linkText";
- return SymbolDisplayPartKind2;
-})(SymbolDisplayPartKind || {});
-var CompletionInfoFlags = /* @__PURE__ */ ((CompletionInfoFlags2) => {
- CompletionInfoFlags2[CompletionInfoFlags2["None"] = 0] = "None";
- CompletionInfoFlags2[CompletionInfoFlags2["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports";
- CompletionInfoFlags2[CompletionInfoFlags2["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion";
- CompletionInfoFlags2[CompletionInfoFlags2["IsContinuation"] = 4] = "IsContinuation";
- CompletionInfoFlags2[CompletionInfoFlags2["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers";
- CompletionInfoFlags2[CompletionInfoFlags2["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit";
- CompletionInfoFlags2[CompletionInfoFlags2["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets";
- return CompletionInfoFlags2;
-})(CompletionInfoFlags || {});
-var OutliningSpanKind = /* @__PURE__ */ ((OutliningSpanKind2) => {
- OutliningSpanKind2["Comment"] = "comment";
- OutliningSpanKind2["Region"] = "region";
- OutliningSpanKind2["Code"] = "code";
- OutliningSpanKind2["Imports"] = "imports";
- return OutliningSpanKind2;
-})(OutliningSpanKind || {});
-var OutputFileType = /* @__PURE__ */ ((OutputFileType2) => {
- OutputFileType2[OutputFileType2["JavaScript"] = 0] = "JavaScript";
- OutputFileType2[OutputFileType2["SourceMap"] = 1] = "SourceMap";
- OutputFileType2[OutputFileType2["Declaration"] = 2] = "Declaration";
- return OutputFileType2;
-})(OutputFileType || {});
-var EndOfLineState = /* @__PURE__ */ ((EndOfLineState3) => {
- EndOfLineState3[EndOfLineState3["None"] = 0] = "None";
- EndOfLineState3[EndOfLineState3["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia";
- EndOfLineState3[EndOfLineState3["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral";
- EndOfLineState3[EndOfLineState3["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral";
- EndOfLineState3[EndOfLineState3["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate";
- EndOfLineState3[EndOfLineState3["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail";
- EndOfLineState3[EndOfLineState3["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition";
- return EndOfLineState3;
-})(EndOfLineState || {});
-var TokenClass = /* @__PURE__ */ ((TokenClass2) => {
- TokenClass2[TokenClass2["Punctuation"] = 0] = "Punctuation";
- TokenClass2[TokenClass2["Keyword"] = 1] = "Keyword";
- TokenClass2[TokenClass2["Operator"] = 2] = "Operator";
- TokenClass2[TokenClass2["Comment"] = 3] = "Comment";
- TokenClass2[TokenClass2["Whitespace"] = 4] = "Whitespace";
- TokenClass2[TokenClass2["Identifier"] = 5] = "Identifier";
- TokenClass2[TokenClass2["NumberLiteral"] = 6] = "NumberLiteral";
- TokenClass2[TokenClass2["BigIntLiteral"] = 7] = "BigIntLiteral";
- TokenClass2[TokenClass2["StringLiteral"] = 8] = "StringLiteral";
- TokenClass2[TokenClass2["RegExpLiteral"] = 9] = "RegExpLiteral";
- return TokenClass2;
-})(TokenClass || {});
-var ScriptElementKind = /* @__PURE__ */ ((ScriptElementKind2) => {
- ScriptElementKind2["unknown"] = "";
- ScriptElementKind2["warning"] = "warning";
- ScriptElementKind2["keyword"] = "keyword";
- ScriptElementKind2["scriptElement"] = "script";
- ScriptElementKind2["moduleElement"] = "module";
- ScriptElementKind2["classElement"] = "class";
- ScriptElementKind2["localClassElement"] = "local class";
- ScriptElementKind2["interfaceElement"] = "interface";
- ScriptElementKind2["typeElement"] = "type";
- ScriptElementKind2["enumElement"] = "enum";
- ScriptElementKind2["enumMemberElement"] = "enum member";
- ScriptElementKind2["variableElement"] = "var";
- ScriptElementKind2["localVariableElement"] = "local var";
- ScriptElementKind2["functionElement"] = "function";
- ScriptElementKind2["localFunctionElement"] = "local function";
- ScriptElementKind2["memberFunctionElement"] = "method";
- ScriptElementKind2["memberGetAccessorElement"] = "getter";
- ScriptElementKind2["memberSetAccessorElement"] = "setter";
- ScriptElementKind2["memberVariableElement"] = "property";
- ScriptElementKind2["memberAccessorVariableElement"] = "accessor";
- ScriptElementKind2["constructorImplementationElement"] = "constructor";
- ScriptElementKind2["callSignatureElement"] = "call";
- ScriptElementKind2["indexSignatureElement"] = "index";
- ScriptElementKind2["constructSignatureElement"] = "construct";
- ScriptElementKind2["parameterElement"] = "parameter";
- ScriptElementKind2["typeParameterElement"] = "type parameter";
- ScriptElementKind2["primitiveType"] = "primitive type";
- ScriptElementKind2["label"] = "label";
- ScriptElementKind2["alias"] = "alias";
- ScriptElementKind2["constElement"] = "const";
- ScriptElementKind2["letElement"] = "let";
- ScriptElementKind2["directory"] = "directory";
- ScriptElementKind2["externalModuleName"] = "external module name";
- ScriptElementKind2["jsxAttribute"] = "JSX attribute";
- ScriptElementKind2["string"] = "string";
- ScriptElementKind2["link"] = "link";
- ScriptElementKind2["linkName"] = "link name";
- ScriptElementKind2["linkText"] = "link text";
- return ScriptElementKind2;
-})(ScriptElementKind || {});
-var ScriptElementKindModifier = /* @__PURE__ */ ((ScriptElementKindModifier2) => {
- ScriptElementKindModifier2["none"] = "";
- ScriptElementKindModifier2["publicMemberModifier"] = "public";
- ScriptElementKindModifier2["privateMemberModifier"] = "private";
- ScriptElementKindModifier2["protectedMemberModifier"] = "protected";
- ScriptElementKindModifier2["exportedModifier"] = "export";
- ScriptElementKindModifier2["ambientModifier"] = "declare";
- ScriptElementKindModifier2["staticModifier"] = "static";
- ScriptElementKindModifier2["abstractModifier"] = "abstract";
- ScriptElementKindModifier2["optionalModifier"] = "optional";
- ScriptElementKindModifier2["deprecatedModifier"] = "deprecated";
- ScriptElementKindModifier2["dtsModifier"] = ".d.ts";
- ScriptElementKindModifier2["tsModifier"] = ".ts";
- ScriptElementKindModifier2["tsxModifier"] = ".tsx";
- ScriptElementKindModifier2["jsModifier"] = ".js";
- ScriptElementKindModifier2["jsxModifier"] = ".jsx";
- ScriptElementKindModifier2["jsonModifier"] = ".json";
- ScriptElementKindModifier2["dmtsModifier"] = ".d.mts";
- ScriptElementKindModifier2["mtsModifier"] = ".mts";
- ScriptElementKindModifier2["mjsModifier"] = ".mjs";
- ScriptElementKindModifier2["dctsModifier"] = ".d.cts";
- ScriptElementKindModifier2["ctsModifier"] = ".cts";
- ScriptElementKindModifier2["cjsModifier"] = ".cjs";
- return ScriptElementKindModifier2;
-})(ScriptElementKindModifier || {});
-var ClassificationTypeNames = /* @__PURE__ */ ((ClassificationTypeNames2) => {
- ClassificationTypeNames2["comment"] = "comment";
- ClassificationTypeNames2["identifier"] = "identifier";
- ClassificationTypeNames2["keyword"] = "keyword";
- ClassificationTypeNames2["numericLiteral"] = "number";
- ClassificationTypeNames2["bigintLiteral"] = "bigint";
- ClassificationTypeNames2["operator"] = "operator";
- ClassificationTypeNames2["stringLiteral"] = "string";
- ClassificationTypeNames2["whiteSpace"] = "whitespace";
- ClassificationTypeNames2["text"] = "text";
- ClassificationTypeNames2["punctuation"] = "punctuation";
- ClassificationTypeNames2["className"] = "class name";
- ClassificationTypeNames2["enumName"] = "enum name";
- ClassificationTypeNames2["interfaceName"] = "interface name";
- ClassificationTypeNames2["moduleName"] = "module name";
- ClassificationTypeNames2["typeParameterName"] = "type parameter name";
- ClassificationTypeNames2["typeAliasName"] = "type alias name";
- ClassificationTypeNames2["parameterName"] = "parameter name";
- ClassificationTypeNames2["docCommentTagName"] = "doc comment tag name";
- ClassificationTypeNames2["jsxOpenTagName"] = "jsx open tag name";
- ClassificationTypeNames2["jsxCloseTagName"] = "jsx close tag name";
- ClassificationTypeNames2["jsxSelfClosingTagName"] = "jsx self closing tag name";
- ClassificationTypeNames2["jsxAttribute"] = "jsx attribute";
- ClassificationTypeNames2["jsxText"] = "jsx text";
- ClassificationTypeNames2["jsxAttributeStringLiteralValue"] = "jsx attribute string literal value";
- return ClassificationTypeNames2;
-})(ClassificationTypeNames || {});
-var ClassificationType = /* @__PURE__ */ ((ClassificationType3) => {
- ClassificationType3[ClassificationType3["comment"] = 1] = "comment";
- ClassificationType3[ClassificationType3["identifier"] = 2] = "identifier";
- ClassificationType3[ClassificationType3["keyword"] = 3] = "keyword";
- ClassificationType3[ClassificationType3["numericLiteral"] = 4] = "numericLiteral";
- ClassificationType3[ClassificationType3["operator"] = 5] = "operator";
- ClassificationType3[ClassificationType3["stringLiteral"] = 6] = "stringLiteral";
- ClassificationType3[ClassificationType3["regularExpressionLiteral"] = 7] = "regularExpressionLiteral";
- ClassificationType3[ClassificationType3["whiteSpace"] = 8] = "whiteSpace";
- ClassificationType3[ClassificationType3["text"] = 9] = "text";
- ClassificationType3[ClassificationType3["punctuation"] = 10] = "punctuation";
- ClassificationType3[ClassificationType3["className"] = 11] = "className";
- ClassificationType3[ClassificationType3["enumName"] = 12] = "enumName";
- ClassificationType3[ClassificationType3["interfaceName"] = 13] = "interfaceName";
- ClassificationType3[ClassificationType3["moduleName"] = 14] = "moduleName";
- ClassificationType3[ClassificationType3["typeParameterName"] = 15] = "typeParameterName";
- ClassificationType3[ClassificationType3["typeAliasName"] = 16] = "typeAliasName";
- ClassificationType3[ClassificationType3["parameterName"] = 17] = "parameterName";
- ClassificationType3[ClassificationType3["docCommentTagName"] = 18] = "docCommentTagName";
- ClassificationType3[ClassificationType3["jsxOpenTagName"] = 19] = "jsxOpenTagName";
- ClassificationType3[ClassificationType3["jsxCloseTagName"] = 20] = "jsxCloseTagName";
- ClassificationType3[ClassificationType3["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName";
- ClassificationType3[ClassificationType3["jsxAttribute"] = 22] = "jsxAttribute";
- ClassificationType3[ClassificationType3["jsxText"] = 23] = "jsxText";
- ClassificationType3[ClassificationType3["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue";
- ClassificationType3[ClassificationType3["bigintLiteral"] = 25] = "bigintLiteral";
- return ClassificationType3;
-})(ClassificationType || {});
+// src/services/types.ts
+var ScriptSnapshot;
+((ScriptSnapshot2) => {
+ class StringScriptSnapshot {
+ constructor(text) {
+ this.text = text;
+ }
+ getText(start2, end) {
+ return start2 === 0 && end === this.text.length ? this.text : this.text.substring(start2, end);
+ }
+ getLength() {
+ return this.text.length;
+ }
+ getChangeRange() {
+ return void 0;
+ }
+ }
+ function fromString(text) {
+ return new StringScriptSnapshot(text);
+ }
+ ScriptSnapshot2.fromString = fromString;
+})(ScriptSnapshot || (ScriptSnapshot = {}));
+var PackageJsonDependencyGroup = /* @__PURE__ */ ((PackageJsonDependencyGroup2) => {
+ PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["Dependencies"] = 1] = "Dependencies";
+ PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["DevDependencies"] = 2] = "DevDependencies";
+ PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["PeerDependencies"] = 4] = "PeerDependencies";
+ PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["OptionalDependencies"] = 8] = "OptionalDependencies";
+ PackageJsonDependencyGroup2[PackageJsonDependencyGroup2["All"] = 15] = "All";
+ return PackageJsonDependencyGroup2;
+})(PackageJsonDependencyGroup || {});
+var PackageJsonAutoImportPreference = /* @__PURE__ */ ((PackageJsonAutoImportPreference2) => {
+ PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["Off"] = 0] = "Off";
+ PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["On"] = 1] = "On";
+ PackageJsonAutoImportPreference2[PackageJsonAutoImportPreference2["Auto"] = 2] = "Auto";
+ return PackageJsonAutoImportPreference2;
+})(PackageJsonAutoImportPreference || {});
+var LanguageServiceMode = /* @__PURE__ */ ((LanguageServiceMode2) => {
+ LanguageServiceMode2[LanguageServiceMode2["Semantic"] = 0] = "Semantic";
+ LanguageServiceMode2[LanguageServiceMode2["PartialSemantic"] = 1] = "PartialSemantic";
+ LanguageServiceMode2[LanguageServiceMode2["Syntactic"] = 2] = "Syntactic";
+ return LanguageServiceMode2;
+})(LanguageServiceMode || {});
+var emptyOptions = {};
+var SemanticClassificationFormat = /* @__PURE__ */ ((SemanticClassificationFormat3) => {
+ SemanticClassificationFormat3["Original"] = "original";
+ SemanticClassificationFormat3["TwentyTwenty"] = "2020";
+ return SemanticClassificationFormat3;
+})(SemanticClassificationFormat || {});
+var OrganizeImportsMode = /* @__PURE__ */ ((OrganizeImportsMode3) => {
+ OrganizeImportsMode3["All"] = "All";
+ OrganizeImportsMode3["SortAndCombine"] = "SortAndCombine";
+ OrganizeImportsMode3["RemoveUnused"] = "RemoveUnused";
+ return OrganizeImportsMode3;
+})(OrganizeImportsMode || {});
+var CompletionTriggerKind = /* @__PURE__ */ ((CompletionTriggerKind4) => {
+ CompletionTriggerKind4[CompletionTriggerKind4["Invoked"] = 1] = "Invoked";
+ CompletionTriggerKind4[CompletionTriggerKind4["TriggerCharacter"] = 2] = "TriggerCharacter";
+ CompletionTriggerKind4[CompletionTriggerKind4["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
+ return CompletionTriggerKind4;
+})(CompletionTriggerKind || {});
+var InlayHintKind = /* @__PURE__ */ ((InlayHintKind2) => {
+ InlayHintKind2["Type"] = "Type";
+ InlayHintKind2["Parameter"] = "Parameter";
+ InlayHintKind2["Enum"] = "Enum";
+ return InlayHintKind2;
+})(InlayHintKind || {});
+var HighlightSpanKind = /* @__PURE__ */ ((HighlightSpanKind2) => {
+ HighlightSpanKind2["none"] = "none";
+ HighlightSpanKind2["definition"] = "definition";
+ HighlightSpanKind2["reference"] = "reference";
+ HighlightSpanKind2["writtenReference"] = "writtenReference";
+ return HighlightSpanKind2;
+})(HighlightSpanKind || {});
+var IndentStyle = /* @__PURE__ */ ((IndentStyle3) => {
+ IndentStyle3[IndentStyle3["None"] = 0] = "None";
+ IndentStyle3[IndentStyle3["Block"] = 1] = "Block";
+ IndentStyle3[IndentStyle3["Smart"] = 2] = "Smart";
+ return IndentStyle3;
+})(IndentStyle || {});
+var SemicolonPreference = /* @__PURE__ */ ((SemicolonPreference3) => {
+ SemicolonPreference3["Ignore"] = "ignore";
+ SemicolonPreference3["Insert"] = "insert";
+ SemicolonPreference3["Remove"] = "remove";
+ return SemicolonPreference3;
+})(SemicolonPreference || {});
+function getDefaultFormatCodeSettings(newLineCharacter) {
+ return {
+ indentSize: 4,
+ tabSize: 4,
+ newLineCharacter: newLineCharacter || "\n",
+ convertTabsToSpaces: true,
+ indentStyle: 2 /* Smart */,
+ insertSpaceAfterConstructor: false,
+ insertSpaceAfterCommaDelimiter: true,
+ insertSpaceAfterSemicolonInForStatements: true,
+ insertSpaceBeforeAndAfterBinaryOperators: true,
+ insertSpaceAfterKeywordsInControlFlowStatements: true,
+ insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
+ insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,
+ insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false,
+ insertSpaceBeforeFunctionParenthesis: false,
+ placeOpenBraceOnNewLineForFunctions: false,
+ placeOpenBraceOnNewLineForControlBlocks: false,
+ semicolons: "ignore" /* Ignore */,
+ trimTrailingWhitespace: true
+ };
+}
+var testFormatSettings = getDefaultFormatCodeSettings("\n");
+var SymbolDisplayPartKind = /* @__PURE__ */ ((SymbolDisplayPartKind2) => {
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["aliasName"] = 0] = "aliasName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["className"] = 1] = "className";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["enumName"] = 2] = "enumName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["fieldName"] = 3] = "fieldName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["interfaceName"] = 4] = "interfaceName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["keyword"] = 5] = "keyword";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["lineBreak"] = 6] = "lineBreak";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["numericLiteral"] = 7] = "numericLiteral";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["stringLiteral"] = 8] = "stringLiteral";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["localName"] = 9] = "localName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["methodName"] = 10] = "methodName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["moduleName"] = 11] = "moduleName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["operator"] = 12] = "operator";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["parameterName"] = 13] = "parameterName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["propertyName"] = 14] = "propertyName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["punctuation"] = 15] = "punctuation";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["space"] = 16] = "space";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["text"] = 17] = "text";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["typeParameterName"] = 18] = "typeParameterName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["enumMemberName"] = 19] = "enumMemberName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["functionName"] = 20] = "functionName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["regularExpressionLiteral"] = 21] = "regularExpressionLiteral";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["link"] = 22] = "link";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["linkName"] = 23] = "linkName";
+ SymbolDisplayPartKind2[SymbolDisplayPartKind2["linkText"] = 24] = "linkText";
+ return SymbolDisplayPartKind2;
+})(SymbolDisplayPartKind || {});
+var CompletionInfoFlags = /* @__PURE__ */ ((CompletionInfoFlags2) => {
+ CompletionInfoFlags2[CompletionInfoFlags2["None"] = 0] = "None";
+ CompletionInfoFlags2[CompletionInfoFlags2["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports";
+ CompletionInfoFlags2[CompletionInfoFlags2["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion";
+ CompletionInfoFlags2[CompletionInfoFlags2["IsContinuation"] = 4] = "IsContinuation";
+ CompletionInfoFlags2[CompletionInfoFlags2["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers";
+ CompletionInfoFlags2[CompletionInfoFlags2["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit";
+ CompletionInfoFlags2[CompletionInfoFlags2["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets";
+ return CompletionInfoFlags2;
+})(CompletionInfoFlags || {});
+var OutliningSpanKind = /* @__PURE__ */ ((OutliningSpanKind2) => {
+ OutliningSpanKind2["Comment"] = "comment";
+ OutliningSpanKind2["Region"] = "region";
+ OutliningSpanKind2["Code"] = "code";
+ OutliningSpanKind2["Imports"] = "imports";
+ return OutliningSpanKind2;
+})(OutliningSpanKind || {});
+var OutputFileType = /* @__PURE__ */ ((OutputFileType2) => {
+ OutputFileType2[OutputFileType2["JavaScript"] = 0] = "JavaScript";
+ OutputFileType2[OutputFileType2["SourceMap"] = 1] = "SourceMap";
+ OutputFileType2[OutputFileType2["Declaration"] = 2] = "Declaration";
+ return OutputFileType2;
+})(OutputFileType || {});
+var EndOfLineState = /* @__PURE__ */ ((EndOfLineState3) => {
+ EndOfLineState3[EndOfLineState3["None"] = 0] = "None";
+ EndOfLineState3[EndOfLineState3["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia";
+ EndOfLineState3[EndOfLineState3["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral";
+ EndOfLineState3[EndOfLineState3["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral";
+ EndOfLineState3[EndOfLineState3["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate";
+ EndOfLineState3[EndOfLineState3["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail";
+ EndOfLineState3[EndOfLineState3["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition";
+ return EndOfLineState3;
+})(EndOfLineState || {});
+var TokenClass = /* @__PURE__ */ ((TokenClass2) => {
+ TokenClass2[TokenClass2["Punctuation"] = 0] = "Punctuation";
+ TokenClass2[TokenClass2["Keyword"] = 1] = "Keyword";
+ TokenClass2[TokenClass2["Operator"] = 2] = "Operator";
+ TokenClass2[TokenClass2["Comment"] = 3] = "Comment";
+ TokenClass2[TokenClass2["Whitespace"] = 4] = "Whitespace";
+ TokenClass2[TokenClass2["Identifier"] = 5] = "Identifier";
+ TokenClass2[TokenClass2["NumberLiteral"] = 6] = "NumberLiteral";
+ TokenClass2[TokenClass2["BigIntLiteral"] = 7] = "BigIntLiteral";
+ TokenClass2[TokenClass2["StringLiteral"] = 8] = "StringLiteral";
+ TokenClass2[TokenClass2["RegExpLiteral"] = 9] = "RegExpLiteral";
+ return TokenClass2;
+})(TokenClass || {});
+var ScriptElementKind = /* @__PURE__ */ ((ScriptElementKind2) => {
+ ScriptElementKind2["unknown"] = "";
+ ScriptElementKind2["warning"] = "warning";
+ ScriptElementKind2["keyword"] = "keyword";
+ ScriptElementKind2["scriptElement"] = "script";
+ ScriptElementKind2["moduleElement"] = "module";
+ ScriptElementKind2["classElement"] = "class";
+ ScriptElementKind2["localClassElement"] = "local class";
+ ScriptElementKind2["interfaceElement"] = "interface";
+ ScriptElementKind2["typeElement"] = "type";
+ ScriptElementKind2["enumElement"] = "enum";
+ ScriptElementKind2["enumMemberElement"] = "enum member";
+ ScriptElementKind2["variableElement"] = "var";
+ ScriptElementKind2["localVariableElement"] = "local var";
+ ScriptElementKind2["functionElement"] = "function";
+ ScriptElementKind2["localFunctionElement"] = "local function";
+ ScriptElementKind2["memberFunctionElement"] = "method";
+ ScriptElementKind2["memberGetAccessorElement"] = "getter";
+ ScriptElementKind2["memberSetAccessorElement"] = "setter";
+ ScriptElementKind2["memberVariableElement"] = "property";
+ ScriptElementKind2["memberAccessorVariableElement"] = "accessor";
+ ScriptElementKind2["constructorImplementationElement"] = "constructor";
+ ScriptElementKind2["callSignatureElement"] = "call";
+ ScriptElementKind2["indexSignatureElement"] = "index";
+ ScriptElementKind2["constructSignatureElement"] = "construct";
+ ScriptElementKind2["parameterElement"] = "parameter";
+ ScriptElementKind2["typeParameterElement"] = "type parameter";
+ ScriptElementKind2["primitiveType"] = "primitive type";
+ ScriptElementKind2["label"] = "label";
+ ScriptElementKind2["alias"] = "alias";
+ ScriptElementKind2["constElement"] = "const";
+ ScriptElementKind2["letElement"] = "let";
+ ScriptElementKind2["directory"] = "directory";
+ ScriptElementKind2["externalModuleName"] = "external module name";
+ ScriptElementKind2["jsxAttribute"] = "JSX attribute";
+ ScriptElementKind2["string"] = "string";
+ ScriptElementKind2["link"] = "link";
+ ScriptElementKind2["linkName"] = "link name";
+ ScriptElementKind2["linkText"] = "link text";
+ return ScriptElementKind2;
+})(ScriptElementKind || {});
+var ScriptElementKindModifier = /* @__PURE__ */ ((ScriptElementKindModifier2) => {
+ ScriptElementKindModifier2["none"] = "";
+ ScriptElementKindModifier2["publicMemberModifier"] = "public";
+ ScriptElementKindModifier2["privateMemberModifier"] = "private";
+ ScriptElementKindModifier2["protectedMemberModifier"] = "protected";
+ ScriptElementKindModifier2["exportedModifier"] = "export";
+ ScriptElementKindModifier2["ambientModifier"] = "declare";
+ ScriptElementKindModifier2["staticModifier"] = "static";
+ ScriptElementKindModifier2["abstractModifier"] = "abstract";
+ ScriptElementKindModifier2["optionalModifier"] = "optional";
+ ScriptElementKindModifier2["deprecatedModifier"] = "deprecated";
+ ScriptElementKindModifier2["dtsModifier"] = ".d.ts";
+ ScriptElementKindModifier2["tsModifier"] = ".ts";
+ ScriptElementKindModifier2["tsxModifier"] = ".tsx";
+ ScriptElementKindModifier2["jsModifier"] = ".js";
+ ScriptElementKindModifier2["jsxModifier"] = ".jsx";
+ ScriptElementKindModifier2["jsonModifier"] = ".json";
+ ScriptElementKindModifier2["dmtsModifier"] = ".d.mts";
+ ScriptElementKindModifier2["mtsModifier"] = ".mts";
+ ScriptElementKindModifier2["mjsModifier"] = ".mjs";
+ ScriptElementKindModifier2["dctsModifier"] = ".d.cts";
+ ScriptElementKindModifier2["ctsModifier"] = ".cts";
+ ScriptElementKindModifier2["cjsModifier"] = ".cjs";
+ return ScriptElementKindModifier2;
+})(ScriptElementKindModifier || {});
+var ClassificationTypeNames = /* @__PURE__ */ ((ClassificationTypeNames2) => {
+ ClassificationTypeNames2["comment"] = "comment";
+ ClassificationTypeNames2["identifier"] = "identifier";
+ ClassificationTypeNames2["keyword"] = "keyword";
+ ClassificationTypeNames2["numericLiteral"] = "number";
+ ClassificationTypeNames2["bigintLiteral"] = "bigint";
+ ClassificationTypeNames2["operator"] = "operator";
+ ClassificationTypeNames2["stringLiteral"] = "string";
+ ClassificationTypeNames2["whiteSpace"] = "whitespace";
+ ClassificationTypeNames2["text"] = "text";
+ ClassificationTypeNames2["punctuation"] = "punctuation";
+ ClassificationTypeNames2["className"] = "class name";
+ ClassificationTypeNames2["enumName"] = "enum name";
+ ClassificationTypeNames2["interfaceName"] = "interface name";
+ ClassificationTypeNames2["moduleName"] = "module name";
+ ClassificationTypeNames2["typeParameterName"] = "type parameter name";
+ ClassificationTypeNames2["typeAliasName"] = "type alias name";
+ ClassificationTypeNames2["parameterName"] = "parameter name";
+ ClassificationTypeNames2["docCommentTagName"] = "doc comment tag name";
+ ClassificationTypeNames2["jsxOpenTagName"] = "jsx open tag name";
+ ClassificationTypeNames2["jsxCloseTagName"] = "jsx close tag name";
+ ClassificationTypeNames2["jsxSelfClosingTagName"] = "jsx self closing tag name";
+ ClassificationTypeNames2["jsxAttribute"] = "jsx attribute";
+ ClassificationTypeNames2["jsxText"] = "jsx text";
+ ClassificationTypeNames2["jsxAttributeStringLiteralValue"] = "jsx attribute string literal value";
+ return ClassificationTypeNames2;
+})(ClassificationTypeNames || {});
+var ClassificationType = /* @__PURE__ */ ((ClassificationType3) => {
+ ClassificationType3[ClassificationType3["comment"] = 1] = "comment";
+ ClassificationType3[ClassificationType3["identifier"] = 2] = "identifier";
+ ClassificationType3[ClassificationType3["keyword"] = 3] = "keyword";
+ ClassificationType3[ClassificationType3["numericLiteral"] = 4] = "numericLiteral";
+ ClassificationType3[ClassificationType3["operator"] = 5] = "operator";
+ ClassificationType3[ClassificationType3["stringLiteral"] = 6] = "stringLiteral";
+ ClassificationType3[ClassificationType3["regularExpressionLiteral"] = 7] = "regularExpressionLiteral";
+ ClassificationType3[ClassificationType3["whiteSpace"] = 8] = "whiteSpace";
+ ClassificationType3[ClassificationType3["text"] = 9] = "text";
+ ClassificationType3[ClassificationType3["punctuation"] = 10] = "punctuation";
+ ClassificationType3[ClassificationType3["className"] = 11] = "className";
+ ClassificationType3[ClassificationType3["enumName"] = 12] = "enumName";
+ ClassificationType3[ClassificationType3["interfaceName"] = 13] = "interfaceName";
+ ClassificationType3[ClassificationType3["moduleName"] = 14] = "moduleName";
+ ClassificationType3[ClassificationType3["typeParameterName"] = 15] = "typeParameterName";
+ ClassificationType3[ClassificationType3["typeAliasName"] = 16] = "typeAliasName";
+ ClassificationType3[ClassificationType3["parameterName"] = 17] = "parameterName";
+ ClassificationType3[ClassificationType3["docCommentTagName"] = 18] = "docCommentTagName";
+ ClassificationType3[ClassificationType3["jsxOpenTagName"] = 19] = "jsxOpenTagName";
+ ClassificationType3[ClassificationType3["jsxCloseTagName"] = 20] = "jsxCloseTagName";
+ ClassificationType3[ClassificationType3["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName";
+ ClassificationType3[ClassificationType3["jsxAttribute"] = 22] = "jsxAttribute";
+ ClassificationType3[ClassificationType3["jsxText"] = 23] = "jsxText";
+ ClassificationType3[ClassificationType3["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue";
+ ClassificationType3[ClassificationType3["bigintLiteral"] = 25] = "bigintLiteral";
+ return ClassificationType3;
+})(ClassificationType || {});
// src/services/utilities.ts
var scanner = createScanner(
@@ -130372,6 +128773,13 @@ function isStringOrRegularExpressionOrTemplateLiteral(kind) {
}
return false;
}
+function isStringAndEmptyAnonymousObjectIntersection(type) {
+ if (!type.isIntersection()) {
+ return false;
+ }
+ const { types, checker } = type;
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
+}
function isPunctuation(kind) {
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
}
@@ -130557,7 +128965,7 @@ function getModuleSpecifierResolverHost(program, host) {
};
}
function moduleResolutionUsesNodeModules(moduleResolution) {
- return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */;
+ return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
}
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0;
@@ -130573,7 +128981,7 @@ function makeImport(defaultImport, namedImports, moduleSpecifier, quotePreferenc
);
}
function makeStringLiteral(text, quotePreference) {
- return factory.createStringLiteral(text, quotePreference === QuotePreference.Single);
+ return factory.createStringLiteral(text, quotePreference === 0 /* Single */);
}
var QuotePreference = /* @__PURE__ */ ((QuotePreference5) => {
QuotePreference5[QuotePreference5["Single"] = 0] = "Single";
@@ -131211,7 +129619,7 @@ function needsParentheses(expression) {
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
}
function getContextualTypeFromParent(node, checker, contextFlags) {
- const { parent: parent2 } = node;
+ const parent2 = walkUpParenthesizedExpressions(node.parent);
switch (parent2.kind) {
case 211 /* NewExpression */:
return checker.getContextualType(parent2, contextFlags);
@@ -131220,7 +129628,7 @@ function getContextualTypeFromParent(node, checker, contextFlags) {
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
}
case 292 /* CaseClause */:
- return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
+ return getSwitchedType(parent2, checker);
default:
return checker.getContextualType(node, contextFlags);
}
@@ -131489,7 +129897,13 @@ function createPackageJsonInfo(fileName, host) {
function createPackageJsonImportFilter(fromFile, preferences, host) {
const packageJsons = (host.getPackageJsonsVisibleToFile && host.getPackageJsonsVisibleToFile(fromFile.fileName) || getPackageJsonsVisibleToFile(fromFile.fileName, host)).filter((p) => p.parseable);
let usesNodeCoreModules;
- return { allowsImportingAmbientModule, allowsImportingSourceFile, allowsImportingSpecifier };
+ let ambientModuleCache;
+ let sourceFileCache;
+ return {
+ allowsImportingAmbientModule,
+ allowsImportingSourceFile,
+ allowsImportingSpecifier
+ };
function moduleSpecifierIsCoveredByPackageJson(specifier) {
const packageName = getNodeModuleRootSpecifier(specifier);
for (const packageJson of packageJsons) {
@@ -131503,26 +129917,49 @@ function createPackageJsonImportFilter(fromFile, preferences, host) {
if (!packageJsons.length || !moduleSymbol.valueDeclaration) {
return true;
}
- const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
- const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
- if (typeof declaringNodeModuleName === "undefined") {
- return true;
+ if (!ambientModuleCache) {
+ ambientModuleCache = /* @__PURE__ */ new Map();
+ } else {
+ const cached = ambientModuleCache.get(moduleSymbol);
+ if (cached !== void 0) {
+ return cached;
+ }
}
const declaredModuleSpecifier = stripQuotes(moduleSymbol.getName());
if (isAllowedCoreNodeModulesImport(declaredModuleSpecifier)) {
+ ambientModuleCache.set(moduleSymbol, true);
+ return true;
+ }
+ const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
+ const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
+ if (typeof declaringNodeModuleName === "undefined") {
+ ambientModuleCache.set(moduleSymbol, true);
return true;
}
- return moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
+ const result = moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
+ ambientModuleCache.set(moduleSymbol, result);
+ return result;
}
function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) {
if (!packageJsons.length) {
return true;
}
+ if (!sourceFileCache) {
+ sourceFileCache = /* @__PURE__ */ new Map();
+ } else {
+ const cached = sourceFileCache.get(sourceFile);
+ if (cached !== void 0) {
+ return cached;
+ }
+ }
const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
if (!moduleSpecifier) {
+ sourceFileCache.set(sourceFile, true);
return true;
}
- return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ const result = moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ sourceFileCache.set(sourceFile, result);
+ return result;
}
function allowsImportingSpecifier(moduleSpecifier) {
if (!packageJsons.length || isAllowedCoreNodeModulesImport(moduleSpecifier)) {
@@ -131670,10 +130107,13 @@ function needsNameFromDeclaration(symbol) {
return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
}
function getDefaultLikeExportNameFromDeclaration(symbol) {
- return firstDefined(symbol.declarations, (d) => {
- var _a2;
- return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : void 0;
- });
+ return firstDefined(
+ symbol.declarations,
+ (d) => {
+ var _a2, _b;
+ return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text;
+ }
+ );
}
function getSymbolParentOrFail(symbol) {
var _a2;
@@ -131742,6 +130182,64 @@ function jsxModeNeedsExplicitImport(jsx) {
function isSourceFileFromLibrary(program, node) {
return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
}
+function newCaseClauseTracker(checker, clauses) {
+ const existingStrings = /* @__PURE__ */ new Set();
+ const existingNumbers = /* @__PURE__ */ new Set();
+ const existingBigInts = /* @__PURE__ */ new Set();
+ for (const clause of clauses) {
+ if (!isDefaultClause(clause)) {
+ const expression = skipParentheses(clause.expression);
+ if (isLiteralExpression(expression)) {
+ switch (expression.kind) {
+ case 14 /* NoSubstitutionTemplateLiteral */:
+ case 10 /* StringLiteral */:
+ existingStrings.add(expression.text);
+ break;
+ case 8 /* NumericLiteral */:
+ existingNumbers.add(parseInt(expression.text));
+ break;
+ case 9 /* BigIntLiteral */:
+ const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
+ if (parsedBigInt) {
+ existingBigInts.add(pseudoBigIntToString(parsedBigInt));
+ }
+ break;
+ }
+ } else {
+ const symbol = checker.getSymbolAtLocation(clause.expression);
+ if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
+ const enumValue = checker.getConstantValue(symbol.valueDeclaration);
+ if (enumValue !== void 0) {
+ addValue(enumValue);
+ }
+ }
+ }
+ }
+ }
+ return {
+ addValue,
+ hasValue
+ };
+ function addValue(value) {
+ switch (typeof value) {
+ case "string":
+ existingStrings.add(value);
+ break;
+ case "number":
+ existingNumbers.add(value);
+ }
+ }
+ function hasValue(value) {
+ switch (typeof value) {
+ case "string":
+ return existingStrings.has(value);
+ case "number":
+ return existingNumbers.has(value);
+ case "object":
+ return existingBigInts.has(pseudoBigIntToString(value));
+ }
+ }
+}
// src/services/exportInfoMap.ts
var ImportKind = /* @__PURE__ */ ((ImportKind2) => {
@@ -131996,13 +130494,25 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
const autoImportProvider = useAutoImportProvider && ((_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host));
if (autoImportProvider) {
const start2 = timestamp();
- forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => cb(
- module2,
- file,
- autoImportProvider,
- /*isFromPackageJson*/
- true
- ));
+ const checker = program.getTypeChecker();
+ forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => {
+ if (file && !program.getSourceFile(file.fileName) || !file && !checker.resolveName(
+ module2.name,
+ /*location*/
+ void 0,
+ 1536 /* Module */,
+ /*excludeGlobals*/
+ false
+ )) {
+ cb(
+ module2,
+ file,
+ autoImportProvider,
+ /*isFromPackageJson*/
+ true
+ );
+ }
+ });
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp() - start2}`);
}
}
@@ -137069,7 +135579,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
options.triggerCharacter,
options.triggerKind,
cancellationToken,
- formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
+ formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
+ options.includeSymbol
);
}
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
@@ -142962,6 +141473,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
sourceFile,
symbol,
symbolName2,
+ moduleSymbol,
/*isJsxTagName*/
false,
program,
@@ -142973,7 +141485,6 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
const fix = getImportFixForSymbol(
sourceFile,
Debug.checkDefined(exportInfo),
- moduleSymbol,
program,
/*position*/
void 0,
@@ -142990,13 +141501,13 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
var _a2, _b;
const { fix, symbolName: symbolName2 } = info;
switch (fix.kind) {
- case ImportFixKind.UseNamespace:
+ case 0 /* UseNamespace */:
addToNamespace.push(fix);
break;
- case ImportFixKind.JsdocTypeImport:
+ case 1 /* JsdocTypeImport */:
importType.push(fix);
break;
- case ImportFixKind.AddToExisting: {
+ case 2 /* AddToExisting */: {
const { importClauseOrBindingPattern, importKind, addAsTypeOnly } = fix;
const key = String(getNodeId(importClauseOrBindingPattern));
let entry = addToExisting.get(key);
@@ -143015,7 +141526,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
}
break;
}
- case ImportFixKind.AddNew: {
+ case 3 /* AddNew */: {
const { moduleSpecifier, importKind, useRequire, addAsTypeOnly } = fix;
const entry = getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly);
Debug.assert(entry.useRequire === useRequire, "(Add new) Tried to add an `import` and a `require` for the same module");
@@ -143036,7 +141547,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
}
break;
}
- case ImportFixKind.PromoteTypeOnly:
+ case 4 /* PromoteTypeOnly */:
break;
default:
Debug.assertNever(fix, `fix wasn't never - got kind ${fix.kind}`);
@@ -143063,13 +141574,13 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
namespaceLikeImport: void 0,
useRequire
};
- if (importKind === 1 /* Default */ && addAsTypeOnly === AddAsTypeOnly.Required) {
+ if (importKind === 1 /* Default */ && addAsTypeOnly === 2 /* Required */) {
if (typeOnlyEntry)
return typeOnlyEntry;
newImports.set(typeOnlyKey, newEntry);
return newEntry;
}
- if (addAsTypeOnly === AddAsTypeOnly.Allowed && (typeOnlyEntry || nonTypeOnlyEntry)) {
+ if (addAsTypeOnly === 1 /* Allowed */ && (typeOnlyEntry || nonTypeOnlyEntry)) {
return typeOnlyEntry || nonTypeOnlyEntry;
}
if (nonTypeOnlyEntry) {
@@ -143110,7 +141621,8 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
quotePreference,
defaultImport,
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
- namespaceLikeImport
+ namespaceLikeImport,
+ compilerOptions
);
newDeclarations = combine(newDeclarations, declarations);
});
@@ -143151,27 +141663,19 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
return result && { ...result, computedWithoutCacheCount };
}
}
-var ImportFixKind = /* @__PURE__ */ ((ImportFixKind2) => {
- ImportFixKind2[ImportFixKind2["UseNamespace"] = 0] = "UseNamespace";
- ImportFixKind2[ImportFixKind2["JsdocTypeImport"] = 1] = "JsdocTypeImport";
- ImportFixKind2[ImportFixKind2["AddToExisting"] = 2] = "AddToExisting";
- ImportFixKind2[ImportFixKind2["AddNew"] = 3] = "AddNew";
- ImportFixKind2[ImportFixKind2["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
- return ImportFixKind2;
-})(ImportFixKind || {});
-var AddAsTypeOnly = /* @__PURE__ */ ((AddAsTypeOnly2) => {
- AddAsTypeOnly2[AddAsTypeOnly2["Allowed"] = 1] = "Allowed";
- AddAsTypeOnly2[AddAsTypeOnly2["Required"] = 2] = "Required";
- AddAsTypeOnly2[AddAsTypeOnly2["NotAllowed"] = 4] = "NotAllowed";
- return AddAsTypeOnly2;
-})(AddAsTypeOnly || {});
-function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
+function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
const compilerOptions = program.getCompilerOptions();
- const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, isJsxTagName, program, host, preferences, cancellationToken);
- Debug.assertIsDefined(exportInfos);
+ let exportInfos;
+ if (exportMapKey) {
+ exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
+ } else {
+ exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
+ }
const useRequire = shouldUseRequire(sourceFile, program);
const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
- const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
+ const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
return {
moduleSpecifier: fix.moduleSpecifier,
codeAction: codeFixActionToCodeAction(codeActionForFix(
@@ -143193,23 +141697,22 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
}
-function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
- Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
+function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
}
function codeFixActionToCodeAction({ description: description2, changes, commands }) {
return { description: description2, changes, commands };
}
-function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
+function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
const getChecker = createGetChecker(program, host);
return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
+ if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
return info;
}
});
}
-function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
+function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
var _a2, _b;
const compilerOptions = program.getCompilerOptions();
const mainProgramInfo = getInfoWithChecker(
@@ -143231,7 +141734,7 @@ function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
}
- const named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol);
+ const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
if (named && skipAlias(named, checker) === symbol) {
return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
}
@@ -143297,7 +141800,7 @@ function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, sym
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
return 2 /* Required */;
}
- if ((compilerOptions.isolatedModules && compilerOptions.preserveValueImports || compilerOptions.verbatimModuleSyntax) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
+ if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
return 2 /* Required */;
}
return 1 /* Allowed */;
@@ -143781,7 +142284,14 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
insertImports(
changes,
sourceFile,
- getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport),
+ getDeclarations(
+ moduleSpecifier,
+ quotePreference,
+ defaultImport,
+ namedImports,
+ namespaceLikeImport,
+ compilerOptions
+ ),
/*blankLineBetween*/
true,
preferences
@@ -143805,7 +142315,7 @@ function getModuleSpecifierText(promotedDeclaration) {
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
}
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
- const convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax;
+ const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
switch (aliasDeclaration.kind) {
case 273 /* ImportSpecifier */:
if (aliasDeclaration.isTypeOnly) {
@@ -143879,7 +142389,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
}
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
- const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions.preserveValueImports && compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax);
+ const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
if (defaultImport) {
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
@@ -143963,11 +142473,11 @@ function getImportTypePrefix(moduleSpecifier, quotePreference) {
function needsTypeOnly({ addAsTypeOnly }) {
return addAsTypeOnly === 2 /* Required */;
}
-function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
+function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
let statements;
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
- const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
+ const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
statements = combine(statements, makeImport(
defaultImport && factory.createIdentifier(defaultImport.name),
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
@@ -144564,7 +143074,7 @@ function tryGetExportDeclaration(sourceFile, isTypeOnly) {
}
function updateExport(changes, program, sourceFile, node, names) {
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
- const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || find(namedExports, (e) => e.isTypeOnly));
+ const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
changes.replaceNode(
sourceFile,
node,
@@ -144596,7 +143106,7 @@ function createExport(changes, program, sourceFile, names) {
factory.createNamedExports(createExportSpecifiers(
names,
/*allowTypeModifier*/
- !!program.getCompilerOptions().isolatedModules
+ getIsolatedModules(program.getCompilerOptions())
)),
/*moduleSpecifier*/
void 0,
@@ -145565,7 +144075,7 @@ function tryGetValueFromType(context, checker, importAdder, quotePreference, typ
}
if (isObjectLiteralType(type)) {
const props = map(checker.getPropertiesOfType(type), (prop) => {
- const initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined();
+ const initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), enclosingDeclaration);
return factory.createPropertyAssignment(prop.name, initializer);
});
return factory.createObjectLiteralExpression(
@@ -148599,13 +147109,7 @@ function createMethodImplementingSignatures(checker, context, enclosingDeclarati
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
if (length(signatures)) {
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
- return checker.typeToTypeNode(
- type,
- enclosingDeclaration,
- /*flags*/
- void 0,
- getNoopSymbolTrackerWithResolver(context)
- );
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
}
}
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -148884,7 +147388,14 @@ function updatePropertyDeclaration(changeTracker, file, declaration, type, field
changeTracker.replaceNode(file, declaration, property);
}
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
- const assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
+ if (assignment === declaration)
+ assignment = factory.cloneNode(assignment);
+ assignment.modifiers = void 0;
+ assignment.questionToken = void 0;
+ assignment.exclamationToken = void 0;
+ }
changeTracker.replacePropertyAssignment(file, declaration, assignment);
}
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
@@ -149825,6 +148336,7 @@ var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
SymbolOriginInfoKind2[SymbolOriginInfoKind2["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ObjectLiteralMethod"] = 128] = "ObjectLiteralMethod";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore";
+ SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport";
return SymbolOriginInfoKind2;
@@ -149842,7 +148354,7 @@ function originIsResolvedExport(origin) {
return !!(origin && origin.kind === 32 /* ResolvedExport */);
}
function originIncludesSymbolName(origin) {
- return originIsExport(origin) || originIsResolvedExport(origin);
+ return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin);
}
function originIsPackageJsonImport(origin) {
return (originIsExport(origin) || originIsResolvedExport(origin)) && !!origin.isFromPackageJson;
@@ -149862,6 +148374,9 @@ function originIsObjectLiteralMethod(origin) {
function originIsIgnore(origin) {
return !!(origin && origin.kind & 256 /* Ignore */);
}
+function originIsComputedPropertyName(origin) {
+ return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
+}
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
var _a2, _b, _c;
const start2 = timestamp();
@@ -149904,7 +148419,7 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
return result2 || (needsFullResolution ? "failed" : "skipped");
}
}
-function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
+function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
var _a2;
const { previousToken } = getRelevantTokens(position, sourceFile);
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
@@ -149926,7 +148441,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
} else {
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
}
- const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
+ const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
if (stringCompletions) {
return stringCompletions;
}
@@ -149950,19 +148465,19 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
return void 0;
}
switch (completionData.kind) {
- case CompletionDataKind.Data:
- const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
+ case 0 /* Data */:
+ const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
if (response == null ? void 0 : response.isIncomplete) {
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
}
return response;
- case CompletionDataKind.JsDocTagName:
+ case 1 /* JsDocTagName */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagNameCompletions());
- case CompletionDataKind.JsDocTag:
+ case 2 /* JsDocTag */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagCompletions());
- case CompletionDataKind.JsDocParameterName:
+ case 3 /* JsDocParameterName */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocParameterNameCompletions(completionData.tag));
- case CompletionDataKind.Keywords:
+ case 4 /* Keywords */:
return specificKeywordCompletionInfo(completionData.keywordCompletions, completionData.isNewIdentifierLocation);
default:
return Debug.assertNever(completionData);
@@ -150065,7 +148580,7 @@ function specificKeywordCompletionInfo(entries, isNewIdentifierLocation) {
}
function keywordCompletionData(keywordFilters, filterOutTsOnlyKeywords, isNewIdentifierLocation) {
return {
- kind: CompletionDataKind.Keywords,
+ kind: 4 /* Keywords */,
keywordCompletions: getKeywordCompletions(keywordFilters, filterOutTsOnlyKeywords),
isNewIdentifierLocation
};
@@ -150081,7 +148596,7 @@ function keywordFiltersFromSyntaxKind(keywordCompletion) {
function getOptionalReplacementSpan(location) {
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
}
-function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
+function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
const {
symbols,
contextToken,
@@ -150155,7 +148670,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
symbolToOriginInfoMap,
symbolToSortTextMap,
isJsxIdentifierExpected,
- isRightOfOpenTag
+ isRightOfOpenTag,
+ includeSymbol
);
if (keywordFilters !== 0 /* None */) {
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
@@ -150295,64 +148811,6 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
}
return void 0;
}
-function newCaseClauseTracker(checker, clauses) {
- const existingStrings = /* @__PURE__ */ new Set();
- const existingNumbers = /* @__PURE__ */ new Set();
- const existingBigInts = /* @__PURE__ */ new Set();
- for (const clause of clauses) {
- if (!isDefaultClause(clause)) {
- if (isLiteralExpression(clause.expression)) {
- const expression = clause.expression;
- switch (expression.kind) {
- case 14 /* NoSubstitutionTemplateLiteral */:
- case 10 /* StringLiteral */:
- existingStrings.add(expression.text);
- break;
- case 8 /* NumericLiteral */:
- existingNumbers.add(parseInt(expression.text));
- break;
- case 9 /* BigIntLiteral */:
- const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
- if (parsedBigInt) {
- existingBigInts.add(pseudoBigIntToString(parsedBigInt));
- }
- break;
- }
- } else {
- const symbol = checker.getSymbolAtLocation(clause.expression);
- if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
- const enumValue = checker.getConstantValue(symbol.valueDeclaration);
- if (enumValue !== void 0) {
- addValue(enumValue);
- }
- }
- }
- }
- }
- return {
- addValue,
- hasValue
- };
- function addValue(value) {
- switch (typeof value) {
- case "string":
- existingStrings.add(value);
- break;
- case "number":
- existingNumbers.add(value);
- }
- }
- function hasValue(value) {
- switch (typeof value) {
- case "string":
- return existingStrings.has(value);
- case "number":
- return existingNumbers.has(value);
- case "object":
- return existingBigInts.has(pseudoBigIntToString(value));
- }
- }
-}
function typeNodeToExpression(typeNode, languageVersion, quotePreference) {
switch (typeNode.kind) {
case 180 /* TypeReference */:
@@ -150400,9 +148858,9 @@ function entityNameToExpression(entityName, languageVersion, quotePreference) {
}
function isMemberCompletionKind(kind) {
switch (kind) {
- case CompletionKind.ObjectPropertyDeclaration:
- case CompletionKind.MemberLike:
- case CompletionKind.PropertyAccess:
+ case 0 /* ObjectPropertyDeclaration */:
+ case 3 /* MemberLike */:
+ case 2 /* PropertyAccess */:
return true;
default:
return false;
@@ -150462,7 +148920,7 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
-function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
+function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
let insertText;
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
let data;
@@ -150506,7 +148964,9 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
}
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
- replacementSpan = createTextSpanFromBounds(propertyAccessToConvert.getStart(sourceFile), propertyAccessToConvert.end);
+ const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
+ const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
+ replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
}
if (originIsResolvedExport(origin)) {
sourceDisplay = [textPart(origin.moduleSpecifier)];
@@ -150518,7 +148978,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
hasAction = true;
}
- if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === CompletionKind.MemberLike && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
+ if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
let importAdder;
({ insertText, isSnippet, importAdder, replacementSpan } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext));
sortText = SortText.ClassMemberSnippets;
@@ -150540,7 +149000,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
isSnippet = true;
} else {
@@ -150574,7 +149034,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
isSnippet,
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
isImportStatementCompletion: !!importStatementCompletion || void 0,
- data
+ data,
+ ...includeSymbol ? { symbol } : void 0
};
}
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
@@ -150642,7 +149103,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
if (isAbstract) {
requiredModifiers |= 256 /* Abstract */;
}
- if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
+ if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
requiredModifiers |= 16384 /* Override */;
}
if (!completionNodes.length) {
@@ -150948,6 +149409,7 @@ function originToCompletionEntryData(origin) {
if (originIsResolvedExport(origin)) {
const resolvedData = {
exportName: origin.exportName,
+ exportMapKey: origin.exportMapKey,
moduleSpecifier: origin.moduleSpecifier,
ambientModuleName,
fileName: origin.fileName,
@@ -150971,6 +149433,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
const resolvedOrigin = {
kind: 32 /* ResolvedExport */,
exportName: data.exportName,
+ exportMapKey: data.exportMapKey,
moduleSpecifier: data.moduleSpecifier,
symbolName: completionName,
fileName: data.fileName,
@@ -150994,7 +149457,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
}
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
const replacementSpan = importStatementCompletion.replacementSpan;
- const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
+ const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
const importKind = ts_codefix_exports.getImportKind(
@@ -151042,7 +149505,7 @@ function getSourceFromOrigin(origin) {
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
}
}
-function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
+function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
var _a2;
const start2 = timestamp();
const variableDeclaration = getVariableDeclaration(location);
@@ -151053,7 +149516,7 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
const symbol = symbols[i];
const origin = symbolToOriginInfoMap == null ? void 0 : symbolToOriginInfoMap[i];
const info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, !!jsxIdentifierExpected);
- if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === CompletionKind.Global && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
+ if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === 1 /* Global */ && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
continue;
}
const { name, needsConvertPropertyAccess } = info;
@@ -151082,7 +149545,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
kind,
formatContext,
isJsxIdentifierExpected,
- isRightOfOpenTag
+ isRightOfOpenTag,
+ includeSymbol
);
if (!entry) {
continue;
@@ -151192,7 +149656,7 @@ function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entr
if (!completionData) {
return { type: "none" };
}
- if (completionData.kind !== CompletionDataKind.Data) {
+ if (completionData.kind !== 0 /* Data */) {
return { type: "request", request: completionData };
}
const { symbols, literals, location, completionKind, symbolToOriginInfoMap, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } = completionData;
@@ -151218,13 +149682,13 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
case "request": {
const { request } = symbolCompletion;
switch (request.kind) {
- case CompletionDataKind.JsDocTagName:
+ case 1 /* JsDocTagName */:
return ts_JsDoc_exports.getJSDocTagNameCompletionDetails(name);
- case CompletionDataKind.JsDocTag:
+ case 2 /* JsDocTag */:
return ts_JsDoc_exports.getJSDocTagCompletionDetails(name);
- case CompletionDataKind.JsDocParameterName:
+ case 3 /* JsDocParameterName */:
return ts_JsDoc_exports.getJSDocParameterNameCompletionDetails(name);
- case CompletionDataKind.Keywords:
+ case 4 /* Keywords */:
return some(request.keywordCompletions, (c) => c.name === name) ? createSimpleDetails(name, "keyword" /* keyword */, 5 /* keyword */) : void 0;
default:
return Debug.assertNever(request);
@@ -151233,7 +149697,8 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
case "symbol": {
const { symbol, location, contextToken: contextToken2, origin, previousToken: previousToken2 } = symbolCompletion;
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken2, formatContext, preferences, data, source, cancellationToken);
- return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
+ const symbolName2 = originIsComputedPropertyName(origin) ? origin.symbolName : symbol.name;
+ return createCompletionDetailsForSymbol(symbol, symbolName2, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
}
case "literal": {
const { literal } = symbolCompletion;
@@ -151284,12 +149749,12 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
function createSimpleDetails(name, kind, kind2) {
return createCompletionDetails(name, "" /* none */, kind, [displayPart(name, kind2)]);
}
-function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
+function createCompletionDetailsForSymbol(symbol, name, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(
cancellationToken,
(checker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker2, symbol, sourceFile, location, location, 7 /* All */)
);
- return createCompletionDetails(symbol.name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
+ return createCompletionDetails(name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
}
function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) {
return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source };
@@ -151349,6 +149814,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
targetSymbol,
moduleSymbol,
+ data == null ? void 0 : data.exportMapKey,
sourceFile,
name,
isJsxOpeningTagName,
@@ -151366,14 +149832,6 @@ function getCompletionEntrySymbol(program, log, sourceFile, position, entryId, h
const completion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences);
return completion.type === "symbol" ? completion.symbol : void 0;
}
-var CompletionDataKind = /* @__PURE__ */ ((CompletionDataKind2) => {
- CompletionDataKind2[CompletionDataKind2["Data"] = 0] = "Data";
- CompletionDataKind2[CompletionDataKind2["JsDocTagName"] = 1] = "JsDocTagName";
- CompletionDataKind2[CompletionDataKind2["JsDocTag"] = 2] = "JsDocTag";
- CompletionDataKind2[CompletionDataKind2["JsDocParameterName"] = 3] = "JsDocParameterName";
- CompletionDataKind2[CompletionDataKind2["Keywords"] = 4] = "Keywords";
- return CompletionDataKind2;
-})(CompletionDataKind || {});
var CompletionKind = /* @__PURE__ */ ((CompletionKind2) => {
CompletionKind2[CompletionKind2["ObjectPropertyDeclaration"] = 0] = "ObjectPropertyDeclaration";
CompletionKind2[CompletionKind2["Global"] = 1] = "Global";
@@ -151593,7 +150051,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
break;
case 291 /* JsxExpression */:
case 290 /* JsxSpreadAttribute */:
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
isJsxIdentifierExpected = true;
}
break;
@@ -152055,16 +150513,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
return;
}
- const firstImportableExportInfo = find(info, isImportableExportInfo);
- if (!firstImportableExportInfo) {
+ info = filter(info, isImportableExportInfo);
+ if (!info.length) {
return;
}
const result = context.tryResolve(info, isFromAmbientModule) || {};
if (result === "failed")
return;
- let exportInfo2 = firstImportableExportInfo, moduleSpecifier;
+ let exportInfo2 = info[0], moduleSpecifier;
if (result !== "skipped") {
- ({ exportInfo: exportInfo2 = firstImportableExportInfo, moduleSpecifier } = result);
+ ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
}
const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
@@ -152228,7 +150686,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
return false;
}
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) {
- return (isRegularExpressionLiteral(contextToken2) || isStringTextContainingNode(contextToken2)) && (rangeContainsPositionExclusive(createTextRangeFromSpan(createTextSpanFromNode(contextToken2)), position) || position === contextToken2.end && (!!contextToken2.isUnterminated || isRegularExpressionLiteral(contextToken2)));
+ return (isRegularExpressionLiteral(contextToken2) || isStringTextContainingNode(contextToken2)) && (rangeContainsPositionExclusive(contextToken2, position) || position === contextToken2.end && (!!contextToken2.isUnterminated || isRegularExpressionLiteral(contextToken2)));
}
function tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() {
const typeLiteralNode = tryGetTypeLiteralNode(contextToken);
@@ -152403,6 +150861,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
return classElementModifierFlags & 32 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
});
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
+ forEach(symbols, (symbol, index) => {
+ const declaration = symbol == null ? void 0 : symbol.valueDeclaration;
+ if (declaration && isClassElement(declaration) && declaration.name && isComputedPropertyName(declaration.name)) {
+ const origin = {
+ kind: 512 /* ComputedPropertyName */,
+ symbolName: typeChecker.symbolToString(symbol)
+ };
+ symbolToOriginInfoMap[index] = origin;
+ }
+ });
}
return 1 /* Success */;
}
@@ -152787,7 +151255,7 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
}
switch (kind) {
case 3 /* MemberLike */:
- return void 0;
+ return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
case 0 /* ObjectPropertyDeclaration */:
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
case 2 /* PropertyAccess */:
@@ -152940,7 +151408,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj,
function getApparentProperties(type, node, checker) {
if (!type.isUnion())
return type.getApparentProperties();
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 131068 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
}
function containsNonPublicProperties(props) {
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -153288,7 +151756,7 @@ function createNameAndKindSet() {
values: map2.values.bind(map2)
};
}
-function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
+function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
if (isInReferenceComment(sourceFile, position)) {
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
return entries && convertPathCompletions(entries);
@@ -153297,18 +151765,18 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
if (!contextToken || !isStringLiteralLike(contextToken))
return void 0;
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
- return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
+ return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
}
}
-function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
+function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
if (completion === void 0) {
return void 0;
}
const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken);
switch (completion.kind) {
- case StringLiteralCompletionKind.Paths:
+ case 0 /* Paths */:
return convertPathCompletions(completion.paths);
- case StringLiteralCompletionKind.Properties: {
+ case 1 /* Properties */: {
const entries = createSortedArray();
getCompletionEntriesFromSymbols(
completion.symbols,
@@ -153326,11 +151794,32 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
preferences,
options,
/*formatContext*/
- void 0
+ void 0,
+ /*isTypeOnlyLocation */
+ void 0,
+ /*propertyAccessToConvert*/
+ void 0,
+ /*jsxIdentifierExpected*/
+ void 0,
+ /*isJsxInitializer*/
+ void 0,
+ /*importStatementCompletion*/
+ void 0,
+ /*recommendedCompletion*/
+ void 0,
+ /*symbolToOriginInfoMap*/
+ void 0,
+ /*symbolToSortTextMap*/
+ void 0,
+ /*isJsxIdentifierExpected*/
+ void 0,
+ /*isRightOfOpenTag*/
+ void 0,
+ includeSymbol
);
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
}
- case StringLiteralCompletionKind.Types: {
+ case 2 /* Types */: {
const entries = completion.types.map((type) => ({
name: type.value,
kindModifiers: "" /* none */,
@@ -153352,16 +151841,16 @@ function getStringLiteralCompletionDetails(name, sourceFile, position, contextTo
}
function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
switch (completion.kind) {
- case StringLiteralCompletionKind.Paths: {
+ case 0 /* Paths */: {
const match = find(completion.paths, (p) => p.name === name);
return match && createCompletionDetails(name, kindModifiersFromExtension(match.extension), match.kind, [textPart(name)]);
}
- case StringLiteralCompletionKind.Properties: {
+ case 1 /* Properties */: {
const match = find(completion.symbols, (s) => s.name === name);
- return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
+ return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
}
- case StringLiteralCompletionKind.Types:
- return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "type" /* typeElement */, [textPart(name)]) : void 0;
+ case 2 /* Types */:
+ return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
default:
return Debug.assertNever(completion);
}
@@ -153406,12 +151895,6 @@ function kindModifiersFromExtension(extension) {
return Debug.assertNever(extension);
}
}
-var StringLiteralCompletionKind = /* @__PURE__ */ ((StringLiteralCompletionKind2) => {
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Paths"] = 0] = "Paths";
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Properties"] = 1] = "Properties";
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Types"] = 2] = "Types";
- return StringLiteralCompletionKind2;
-})(StringLiteralCompletionKind || {});
function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) {
const parent2 = walkUpParentheses(node.parent);
switch (parent2.kind) {
@@ -153450,7 +151933,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent);
}
- return fromContextualType();
+ return fromContextualType() || fromContextualType(0 /* None */);
case 209 /* ElementAccessExpression */: {
const { expression, argumentExpression } = parent2;
if (node === skipParentheses(argumentExpression)) {
@@ -153469,11 +151952,23 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
case 275 /* ExportDeclaration */:
case 280 /* ExternalModuleReference */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
+ case 292 /* CaseClause */:
+ const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
+ const contextualTypes = fromContextualType();
+ if (!contextualTypes) {
+ return;
+ }
+ const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
+ return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
default:
return fromContextualType();
}
- function fromContextualType() {
- return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, 4 /* Completions */)), isNewIdentifier: false };
+ function fromContextualType(contextFlags = 4 /* Completions */) {
+ const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
+ if (!types.length) {
+ return;
+ }
+ return { kind: 2 /* Types */, types, isNewIdentifier: false };
}
}
function walkUpParentheses(node) {
@@ -153564,12 +152059,12 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, comp
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
const scriptPath = sourceFile.path;
const scriptDirectory = getDirectoryPath(scriptPath);
- const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
+ const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
}
-function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
+function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
return {
- extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
+ extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
referenceKind,
importingSourceFile,
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
@@ -153599,8 +152094,17 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
).values());
}
}
-function getSupportedExtensionsForModuleResolution(compilerOptions) {
- const extensions = getSupportedExtensions(compilerOptions);
+function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
+ const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
+ typeChecker.getAmbientModules(),
+ (module2) => {
+ const name = module2.name.slice(1, -1);
+ if (!name.startsWith("*.") || name.includes("/"))
+ return;
+ return name.slice(1);
+ }
+ );
+ const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
}
@@ -153627,11 +152131,6 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
exclude
).values()));
}
-var ReferenceKind = /* @__PURE__ */ ((ReferenceKind2) => {
- ReferenceKind2[ReferenceKind2["Filename"] = 0] = "Filename";
- ReferenceKind2[ReferenceKind2["ModuleSpecifier"] = 1] = "ModuleSpecifier";
- return ReferenceKind2;
-})(ReferenceKind || {});
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
var _a2;
if (fragment === void 0) {
@@ -155401,7 +153900,7 @@ var Core;
) || originalSymbol;
const searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : 7 /* All */;
const result = [];
- const state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : SpecialSearchKind.None, checker, cancellationToken, searchMeaning, options, result);
+ const state = new State(sourceFiles, sourceFilesSet, node ? getSpecialSearchKind(node) : 0 /* None */, checker, cancellationToken, searchMeaning, options, result);
const exportSpecifier = !isForRenameWithPrefixAndSuffixText(options) || !symbol.declarations ? void 0 : find(symbol.declarations, isExportSpecifier);
if (exportSpecifier) {
getReferencesAtExportSpecifier(
@@ -155457,14 +153956,14 @@ var Core;
switch (node.kind) {
case 173 /* Constructor */:
case 135 /* ConstructorKeyword */:
- return SpecialSearchKind.Constructor;
+ return 1 /* Constructor */;
case 79 /* Identifier */:
if (isClassLike(node.parent)) {
Debug.assert(node.parent.name === node);
- return SpecialSearchKind.Class;
+ return 2 /* Class */;
}
default:
- return SpecialSearchKind.None;
+ return 0 /* None */;
}
}
function skipPastExportOrImportSpecifierOrUnion(symbol, node, checker, useLocalSymbolForExportSpecifier) {
@@ -157361,6 +155860,7 @@ var jsDocTagNames = [
"module",
"name",
"namespace",
+ "overload",
"override",
"package",
"param",
@@ -160076,12 +158576,7 @@ function filterImport(i, moduleSpecifier, keep) {
return defaultImport || namedBindings ? factory.createImportDeclaration(
/*modifiers*/
void 0,
- factory.createImportClause(
- /*isTypeOnly*/
- false,
- defaultImport,
- namedBindings
- ),
+ factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings),
moduleSpecifier,
/*assertClause*/
void 0
@@ -160787,6 +159282,7 @@ function convertToBlock(body) {
if (isExpression(body)) {
const returnStatement = factory.createReturnStatement(body);
const file = body.getSourceFile();
+ setTextRange(returnStatement, body);
suppressLeadingAndTrailingTrivia(returnStatement);
copyTrailingAsLeadingComments(
body,
@@ -162392,10 +160888,10 @@ function getPossibleExtractions(targetRange, context) {
const scopeDescription = isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope);
let functionDescription;
let constantDescription;
- if (scopeDescription === SpecialScope.Global) {
+ if (scopeDescription === 1 /* Global */) {
functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]);
constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"]);
- } else if (scopeDescription === SpecialScope.Module) {
+ } else if (scopeDescription === 0 /* Module */) {
functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]);
constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"]);
} else {
@@ -162461,13 +160957,8 @@ function getDescriptionForClassLikeDeclaration(scope) {
return scope.kind === 260 /* ClassDeclaration */ ? scope.name ? `class '${scope.name.text}'` : "anonymous class declaration" : scope.name ? `class expression '${scope.name.text}'` : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? SpecialScope.Module : SpecialScope.Global;
+ return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
-var SpecialScope = /* @__PURE__ */ ((SpecialScope2) => {
- SpecialScope2[SpecialScope2["Module"] = 0] = "Module";
- SpecialScope2[SpecialScope2["Global"] = 1] = "Global";
- return SpecialScope2;
-})(SpecialScope || {});
function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) {
const checker = context.program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
@@ -162499,7 +160990,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
typeNode
);
parameters.push(paramDecl);
- if (usage.usage === Usage.Write) {
+ if (usage.usage === 2 /* Write */) {
(writes || (writes = [])).push(usage);
}
callArguments.push(factory.createIdentifier(name));
@@ -163151,11 +161642,6 @@ function isReadonlyArray(v) {
function getEnclosingTextRange(targetRange, sourceFile) {
return isReadonlyArray(targetRange.range) ? { pos: first(targetRange.range).getStart(sourceFile), end: last(targetRange.range).getEnd() } : targetRange.range;
}
-var Usage = /* @__PURE__ */ ((Usage2) => {
- Usage2[Usage2["Read"] = 1] = "Read";
- Usage2[Usage2["Write"] = 2] = "Write";
- return Usage2;
-})(Usage || {});
function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, checker, cancellationToken) {
const allTypeParameterUsages = /* @__PURE__ */ new Map();
const usagesPerScope = [];
@@ -163804,13 +162290,8 @@ function getSignatureHelpItems(program, sourceFile, position, triggerReason, can
if (!candidateInfo) {
return isSourceFileJS(sourceFile) ? createJSSignatureHelpItems(argumentInfo, program, cancellationToken) : void 0;
}
- return typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => candidateInfo.kind === CandidateOrTypeKind.Candidate ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2));
+ return typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => candidateInfo.kind === 0 /* Candidate */ ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2));
}
-var CandidateOrTypeKind = /* @__PURE__ */ ((CandidateOrTypeKind2) => {
- CandidateOrTypeKind2[CandidateOrTypeKind2["Candidate"] = 0] = "Candidate";
- CandidateOrTypeKind2[CandidateOrTypeKind2["Type"] = 1] = "Type";
- return CandidateOrTypeKind2;
-})(CandidateOrTypeKind || {});
function getCandidateOrTypeInfo({ invocation, argumentCount }, checker, sourceFile, startingToken, onlyUseSyntacticOwners) {
switch (invocation.kind) {
case 0 /* Call */: {
@@ -168088,7 +166569,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
}
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
Debug.assert(!nodeIsSynthesized(child));
- if (nodeIsMissing(child)) {
+ if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
return inheritedIndentation;
}
const childStartPos = child.getStart(sourceFile);
@@ -168221,7 +166702,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
if (currentTokenInfo.leadingTrivia) {
processTrivia(currentTokenInfo.leadingTrivia, parent2, childContextNode, dynamicIndentation);
}
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
const isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token);
const tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
if (isTokenInRange) {
@@ -168229,11 +166710,11 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
const savePreviousRange = previousRange;
lineAction = processRange(currentTokenInfo.token, tokenStart, parent2, childContextNode, dynamicIndentation);
if (!rangeHasError) {
- if (lineAction === LineAction.None) {
+ if (lineAction === 0 /* None */) {
const prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
} else {
- indentToken = lineAction === LineAction.LineAdded;
+ indentToken = lineAction === 1 /* LineAdded */;
}
}
}
@@ -168259,7 +166740,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
);
}
if (tokenIndentation !== -1 /* Unknown */ && indentNextTokenOrTrivia) {
- insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAction === LineAction.LineAdded);
+ insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAction === 1 /* LineAdded */);
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
@@ -168306,7 +166787,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
}
function processRange(range, rangeStart, parent2, contextNode, dynamicIndentation) {
const rangeHasError = rangeContainsError(range);
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
if (!rangeHasError) {
if (!previousRange) {
const originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
@@ -168325,13 +166806,13 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
formattingContext.updateContext(previousItem, previousParent2, currentItem, currentParent, contextNode);
const rules = getRules(formattingContext);
let trimTrailingWhitespaces = formattingContext.options.trimTrailingWhitespace !== false;
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
if (rules) {
forEachRight(rules, (rule2) => {
lineAction = applyRuleEdits(rule2, previousItem, previousStartLine, currentItem, currentStartLine);
if (dynamicIndentation) {
switch (lineAction) {
- case LineAction.LineRemoved:
+ case 2 /* LineRemoved */:
if (currentParent.getStart(sourceFile) === currentItem.pos) {
dynamicIndentation.recomputeIndentation(
/*lineAddedByFormatting*/
@@ -168340,7 +166821,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
);
}
break;
- case LineAction.LineAdded:
+ case 1 /* LineAdded */:
if (currentParent.getStart(sourceFile) === currentItem.pos) {
dynamicIndentation.recomputeIndentation(
/*lineAddedByFormatting*/
@@ -168350,7 +166831,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
}
break;
default:
- Debug.assert(lineAction === LineAction.None);
+ Debug.assert(lineAction === 0 /* None */);
}
}
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule2.action & 16 /* DeleteSpace */) && rule2.flags !== 1 /* CanDeleteNewLines */;
@@ -168497,11 +166978,11 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
const onLaterLine = currentStartLine !== previousStartLine;
switch (rule2.action) {
case 1 /* StopProcessingSpaceActions */:
- return LineAction.None;
+ return 0 /* None */;
case 16 /* DeleteSpace */:
if (previousRange2.end !== currentRange.pos) {
recordDelete(previousRange2.end, currentRange.pos - previousRange2.end);
- return onLaterLine ? LineAction.LineRemoved : LineAction.None;
+ return onLaterLine ? 2 /* LineRemoved */ : 0 /* None */;
}
break;
case 32 /* DeleteToken */:
@@ -168509,36 +166990,30 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
break;
case 8 /* InsertNewLine */:
if (rule2.flags !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {
- return LineAction.None;
+ return 0 /* None */;
}
const lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, getNewLineOrDefaultFromHost(host, options));
- return onLaterLine ? LineAction.None : LineAction.LineAdded;
+ return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
case 4 /* InsertSpace */:
if (rule2.flags !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {
- return LineAction.None;
+ return 0 /* None */;
}
const posDelta = currentRange.pos - previousRange2.end;
if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange2.end) !== 32 /* space */) {
recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, " ");
- return onLaterLine ? LineAction.LineRemoved : LineAction.None;
+ return onLaterLine ? 2 /* LineRemoved */ : 0 /* None */;
}
break;
case 64 /* InsertTrailingSemicolon */:
recordInsert(previousRange2.end, ";");
}
- return LineAction.None;
+ return 0 /* None */;
}
}
-var LineAction = /* @__PURE__ */ ((LineAction2) => {
- LineAction2[LineAction2["None"] = 0] = "None";
- LineAction2[LineAction2["LineAdded"] = 1] = "LineAdded";
- LineAction2[LineAction2["LineRemoved"] = 2] = "LineRemoved";
- return LineAction2;
-})(LineAction || {});
function getRangeOfEnclosingComment(sourceFile, position, precedingToken, tokenAtPosition = getTokenAtPosition(sourceFile, position)) {
const jsdoc = findAncestor(tokenAtPosition, isJSDoc);
if (jsdoc)
@@ -168761,7 +167236,7 @@ var SmartIndenter;
)) {
const currentStart = getStartLineAndCharacterForNode(current, sourceFile);
const nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile);
- const indentationDelta = nextTokenKind !== NextTokenKind.Unknown ? assumeNewLineBeforeCloseBrace && nextTokenKind === NextTokenKind.CloseBrace ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0;
+ const indentationDelta = nextTokenKind !== 0 /* Unknown */ ? assumeNewLineBeforeCloseBrace && nextTokenKind === 2 /* CloseBrace */ ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0;
return getIndentationForNodeWorker(
current,
currentStart,
@@ -169189,6 +167664,2258 @@ var SmartIndenter;
}
})(SmartIndenter || (SmartIndenter = {}));
+// src/server/_namespaces/ts.ts
+var ts_exports3 = {};
+__export(ts_exports3, {
+ ANONYMOUS: () => ANONYMOUS,
+ AccessFlags: () => AccessFlags,
+ AssertionLevel: () => AssertionLevel,
+ AssignmentDeclarationKind: () => AssignmentDeclarationKind,
+ AssignmentKind: () => AssignmentKind,
+ Associativity: () => Associativity,
+ BreakpointResolver: () => ts_BreakpointResolver_exports,
+ BuilderFileEmit: () => BuilderFileEmit,
+ BuilderProgramKind: () => BuilderProgramKind,
+ BuilderState: () => BuilderState,
+ BundleFileSectionKind: () => BundleFileSectionKind,
+ CallHierarchy: () => ts_CallHierarchy_exports,
+ CharacterCodes: () => CharacterCodes,
+ CheckFlags: () => CheckFlags,
+ CheckMode: () => CheckMode,
+ ClassificationType: () => ClassificationType,
+ ClassificationTypeNames: () => ClassificationTypeNames,
+ CommentDirectiveType: () => CommentDirectiveType,
+ Comparison: () => Comparison,
+ CompletionInfoFlags: () => CompletionInfoFlags,
+ CompletionTriggerKind: () => CompletionTriggerKind,
+ Completions: () => ts_Completions_exports,
+ ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
+ ContextFlags: () => ContextFlags,
+ CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
+ Debug: () => Debug,
+ DeprecationVersion: () => DeprecationVersion,
+ DiagnosticCategory: () => DiagnosticCategory,
+ Diagnostics: () => Diagnostics,
+ DocumentHighlights: () => DocumentHighlights,
+ ElementFlags: () => ElementFlags,
+ EmitFlags: () => EmitFlags,
+ EmitHint: () => EmitHint,
+ EmitOnly: () => EmitOnly,
+ EndOfLineState: () => EndOfLineState,
+ EnumKind: () => EnumKind,
+ ExitStatus: () => ExitStatus,
+ ExportKind: () => ExportKind,
+ Extension: () => Extension,
+ ExternalEmitHelpers: () => ExternalEmitHelpers,
+ FileIncludeKind: () => FileIncludeKind,
+ FilePreprocessingDiagnosticsKind: () => FilePreprocessingDiagnosticsKind,
+ FileSystemEntryKind: () => FileSystemEntryKind,
+ FileWatcherEventKind: () => FileWatcherEventKind,
+ FindAllReferences: () => ts_FindAllReferences_exports,
+ FlattenLevel: () => FlattenLevel,
+ FlowFlags: () => FlowFlags,
+ ForegroundColorEscapeSequences: () => ForegroundColorEscapeSequences,
+ FunctionFlags: () => FunctionFlags,
+ GeneratedIdentifierFlags: () => GeneratedIdentifierFlags,
+ GetLiteralTextFlags: () => GetLiteralTextFlags,
+ GoToDefinition: () => ts_GoToDefinition_exports,
+ HighlightSpanKind: () => HighlightSpanKind,
+ ImportKind: () => ImportKind,
+ ImportsNotUsedAsValues: () => ImportsNotUsedAsValues,
+ IndentStyle: () => IndentStyle,
+ IndexKind: () => IndexKind,
+ InferenceFlags: () => InferenceFlags,
+ InferencePriority: () => InferencePriority,
+ InlayHintKind: () => InlayHintKind,
+ InlayHints: () => ts_InlayHints_exports,
+ InternalEmitFlags: () => InternalEmitFlags,
+ InternalSymbolName: () => InternalSymbolName,
+ InvalidatedProjectKind: () => InvalidatedProjectKind,
+ JsDoc: () => ts_JsDoc_exports,
+ JsTyping: () => ts_JsTyping_exports,
+ JsxEmit: () => JsxEmit,
+ JsxFlags: () => JsxFlags,
+ JsxReferenceKind: () => JsxReferenceKind,
+ LanguageServiceMode: () => LanguageServiceMode,
+ LanguageServiceShimHostAdapter: () => LanguageServiceShimHostAdapter,
+ LanguageVariant: () => LanguageVariant,
+ LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
+ ListFormat: () => ListFormat,
+ LogLevel: () => LogLevel,
+ MemberOverrideStatus: () => MemberOverrideStatus,
+ ModifierFlags: () => ModifierFlags,
+ ModuleDetectionKind: () => ModuleDetectionKind,
+ ModuleInstanceState: () => ModuleInstanceState,
+ ModuleKind: () => ModuleKind,
+ ModuleResolutionKind: () => ModuleResolutionKind,
+ ModuleSpecifierEnding: () => ModuleSpecifierEnding,
+ NavigateTo: () => ts_NavigateTo_exports,
+ NavigationBar: () => ts_NavigationBar_exports,
+ NewLineKind: () => NewLineKind,
+ NodeBuilderFlags: () => NodeBuilderFlags,
+ NodeCheckFlags: () => NodeCheckFlags,
+ NodeFactoryFlags: () => NodeFactoryFlags,
+ NodeFlags: () => NodeFlags,
+ NodeResolutionFeatures: () => NodeResolutionFeatures,
+ ObjectFlags: () => ObjectFlags,
+ OperationCanceledException: () => OperationCanceledException,
+ OperatorPrecedence: () => OperatorPrecedence,
+ OrganizeImports: () => ts_OrganizeImports_exports,
+ OrganizeImportsMode: () => OrganizeImportsMode,
+ OuterExpressionKinds: () => OuterExpressionKinds,
+ OutliningElementsCollector: () => ts_OutliningElementsCollector_exports,
+ OutliningSpanKind: () => OutliningSpanKind,
+ OutputFileType: () => OutputFileType,
+ PackageJsonAutoImportPreference: () => PackageJsonAutoImportPreference,
+ PackageJsonDependencyGroup: () => PackageJsonDependencyGroup,
+ PatternMatchKind: () => PatternMatchKind,
+ PollingInterval: () => PollingInterval,
+ PollingWatchKind: () => PollingWatchKind,
+ PragmaKindFlags: () => PragmaKindFlags,
+ PrivateIdentifierKind: () => PrivateIdentifierKind,
+ ProcessLevel: () => ProcessLevel,
+ QuotePreference: () => QuotePreference,
+ RelationComparisonResult: () => RelationComparisonResult,
+ Rename: () => ts_Rename_exports,
+ ScriptElementKind: () => ScriptElementKind,
+ ScriptElementKindModifier: () => ScriptElementKindModifier,
+ ScriptKind: () => ScriptKind,
+ ScriptSnapshot: () => ScriptSnapshot,
+ ScriptTarget: () => ScriptTarget,
+ SemanticClassificationFormat: () => SemanticClassificationFormat,
+ SemanticMeaning: () => SemanticMeaning,
+ SemicolonPreference: () => SemicolonPreference,
+ SignatureCheckMode: () => SignatureCheckMode,
+ SignatureFlags: () => SignatureFlags,
+ SignatureHelp: () => ts_SignatureHelp_exports,
+ SignatureKind: () => SignatureKind,
+ SmartSelectionRange: () => ts_SmartSelectionRange_exports,
+ SnippetKind: () => SnippetKind,
+ SortKind: () => SortKind,
+ StructureIsReused: () => StructureIsReused,
+ SymbolAccessibility: () => SymbolAccessibility,
+ SymbolDisplay: () => ts_SymbolDisplay_exports,
+ SymbolDisplayPartKind: () => SymbolDisplayPartKind,
+ SymbolFlags: () => SymbolFlags,
+ SymbolFormatFlags: () => SymbolFormatFlags,
+ SyntaxKind: () => SyntaxKind,
+ SyntheticSymbolKind: () => SyntheticSymbolKind,
+ Ternary: () => Ternary,
+ ThrottledCancellationToken: () => ThrottledCancellationToken,
+ TokenClass: () => TokenClass,
+ TokenFlags: () => TokenFlags,
+ TransformFlags: () => TransformFlags,
+ TypeFacts: () => TypeFacts,
+ TypeFlags: () => TypeFlags,
+ TypeFormatFlags: () => TypeFormatFlags,
+ TypeMapKind: () => TypeMapKind,
+ TypePredicateKind: () => TypePredicateKind,
+ TypeReferenceSerializationKind: () => TypeReferenceSerializationKind,
+ TypeScriptServicesFactory: () => TypeScriptServicesFactory,
+ UnionReduction: () => UnionReduction,
+ UpToDateStatusType: () => UpToDateStatusType,
+ VarianceFlags: () => VarianceFlags,
+ Version: () => Version,
+ VersionRange: () => VersionRange,
+ WatchDirectoryFlags: () => WatchDirectoryFlags,
+ WatchDirectoryKind: () => WatchDirectoryKind,
+ WatchFileKind: () => WatchFileKind,
+ WatchLogLevel: () => WatchLogLevel,
+ WatchType: () => WatchType,
+ accessPrivateIdentifier: () => accessPrivateIdentifier,
+ addEmitFlags: () => addEmitFlags,
+ addEmitHelper: () => addEmitHelper,
+ addEmitHelpers: () => addEmitHelpers,
+ addInternalEmitFlags: () => addInternalEmitFlags,
+ addNodeFactoryPatcher: () => addNodeFactoryPatcher,
+ addObjectAllocatorPatcher: () => addObjectAllocatorPatcher,
+ addRange: () => addRange,
+ addRelatedInfo: () => addRelatedInfo,
+ addSyntheticLeadingComment: () => addSyntheticLeadingComment,
+ addSyntheticTrailingComment: () => addSyntheticTrailingComment,
+ addToSeen: () => addToSeen,
+ advancedAsyncSuperHelper: () => advancedAsyncSuperHelper,
+ affectsDeclarationPathOptionDeclarations: () => affectsDeclarationPathOptionDeclarations,
+ affectsEmitOptionDeclarations: () => affectsEmitOptionDeclarations,
+ allKeysStartWithDot: () => allKeysStartWithDot,
+ altDirectorySeparator: () => altDirectorySeparator,
+ and: () => and,
+ append: () => append,
+ appendIfUnique: () => appendIfUnique,
+ arrayFrom: () => arrayFrom,
+ arrayIsEqualTo: () => arrayIsEqualTo,
+ arrayIsHomogeneous: () => arrayIsHomogeneous,
+ arrayIsSorted: () => arrayIsSorted,
+ arrayOf: () => arrayOf,
+ arrayReverseIterator: () => arrayReverseIterator,
+ arrayToMap: () => arrayToMap,
+ arrayToMultiMap: () => arrayToMultiMap,
+ arrayToNumericMap: () => arrayToNumericMap,
+ arraysEqual: () => arraysEqual,
+ assertType: () => assertType,
+ assign: () => assign,
+ assignHelper: () => assignHelper,
+ asyncDelegator: () => asyncDelegator,
+ asyncGeneratorHelper: () => asyncGeneratorHelper,
+ asyncSuperHelper: () => asyncSuperHelper,
+ asyncValues: () => asyncValues,
+ attachFileToDiagnostics: () => attachFileToDiagnostics,
+ awaitHelper: () => awaitHelper,
+ awaiterHelper: () => awaiterHelper,
+ base64decode: () => base64decode,
+ base64encode: () => base64encode,
+ binarySearch: () => binarySearch,
+ binarySearchKey: () => binarySearchKey,
+ bindSourceFile: () => bindSourceFile,
+ breakIntoCharacterSpans: () => breakIntoCharacterSpans,
+ breakIntoWordSpans: () => breakIntoWordSpans,
+ buildLinkParts: () => buildLinkParts,
+ buildOpts: () => buildOpts,
+ buildOverload: () => buildOverload,
+ bundlerModuleNameResolver: () => bundlerModuleNameResolver,
+ canBeConvertedToAsync: () => canBeConvertedToAsync,
+ canHaveDecorators: () => canHaveDecorators,
+ canHaveExportModifier: () => canHaveExportModifier,
+ canHaveFlowNode: () => canHaveFlowNode,
+ canHaveIllegalDecorators: () => canHaveIllegalDecorators,
+ canHaveIllegalModifiers: () => canHaveIllegalModifiers,
+ canHaveIllegalType: () => canHaveIllegalType,
+ canHaveIllegalTypeParameters: () => canHaveIllegalTypeParameters,
+ canHaveJSDoc: () => canHaveJSDoc,
+ canHaveLocals: () => canHaveLocals,
+ canHaveModifiers: () => canHaveModifiers,
+ canHaveSymbol: () => canHaveSymbol,
+ canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
+ canProduceDiagnostics: () => canProduceDiagnostics,
+ canUsePropertyAccess: () => canUsePropertyAccess,
+ canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
+ cartesianProduct: () => cartesianProduct,
+ cast: () => cast,
+ chainBundle: () => chainBundle,
+ chainDiagnosticMessages: () => chainDiagnosticMessages,
+ changeAnyExtension: () => changeAnyExtension,
+ changeCompilerHostLikeToUseCache: () => changeCompilerHostLikeToUseCache,
+ changeExtension: () => changeExtension,
+ changesAffectModuleResolution: () => changesAffectModuleResolution,
+ changesAffectingProgramStructure: () => changesAffectingProgramStructure,
+ childIsDecorated: () => childIsDecorated,
+ classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
+ classOrConstructorParameterIsDecorated: () => classOrConstructorParameterIsDecorated,
+ classPrivateFieldGetHelper: () => classPrivateFieldGetHelper,
+ classPrivateFieldInHelper: () => classPrivateFieldInHelper,
+ classPrivateFieldSetHelper: () => classPrivateFieldSetHelper,
+ classicNameResolver: () => classicNameResolver,
+ classifier: () => ts_classifier_exports,
+ cleanExtendedConfigCache: () => cleanExtendedConfigCache,
+ clear: () => clear,
+ clearMap: () => clearMap,
+ clearSharedExtendedConfigFileWatcher: () => clearSharedExtendedConfigFileWatcher,
+ climbPastPropertyAccess: () => climbPastPropertyAccess,
+ climbPastPropertyOrElementAccess: () => climbPastPropertyOrElementAccess,
+ clone: () => clone,
+ cloneCompilerOptions: () => cloneCompilerOptions,
+ closeFileWatcher: () => closeFileWatcher,
+ closeFileWatcherOf: () => closeFileWatcherOf,
+ codefix: () => ts_codefix_exports,
+ collapseTextChangeRangesAcrossMultipleVersions: () => collapseTextChangeRangesAcrossMultipleVersions,
+ collectExternalModuleInfo: () => collectExternalModuleInfo,
+ combine: () => combine,
+ combinePaths: () => combinePaths,
+ commentPragmas: () => commentPragmas,
+ commonOptionsWithBuild: () => commonOptionsWithBuild,
+ commonPackageFolders: () => commonPackageFolders,
+ compact: () => compact,
+ compareBooleans: () => compareBooleans,
+ compareDataObjects: () => compareDataObjects,
+ compareDiagnostics: () => compareDiagnostics,
+ compareDiagnosticsSkipRelatedInformation: () => compareDiagnosticsSkipRelatedInformation,
+ compareEmitHelpers: () => compareEmitHelpers,
+ compareNumberOfDirectorySeparators: () => compareNumberOfDirectorySeparators,
+ comparePaths: () => comparePaths,
+ comparePathsCaseInsensitive: () => comparePathsCaseInsensitive,
+ comparePathsCaseSensitive: () => comparePathsCaseSensitive,
+ comparePatternKeys: () => comparePatternKeys,
+ compareProperties: () => compareProperties,
+ compareStringsCaseInsensitive: () => compareStringsCaseInsensitive,
+ compareStringsCaseInsensitiveEslintCompatible: () => compareStringsCaseInsensitiveEslintCompatible,
+ compareStringsCaseSensitive: () => compareStringsCaseSensitive,
+ compareStringsCaseSensitiveUI: () => compareStringsCaseSensitiveUI,
+ compareTextSpans: () => compareTextSpans,
+ compareValues: () => compareValues,
+ compileOnSaveCommandLineOption: () => compileOnSaveCommandLineOption,
+ compilerOptionsAffectDeclarationPath: () => compilerOptionsAffectDeclarationPath,
+ compilerOptionsAffectEmit: () => compilerOptionsAffectEmit,
+ compilerOptionsAffectSemanticDiagnostics: () => compilerOptionsAffectSemanticDiagnostics,
+ compilerOptionsDidYouMeanDiagnostics: () => compilerOptionsDidYouMeanDiagnostics,
+ compilerOptionsIndicateEsModules: () => compilerOptionsIndicateEsModules,
+ compose: () => compose,
+ computeCommonSourceDirectoryOfFilenames: () => computeCommonSourceDirectoryOfFilenames,
+ computeLineAndCharacterOfPosition: () => computeLineAndCharacterOfPosition,
+ computeLineOfPosition: () => computeLineOfPosition,
+ computeLineStarts: () => computeLineStarts,
+ computePositionOfLineAndCharacter: () => computePositionOfLineAndCharacter,
+ computeSignature: () => computeSignature,
+ computeSignatureWithDiagnostics: () => computeSignatureWithDiagnostics,
+ computeSuggestionDiagnostics: () => computeSuggestionDiagnostics,
+ concatenate: () => concatenate,
+ concatenateDiagnosticMessageChains: () => concatenateDiagnosticMessageChains,
+ consumesNodeCoreModules: () => consumesNodeCoreModules,
+ contains: () => contains,
+ containsIgnoredPath: () => containsIgnoredPath,
+ containsObjectRestOrSpread: () => containsObjectRestOrSpread,
+ containsParseError: () => containsParseError,
+ containsPath: () => containsPath,
+ convertCompilerOptionsForTelemetry: () => convertCompilerOptionsForTelemetry,
+ convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson,
+ convertJsonOption: () => convertJsonOption,
+ convertToBase64: () => convertToBase64,
+ convertToObject: () => convertToObject,
+ convertToObjectWorker: () => convertToObjectWorker,
+ convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths,
+ convertToRelativePath: () => convertToRelativePath,
+ convertToTSConfig: () => convertToTSConfig,
+ convertTypeAcquisitionFromJson: () => convertTypeAcquisitionFromJson,
+ copyComments: () => copyComments,
+ copyEntries: () => copyEntries,
+ copyLeadingComments: () => copyLeadingComments,
+ copyProperties: () => copyProperties,
+ copyTrailingAsLeadingComments: () => copyTrailingAsLeadingComments,
+ copyTrailingComments: () => copyTrailingComments,
+ couldStartTrivia: () => couldStartTrivia,
+ countWhere: () => countWhere,
+ createAbstractBuilder: () => createAbstractBuilder,
+ createAccessorPropertyBackingField: () => createAccessorPropertyBackingField,
+ createAccessorPropertyGetRedirector: () => createAccessorPropertyGetRedirector,
+ createAccessorPropertySetRedirector: () => createAccessorPropertySetRedirector,
+ createBaseNodeFactory: () => createBaseNodeFactory,
+ createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
+ createBindingHelper: () => createBindingHelper,
+ createBuildInfo: () => createBuildInfo,
+ createBuilderProgram: () => createBuilderProgram,
+ createBuilderProgramUsingProgramBuildInfo: () => createBuilderProgramUsingProgramBuildInfo,
+ createBuilderStatusReporter: () => createBuilderStatusReporter,
+ createCacheWithRedirects: () => createCacheWithRedirects,
+ createCacheableExportInfoMap: () => createCacheableExportInfoMap,
+ createCachedDirectoryStructureHost: () => createCachedDirectoryStructureHost,
+ createClassifier: () => createClassifier,
+ createCommentDirectivesMap: () => createCommentDirectivesMap,
+ createCompilerDiagnostic: () => createCompilerDiagnostic,
+ createCompilerDiagnosticForInvalidCustomType: () => createCompilerDiagnosticForInvalidCustomType,
+ createCompilerDiagnosticFromMessageChain: () => createCompilerDiagnosticFromMessageChain,
+ createCompilerHost: () => createCompilerHost,
+ createCompilerHostFromProgramHost: () => createCompilerHostFromProgramHost,
+ createCompilerHostWorker: () => createCompilerHostWorker,
+ createDetachedDiagnostic: () => createDetachedDiagnostic,
+ createDiagnosticCollection: () => createDiagnosticCollection,
+ createDiagnosticForFileFromMessageChain: () => createDiagnosticForFileFromMessageChain,
+ createDiagnosticForNode: () => createDiagnosticForNode,
+ createDiagnosticForNodeArray: () => createDiagnosticForNodeArray,
+ createDiagnosticForNodeArrayFromMessageChain: () => createDiagnosticForNodeArrayFromMessageChain,
+ createDiagnosticForNodeFromMessageChain: () => createDiagnosticForNodeFromMessageChain,
+ createDiagnosticForNodeInSourceFile: () => createDiagnosticForNodeInSourceFile,
+ createDiagnosticForRange: () => createDiagnosticForRange,
+ createDiagnosticMessageChainFromDiagnostic: () => createDiagnosticMessageChainFromDiagnostic,
+ createDiagnosticReporter: () => createDiagnosticReporter,
+ createDocumentPositionMapper: () => createDocumentPositionMapper,
+ createDocumentRegistry: () => createDocumentRegistry,
+ createDocumentRegistryInternal: () => createDocumentRegistryInternal,
+ createEmitAndSemanticDiagnosticsBuilderProgram: () => createEmitAndSemanticDiagnosticsBuilderProgram,
+ createEmitHelperFactory: () => createEmitHelperFactory,
+ createEmptyExports: () => createEmptyExports,
+ createExpressionForJsxElement: () => createExpressionForJsxElement,
+ createExpressionForJsxFragment: () => createExpressionForJsxFragment,
+ createExpressionForObjectLiteralElementLike: () => createExpressionForObjectLiteralElementLike,
+ createExpressionForPropertyName: () => createExpressionForPropertyName,
+ createExpressionFromEntityName: () => createExpressionFromEntityName,
+ createExternalHelpersImportDeclarationIfNeeded: () => createExternalHelpersImportDeclarationIfNeeded,
+ createFileDiagnostic: () => createFileDiagnostic,
+ createFileDiagnosticFromMessageChain: () => createFileDiagnosticFromMessageChain,
+ createForOfBindingStatement: () => createForOfBindingStatement,
+ createGetCanonicalFileName: () => createGetCanonicalFileName,
+ createGetSourceFile: () => createGetSourceFile,
+ createGetSymbolAccessibilityDiagnosticForNode: () => createGetSymbolAccessibilityDiagnosticForNode,
+ createGetSymbolAccessibilityDiagnosticForNodeName: () => createGetSymbolAccessibilityDiagnosticForNodeName,
+ createGetSymbolWalker: () => createGetSymbolWalker,
+ createIncrementalCompilerHost: () => createIncrementalCompilerHost,
+ createIncrementalProgram: () => createIncrementalProgram,
+ createInputFiles: () => createInputFiles,
+ createInputFilesWithFilePaths: () => createInputFilesWithFilePaths,
+ createInputFilesWithFileTexts: () => createInputFilesWithFileTexts,
+ createJsxFactoryExpression: () => createJsxFactoryExpression,
+ createLanguageService: () => createLanguageService,
+ createLanguageServiceSourceFile: () => createLanguageServiceSourceFile,
+ createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
+ createModeAwareCache: () => createModeAwareCache,
+ createModeAwareCacheKey: () => createModeAwareCacheKey,
+ createModuleResolutionCache: () => createModuleResolutionCache,
+ createModuleResolutionLoader: () => createModuleResolutionLoader,
+ createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
+ createMultiMap: () => createMultiMap,
+ createNodeConverters: () => createNodeConverters,
+ createNodeFactory: () => createNodeFactory,
+ createOptionNameMap: () => createOptionNameMap,
+ createOverload: () => createOverload,
+ createPackageJsonImportFilter: () => createPackageJsonImportFilter,
+ createPackageJsonInfo: () => createPackageJsonInfo,
+ createParenthesizerRules: () => createParenthesizerRules,
+ createPatternMatcher: () => createPatternMatcher,
+ createPrependNodes: () => createPrependNodes,
+ createPrinter: () => createPrinter,
+ createPrinterWithDefaults: () => createPrinterWithDefaults,
+ createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
+ createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
+ createProgram: () => createProgram,
+ createProgramHost: () => createProgramHost,
+ createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
+ createQueue: () => createQueue,
+ createRange: () => createRange,
+ createRedirectedBuilderProgram: () => createRedirectedBuilderProgram,
+ createResolutionCache: () => createResolutionCache,
+ createRuntimeTypeSerializer: () => createRuntimeTypeSerializer,
+ createScanner: () => createScanner,
+ createSemanticDiagnosticsBuilderProgram: () => createSemanticDiagnosticsBuilderProgram,
+ createSet: () => createSet,
+ createSolutionBuilder: () => createSolutionBuilder,
+ createSolutionBuilderHost: () => createSolutionBuilderHost,
+ createSolutionBuilderWithWatch: () => createSolutionBuilderWithWatch,
+ createSolutionBuilderWithWatchHost: () => createSolutionBuilderWithWatchHost,
+ createSortedArray: () => createSortedArray,
+ createSourceFile: () => createSourceFile,
+ createSourceMapGenerator: () => createSourceMapGenerator,
+ createSourceMapSource: () => createSourceMapSource,
+ createSuperAccessVariableStatement: () => createSuperAccessVariableStatement,
+ createSymbolTable: () => createSymbolTable,
+ createSymlinkCache: () => createSymlinkCache,
+ createSystemWatchFunctions: () => createSystemWatchFunctions,
+ createTextChange: () => createTextChange,
+ createTextChangeFromStartLength: () => createTextChangeFromStartLength,
+ createTextChangeRange: () => createTextChangeRange,
+ createTextRangeFromNode: () => createTextRangeFromNode,
+ createTextRangeFromSpan: () => createTextRangeFromSpan,
+ createTextSpan: () => createTextSpan,
+ createTextSpanFromBounds: () => createTextSpanFromBounds,
+ createTextSpanFromNode: () => createTextSpanFromNode,
+ createTextSpanFromRange: () => createTextSpanFromRange,
+ createTextSpanFromStringLiteralLikeContent: () => createTextSpanFromStringLiteralLikeContent,
+ createTextWriter: () => createTextWriter,
+ createTokenRange: () => createTokenRange,
+ createTypeChecker: () => createTypeChecker,
+ createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
+ createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
+ createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
+ createUnparsedSourceFile: () => createUnparsedSourceFile,
+ createWatchCompilerHost: () => createWatchCompilerHost2,
+ createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
+ createWatchCompilerHostOfFilesAndCompilerOptions: () => createWatchCompilerHostOfFilesAndCompilerOptions,
+ createWatchFactory: () => createWatchFactory,
+ createWatchHost: () => createWatchHost,
+ createWatchProgram: () => createWatchProgram,
+ createWatchStatusReporter: () => createWatchStatusReporter,
+ createWriteFileMeasuringIO: () => createWriteFileMeasuringIO,
+ declarationNameToString: () => declarationNameToString,
+ decodeMappings: () => decodeMappings,
+ decodedTextSpanIntersectsWith: () => decodedTextSpanIntersectsWith,
+ decorateHelper: () => decorateHelper,
+ deduplicate: () => deduplicate,
+ defaultIncludeSpec: () => defaultIncludeSpec,
+ defaultInitCompilerOptions: () => defaultInitCompilerOptions,
+ defaultMaximumTruncationLength: () => defaultMaximumTruncationLength,
+ detectSortCaseSensitivity: () => detectSortCaseSensitivity,
+ diagnosticCategoryName: () => diagnosticCategoryName,
+ diagnosticToString: () => diagnosticToString,
+ directoryProbablyExists: () => directoryProbablyExists,
+ directorySeparator: () => directorySeparator,
+ displayPart: () => displayPart,
+ displayPartsToString: () => displayPartsToString,
+ disposeEmitNodes: () => disposeEmitNodes,
+ documentSpansEqual: () => documentSpansEqual,
+ dumpTracingLegend: () => dumpTracingLegend,
+ elementAt: () => elementAt,
+ elideNodes: () => elideNodes,
+ emitComments: () => emitComments,
+ emitDetachedComments: () => emitDetachedComments,
+ emitFiles: () => emitFiles,
+ emitFilesAndReportErrors: () => emitFilesAndReportErrors,
+ emitFilesAndReportErrorsAndGetExitStatus: () => emitFilesAndReportErrorsAndGetExitStatus,
+ emitModuleKindIsNonNodeESM: () => emitModuleKindIsNonNodeESM,
+ emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
+ emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
+ emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
+ emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
+ emitUsingBuildInfo: () => emitUsingBuildInfo,
+ emptyArray: () => emptyArray,
+ emptyFileSystemEntries: () => emptyFileSystemEntries,
+ emptyMap: () => emptyMap,
+ emptyOptions: () => emptyOptions,
+ emptySet: () => emptySet,
+ endsWith: () => endsWith,
+ ensurePathIsNonModuleName: () => ensurePathIsNonModuleName,
+ ensureScriptKind: () => ensureScriptKind,
+ ensureTrailingDirectorySeparator: () => ensureTrailingDirectorySeparator,
+ entityNameToString: () => entityNameToString,
+ enumerateInsertsAndDeletes: () => enumerateInsertsAndDeletes,
+ equalOwnProperties: () => equalOwnProperties,
+ equateStringsCaseInsensitive: () => equateStringsCaseInsensitive,
+ equateStringsCaseSensitive: () => equateStringsCaseSensitive,
+ equateValues: () => equateValues,
+ esDecorateHelper: () => esDecorateHelper,
+ escapeJsxAttributeString: () => escapeJsxAttributeString,
+ escapeLeadingUnderscores: () => escapeLeadingUnderscores,
+ escapeNonAsciiString: () => escapeNonAsciiString,
+ escapeSnippetText: () => escapeSnippetText,
+ escapeString: () => escapeString,
+ every: () => every,
+ expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
+ explainFiles: () => explainFiles,
+ explainIfFileIsRedirectAndImpliedFormat: () => explainIfFileIsRedirectAndImpliedFormat,
+ exportAssignmentIsAlias: () => exportAssignmentIsAlias,
+ exportStarHelper: () => exportStarHelper,
+ expressionResultIsUnused: () => expressionResultIsUnused,
+ extend: () => extend,
+ extendsHelper: () => extendsHelper,
+ extensionFromPath: () => extensionFromPath,
+ extensionIsTS: () => extensionIsTS,
+ externalHelpersModuleNameText: () => externalHelpersModuleNameText,
+ factory: () => factory,
+ fileExtensionIs: () => fileExtensionIs,
+ fileExtensionIsOneOf: () => fileExtensionIsOneOf,
+ fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics,
+ filter: () => filter,
+ filterMutate: () => filterMutate,
+ filterSemanticDiagnostics: () => filterSemanticDiagnostics,
+ find: () => find,
+ findAncestor: () => findAncestor,
+ findBestPatternMatch: () => findBestPatternMatch,
+ findChildOfKind: () => findChildOfKind,
+ findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
+ findConfigFile: () => findConfigFile,
+ findContainingList: () => findContainingList,
+ findDiagnosticForNode: () => findDiagnosticForNode,
+ findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
+ findIndex: () => findIndex,
+ findLast: () => findLast,
+ findLastIndex: () => findLastIndex,
+ findListItemInfo: () => findListItemInfo,
+ findMap: () => findMap,
+ findModifier: () => findModifier,
+ findNextToken: () => findNextToken,
+ findPackageJson: () => findPackageJson,
+ findPackageJsons: () => findPackageJsons,
+ findPrecedingMatchingToken: () => findPrecedingMatchingToken,
+ findPrecedingToken: () => findPrecedingToken,
+ findSuperStatementIndex: () => findSuperStatementIndex,
+ findTokenOnLeftOfPosition: () => findTokenOnLeftOfPosition,
+ findUseStrictPrologue: () => findUseStrictPrologue,
+ first: () => first,
+ firstDefined: () => firstDefined,
+ firstDefinedIterator: () => firstDefinedIterator,
+ firstIterator: () => firstIterator,
+ firstOrOnly: () => firstOrOnly,
+ firstOrUndefined: () => firstOrUndefined,
+ firstOrUndefinedIterator: () => firstOrUndefinedIterator,
+ fixupCompilerOptions: () => fixupCompilerOptions,
+ flatMap: () => flatMap,
+ flatMapIterator: () => flatMapIterator,
+ flatMapToMutable: () => flatMapToMutable,
+ flatten: () => flatten,
+ flattenCommaList: () => flattenCommaList,
+ flattenDestructuringAssignment: () => flattenDestructuringAssignment,
+ flattenDestructuringBinding: () => flattenDestructuringBinding,
+ flattenDiagnosticMessageText: () => flattenDiagnosticMessageText,
+ forEach: () => forEach,
+ forEachAncestor: () => forEachAncestor,
+ forEachAncestorDirectory: () => forEachAncestorDirectory,
+ forEachChild: () => forEachChild,
+ forEachChildRecursively: () => forEachChildRecursively,
+ forEachEmittedFile: () => forEachEmittedFile,
+ forEachEnclosingBlockScopeContainer: () => forEachEnclosingBlockScopeContainer,
+ forEachEntry: () => forEachEntry,
+ forEachExternalModuleToImportFrom: () => forEachExternalModuleToImportFrom,
+ forEachImportClauseDeclaration: () => forEachImportClauseDeclaration,
+ forEachKey: () => forEachKey,
+ forEachLeadingCommentRange: () => forEachLeadingCommentRange,
+ forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
+ forEachResolvedProjectReference: () => forEachResolvedProjectReference,
+ forEachReturnStatement: () => forEachReturnStatement,
+ forEachRight: () => forEachRight,
+ forEachTrailingCommentRange: () => forEachTrailingCommentRange,
+ forEachUnique: () => forEachUnique,
+ forEachYieldExpression: () => forEachYieldExpression,
+ forSomeAncestorDirectory: () => forSomeAncestorDirectory,
+ formatColorAndReset: () => formatColorAndReset,
+ formatDiagnostic: () => formatDiagnostic,
+ formatDiagnostics: () => formatDiagnostics,
+ formatDiagnosticsWithColorAndContext: () => formatDiagnosticsWithColorAndContext,
+ formatGeneratedName: () => formatGeneratedName,
+ formatGeneratedNamePart: () => formatGeneratedNamePart,
+ formatLocation: () => formatLocation,
+ formatMessage: () => formatMessage,
+ formatStringFromArgs: () => formatStringFromArgs,
+ formatting: () => ts_formatting_exports,
+ fullTripleSlashAMDReferencePathRegEx: () => fullTripleSlashAMDReferencePathRegEx,
+ fullTripleSlashReferencePathRegEx: () => fullTripleSlashReferencePathRegEx,
+ generateDjb2Hash: () => generateDjb2Hash,
+ generateTSConfig: () => generateTSConfig,
+ generatorHelper: () => generatorHelper,
+ getAdjustedReferenceLocation: () => getAdjustedReferenceLocation,
+ getAdjustedRenameLocation: () => getAdjustedRenameLocation,
+ getAliasDeclarationFromName: () => getAliasDeclarationFromName,
+ getAllAccessorDeclarations: () => getAllAccessorDeclarations,
+ getAllDecoratorsOfClass: () => getAllDecoratorsOfClass,
+ getAllDecoratorsOfClassElement: () => getAllDecoratorsOfClassElement,
+ getAllJSDocTags: () => getAllJSDocTags,
+ getAllJSDocTagsOfKind: () => getAllJSDocTagsOfKind,
+ getAllKeys: () => getAllKeys,
+ getAllProjectOutputs: () => getAllProjectOutputs,
+ getAllSuperTypeNodes: () => getAllSuperTypeNodes,
+ getAllUnscopedEmitHelpers: () => getAllUnscopedEmitHelpers,
+ getAllowJSCompilerOption: () => getAllowJSCompilerOption,
+ getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
+ getAncestor: () => getAncestor,
+ getAnyExtensionFromPath: () => getAnyExtensionFromPath,
+ getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled,
+ getAssignedExpandoInitializer: () => getAssignedExpandoInitializer,
+ getAssignedName: () => getAssignedName,
+ getAssignmentDeclarationKind: () => getAssignmentDeclarationKind,
+ getAssignmentDeclarationPropertyAccessKind: () => getAssignmentDeclarationPropertyAccessKind,
+ getAssignmentTargetKind: () => getAssignmentTargetKind,
+ getAutomaticTypeDirectiveNames: () => getAutomaticTypeDirectiveNames,
+ getBaseFileName: () => getBaseFileName,
+ getBinaryOperatorPrecedence: () => getBinaryOperatorPrecedence,
+ getBuildInfo: () => getBuildInfo,
+ getBuildInfoFileVersionMap: () => getBuildInfoFileVersionMap,
+ getBuildInfoText: () => getBuildInfoText,
+ getBuildOrderFromAnyBuildOrder: () => getBuildOrderFromAnyBuildOrder,
+ getBuilderCreationParameters: () => getBuilderCreationParameters,
+ getBuilderFileEmit: () => getBuilderFileEmit,
+ getCheckFlags: () => getCheckFlags,
+ getClassExtendsHeritageElement: () => getClassExtendsHeritageElement,
+ getClassLikeDeclarationOfSymbol: () => getClassLikeDeclarationOfSymbol,
+ getCombinedLocalAndExportSymbolFlags: () => getCombinedLocalAndExportSymbolFlags,
+ getCombinedModifierFlags: () => getCombinedModifierFlags,
+ getCombinedNodeFlags: () => getCombinedNodeFlags,
+ getCombinedNodeFlagsAlwaysIncludeJSDoc: () => getCombinedNodeFlagsAlwaysIncludeJSDoc,
+ getCommentRange: () => getCommentRange,
+ getCommonSourceDirectory: () => getCommonSourceDirectory,
+ getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig,
+ getCompilerOptionValue: () => getCompilerOptionValue,
+ getCompilerOptionsDiffValue: () => getCompilerOptionsDiffValue,
+ getConditions: () => getConditions,
+ getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics,
+ getConstantValue: () => getConstantValue,
+ getContainerNode: () => getContainerNode,
+ getContainingClass: () => getContainingClass,
+ getContainingClassStaticBlock: () => getContainingClassStaticBlock,
+ getContainingFunction: () => getContainingFunction,
+ getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
+ getContainingFunctionOrClassStaticBlock: () => getContainingFunctionOrClassStaticBlock,
+ getContainingNodeArray: () => getContainingNodeArray,
+ getContainingObjectLiteralElement: () => getContainingObjectLiteralElement,
+ getContextualTypeFromParent: () => getContextualTypeFromParent,
+ getContextualTypeFromParentOrAncestorTypeNode: () => getContextualTypeFromParentOrAncestorTypeNode,
+ getCurrentTime: () => getCurrentTime,
+ getDeclarationDiagnostics: () => getDeclarationDiagnostics,
+ getDeclarationEmitExtensionForPath: () => getDeclarationEmitExtensionForPath,
+ getDeclarationEmitOutputFilePath: () => getDeclarationEmitOutputFilePath,
+ getDeclarationEmitOutputFilePathWorker: () => getDeclarationEmitOutputFilePathWorker,
+ getDeclarationFromName: () => getDeclarationFromName,
+ getDeclarationModifierFlagsFromSymbol: () => getDeclarationModifierFlagsFromSymbol,
+ getDeclarationOfKind: () => getDeclarationOfKind,
+ getDeclarationsOfKind: () => getDeclarationsOfKind,
+ getDeclaredExpandoInitializer: () => getDeclaredExpandoInitializer,
+ getDecorators: () => getDecorators,
+ getDefaultCompilerOptions: () => getDefaultCompilerOptions2,
+ getDefaultExportInfoWorker: () => getDefaultExportInfoWorker,
+ getDefaultFormatCodeSettings: () => getDefaultFormatCodeSettings,
+ getDefaultLibFileName: () => getDefaultLibFileName,
+ getDefaultLibFilePath: () => getDefaultLibFilePath,
+ getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
+ getDiagnosticText: () => getDiagnosticText,
+ getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
+ getDirectoryPath: () => getDirectoryPath,
+ getDocumentPositionMapper: () => getDocumentPositionMapper,
+ getESModuleInterop: () => getESModuleInterop,
+ getEditsForFileRename: () => getEditsForFileRename,
+ getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
+ getEffectiveConstraintOfTypeParameter: () => getEffectiveConstraintOfTypeParameter,
+ getEffectiveContainerForJSDocTemplateTag: () => getEffectiveContainerForJSDocTemplateTag,
+ getEffectiveImplementsTypeNodes: () => getEffectiveImplementsTypeNodes,
+ getEffectiveInitializer: () => getEffectiveInitializer,
+ getEffectiveJSDocHost: () => getEffectiveJSDocHost,
+ getEffectiveModifierFlags: () => getEffectiveModifierFlags,
+ getEffectiveModifierFlagsAlwaysIncludeJSDoc: () => getEffectiveModifierFlagsAlwaysIncludeJSDoc,
+ getEffectiveModifierFlagsNoCache: () => getEffectiveModifierFlagsNoCache,
+ getEffectiveReturnTypeNode: () => getEffectiveReturnTypeNode,
+ getEffectiveSetAccessorTypeAnnotationNode: () => getEffectiveSetAccessorTypeAnnotationNode,
+ getEffectiveTypeAnnotationNode: () => getEffectiveTypeAnnotationNode,
+ getEffectiveTypeParameterDeclarations: () => getEffectiveTypeParameterDeclarations,
+ getEffectiveTypeRoots: () => getEffectiveTypeRoots,
+ getElementOrPropertyAccessArgumentExpressionOrName: () => getElementOrPropertyAccessArgumentExpressionOrName,
+ getElementOrPropertyAccessName: () => getElementOrPropertyAccessName,
+ getElementsOfBindingOrAssignmentPattern: () => getElementsOfBindingOrAssignmentPattern,
+ getEmitDeclarations: () => getEmitDeclarations,
+ getEmitFlags: () => getEmitFlags,
+ getEmitHelpers: () => getEmitHelpers,
+ getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
+ getEmitModuleKind: () => getEmitModuleKind,
+ getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
+ getEmitScriptTarget: () => getEmitScriptTarget,
+ getEnclosingBlockScopeContainer: () => getEnclosingBlockScopeContainer,
+ getEncodedSemanticClassifications: () => getEncodedSemanticClassifications,
+ getEncodedSyntacticClassifications: () => getEncodedSyntacticClassifications,
+ getEndLinePosition: () => getEndLinePosition,
+ getEntityNameFromTypeNode: () => getEntityNameFromTypeNode,
+ getEntrypointsFromPackageJsonInfo: () => getEntrypointsFromPackageJsonInfo,
+ getErrorCountForSummary: () => getErrorCountForSummary,
+ getErrorSpanForNode: () => getErrorSpanForNode,
+ getErrorSummaryText: () => getErrorSummaryText,
+ getEscapedTextOfIdentifierOrLiteral: () => getEscapedTextOfIdentifierOrLiteral,
+ getExpandoInitializer: () => getExpandoInitializer,
+ getExportAssignmentExpression: () => getExportAssignmentExpression,
+ getExportInfoMap: () => getExportInfoMap,
+ getExportNeedsImportStarHelper: () => getExportNeedsImportStarHelper,
+ getExpressionAssociativity: () => getExpressionAssociativity,
+ getExpressionPrecedence: () => getExpressionPrecedence,
+ getExternalHelpersModuleName: () => getExternalHelpersModuleName,
+ getExternalModuleImportEqualsDeclarationExpression: () => getExternalModuleImportEqualsDeclarationExpression,
+ getExternalModuleName: () => getExternalModuleName,
+ getExternalModuleNameFromDeclaration: () => getExternalModuleNameFromDeclaration,
+ getExternalModuleNameFromPath: () => getExternalModuleNameFromPath,
+ getExternalModuleNameLiteral: () => getExternalModuleNameLiteral,
+ getExternalModuleRequireArgument: () => getExternalModuleRequireArgument,
+ getFallbackOptions: () => getFallbackOptions,
+ getFileEmitOutput: () => getFileEmitOutput,
+ getFileMatcherPatterns: () => getFileMatcherPatterns,
+ getFileNamesFromConfigSpecs: () => getFileNamesFromConfigSpecs,
+ getFileWatcherEventKind: () => getFileWatcherEventKind,
+ getFilesInErrorForSummary: () => getFilesInErrorForSummary,
+ getFirstConstructorWithBody: () => getFirstConstructorWithBody,
+ getFirstIdentifier: () => getFirstIdentifier,
+ getFirstNonSpaceCharacterPosition: () => getFirstNonSpaceCharacterPosition,
+ getFirstProjectOutput: () => getFirstProjectOutput,
+ getFixableErrorSpanExpression: () => getFixableErrorSpanExpression,
+ getFormatCodeSettingsForWriting: () => getFormatCodeSettingsForWriting,
+ getFullWidth: () => getFullWidth,
+ getFunctionFlags: () => getFunctionFlags,
+ getHeritageClause: () => getHeritageClause,
+ getHostSignatureFromJSDoc: () => getHostSignatureFromJSDoc,
+ getIdentifierAutoGenerate: () => getIdentifierAutoGenerate,
+ getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
+ getIdentifierTypeArguments: () => getIdentifierTypeArguments,
+ getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
+ getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
+ getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
+ getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
+ getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
+ getIndentSize: () => getIndentSize,
+ getIndentString: () => getIndentString,
+ getInitializedVariables: () => getInitializedVariables,
+ getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
+ getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
+ getInterfaceBaseTypeNodes: () => getInterfaceBaseTypeNodes,
+ getInternalEmitFlags: () => getInternalEmitFlags,
+ getInvokedExpression: () => getInvokedExpression,
+ getIsolatedModules: () => getIsolatedModules,
+ getJSDocAugmentsTag: () => getJSDocAugmentsTag,
+ getJSDocClassTag: () => getJSDocClassTag,
+ getJSDocCommentRanges: () => getJSDocCommentRanges,
+ getJSDocCommentsAndTags: () => getJSDocCommentsAndTags,
+ getJSDocDeprecatedTag: () => getJSDocDeprecatedTag,
+ getJSDocDeprecatedTagNoCache: () => getJSDocDeprecatedTagNoCache,
+ getJSDocEnumTag: () => getJSDocEnumTag,
+ getJSDocHost: () => getJSDocHost,
+ getJSDocImplementsTags: () => getJSDocImplementsTags,
+ getJSDocOverrideTagNoCache: () => getJSDocOverrideTagNoCache,
+ getJSDocParameterTags: () => getJSDocParameterTags,
+ getJSDocParameterTagsNoCache: () => getJSDocParameterTagsNoCache,
+ getJSDocPrivateTag: () => getJSDocPrivateTag,
+ getJSDocPrivateTagNoCache: () => getJSDocPrivateTagNoCache,
+ getJSDocProtectedTag: () => getJSDocProtectedTag,
+ getJSDocProtectedTagNoCache: () => getJSDocProtectedTagNoCache,
+ getJSDocPublicTag: () => getJSDocPublicTag,
+ getJSDocPublicTagNoCache: () => getJSDocPublicTagNoCache,
+ getJSDocReadonlyTag: () => getJSDocReadonlyTag,
+ getJSDocReadonlyTagNoCache: () => getJSDocReadonlyTagNoCache,
+ getJSDocReturnTag: () => getJSDocReturnTag,
+ getJSDocReturnType: () => getJSDocReturnType,
+ getJSDocRoot: () => getJSDocRoot,
+ getJSDocSatisfiesExpressionType: () => getJSDocSatisfiesExpressionType,
+ getJSDocSatisfiesTag: () => getJSDocSatisfiesTag,
+ getJSDocTags: () => getJSDocTags,
+ getJSDocTagsNoCache: () => getJSDocTagsNoCache,
+ getJSDocTemplateTag: () => getJSDocTemplateTag,
+ getJSDocThisTag: () => getJSDocThisTag,
+ getJSDocType: () => getJSDocType,
+ getJSDocTypeAliasName: () => getJSDocTypeAliasName,
+ getJSDocTypeAssertionType: () => getJSDocTypeAssertionType,
+ getJSDocTypeParameterDeclarations: () => getJSDocTypeParameterDeclarations,
+ getJSDocTypeParameterTags: () => getJSDocTypeParameterTags,
+ getJSDocTypeParameterTagsNoCache: () => getJSDocTypeParameterTagsNoCache,
+ getJSDocTypeTag: () => getJSDocTypeTag,
+ getJSXImplicitImportBase: () => getJSXImplicitImportBase,
+ getJSXRuntimeImport: () => getJSXRuntimeImport,
+ getJSXTransformEnabled: () => getJSXTransformEnabled,
+ getKeyForCompilerOptions: () => getKeyForCompilerOptions,
+ getLanguageVariant: () => getLanguageVariant,
+ getLastChild: () => getLastChild,
+ getLeadingCommentRanges: () => getLeadingCommentRanges,
+ getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
+ getLeftmostAccessExpression: () => getLeftmostAccessExpression,
+ getLeftmostExpression: () => getLeftmostExpression,
+ getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
+ getLineInfo: () => getLineInfo,
+ getLineOfLocalPosition: () => getLineOfLocalPosition,
+ getLineOfLocalPositionFromLineMap: () => getLineOfLocalPositionFromLineMap,
+ getLineStartPositionForPosition: () => getLineStartPositionForPosition,
+ getLineStarts: () => getLineStarts,
+ getLinesBetweenPositionAndNextNonWhitespaceCharacter: () => getLinesBetweenPositionAndNextNonWhitespaceCharacter,
+ getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter: () => getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter,
+ getLinesBetweenPositions: () => getLinesBetweenPositions,
+ getLinesBetweenRangeEndAndRangeStart: () => getLinesBetweenRangeEndAndRangeStart,
+ getLinesBetweenRangeEndPositions: () => getLinesBetweenRangeEndPositions,
+ getLiteralText: () => getLiteralText,
+ getLocalNameForExternalImport: () => getLocalNameForExternalImport,
+ getLocalSymbolForExportDefault: () => getLocalSymbolForExportDefault,
+ getLocaleSpecificMessage: () => getLocaleSpecificMessage,
+ getLocaleTimeString: () => getLocaleTimeString,
+ getMappedContextSpan: () => getMappedContextSpan,
+ getMappedDocumentSpan: () => getMappedDocumentSpan,
+ getMappedLocation: () => getMappedLocation,
+ getMatchedFileSpec: () => getMatchedFileSpec,
+ getMatchedIncludeSpec: () => getMatchedIncludeSpec,
+ getMeaningFromDeclaration: () => getMeaningFromDeclaration,
+ getMeaningFromLocation: () => getMeaningFromLocation,
+ getMembersOfDeclaration: () => getMembersOfDeclaration,
+ getModeForFileReference: () => getModeForFileReference,
+ getModeForResolutionAtIndex: () => getModeForResolutionAtIndex,
+ getModeForUsageLocation: () => getModeForUsageLocation,
+ getModifiedTime: () => getModifiedTime,
+ getModifiers: () => getModifiers,
+ getModuleInstanceState: () => getModuleInstanceState,
+ getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt,
+ getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
+ getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
+ getNameForExportedSymbol: () => getNameForExportedSymbol,
+ getNameFromIndexInfo: () => getNameFromIndexInfo,
+ getNameFromPropertyName: () => getNameFromPropertyName,
+ getNameOfAccessExpression: () => getNameOfAccessExpression,
+ getNameOfCompilerOptionValue: () => getNameOfCompilerOptionValue,
+ getNameOfDeclaration: () => getNameOfDeclaration,
+ getNameOfExpando: () => getNameOfExpando,
+ getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
+ getNameOrArgument: () => getNameOrArgument,
+ getNameTable: () => getNameTable,
+ getNamesForExportedSymbol: () => getNamesForExportedSymbol,
+ getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
+ getNewLineCharacter: () => getNewLineCharacter,
+ getNewLineKind: () => getNewLineKind,
+ getNewLineOrDefaultFromHost: () => getNewLineOrDefaultFromHost,
+ getNewTargetContainer: () => getNewTargetContainer,
+ getNextJSDocCommentLocation: () => getNextJSDocCommentLocation,
+ getNodeForGeneratedName: () => getNodeForGeneratedName,
+ getNodeId: () => getNodeId,
+ getNodeKind: () => getNodeKind,
+ getNodeMajorVersion: () => getNodeMajorVersion,
+ getNodeModifiers: () => getNodeModifiers,
+ getNodeModulePathParts: () => getNodeModulePathParts,
+ getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
+ getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
+ getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
+ getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
+ getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
+ getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
+ getNormalizedPathComponents: () => getNormalizedPathComponents,
+ getObjectFlags: () => getObjectFlags,
+ getOperator: () => getOperator,
+ getOperatorAssociativity: () => getOperatorAssociativity,
+ getOperatorPrecedence: () => getOperatorPrecedence,
+ getOptionFromName: () => getOptionFromName,
+ getOptionsNameMap: () => getOptionsNameMap,
+ getOrCreateEmitNode: () => getOrCreateEmitNode,
+ getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
+ getOrUpdate: () => getOrUpdate,
+ getOriginalNode: () => getOriginalNode,
+ getOriginalNodeId: () => getOriginalNodeId,
+ getOriginalSourceFile: () => getOriginalSourceFile,
+ getOutputDeclarationFileName: () => getOutputDeclarationFileName,
+ getOutputExtension: () => getOutputExtension,
+ getOutputFileNames: () => getOutputFileNames,
+ getOutputPathsFor: () => getOutputPathsFor,
+ getOutputPathsForBundle: () => getOutputPathsForBundle,
+ getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
+ getOwnKeys: () => getOwnKeys,
+ getOwnValues: () => getOwnValues,
+ getPackageJsonInfo: () => getPackageJsonInfo,
+ getPackageJsonTypesVersionsPaths: () => getPackageJsonTypesVersionsPaths,
+ getPackageJsonsVisibleToFile: () => getPackageJsonsVisibleToFile,
+ getPackageNameFromTypesPackageName: () => getPackageNameFromTypesPackageName,
+ getPackageScopeForPath: () => getPackageScopeForPath,
+ getParameterSymbolFromJSDoc: () => getParameterSymbolFromJSDoc,
+ getParameterTypeNode: () => getParameterTypeNode,
+ getParentNodeInSpan: () => getParentNodeInSpan,
+ getParseTreeNode: () => getParseTreeNode,
+ getParsedCommandLineOfConfigFile: () => getParsedCommandLineOfConfigFile,
+ getPathComponents: () => getPathComponents,
+ getPathComponentsRelativeTo: () => getPathComponentsRelativeTo,
+ getPathFromPathComponents: () => getPathFromPathComponents,
+ getPathUpdater: () => getPathUpdater,
+ getPathsBasePath: () => getPathsBasePath,
+ getPatternFromSpec: () => getPatternFromSpec,
+ getPendingEmitKind: () => getPendingEmitKind,
+ getPositionOfLineAndCharacter: () => getPositionOfLineAndCharacter,
+ getPossibleGenericSignatures: () => getPossibleGenericSignatures,
+ getPossibleOriginalInputExtensionForExtension: () => getPossibleOriginalInputExtensionForExtension,
+ getPossibleTypeArgumentsInfo: () => getPossibleTypeArgumentsInfo,
+ getPreEmitDiagnostics: () => getPreEmitDiagnostics,
+ getPrecedingNonSpaceCharacterPosition: () => getPrecedingNonSpaceCharacterPosition,
+ getPrivateIdentifier: () => getPrivateIdentifier,
+ getProperties: () => getProperties,
+ getProperty: () => getProperty,
+ getPropertyArrayElementValue: () => getPropertyArrayElementValue,
+ getPropertyAssignment: () => getPropertyAssignment,
+ getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
+ getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
+ getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
+ getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
+ getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
+ getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
+ getQuoteFromPreference: () => getQuoteFromPreference,
+ getQuotePreference: () => getQuotePreference,
+ getRangesWhere: () => getRangesWhere,
+ getRefactorContextSpan: () => getRefactorContextSpan,
+ getReferencedFileLocation: () => getReferencedFileLocation,
+ getRegexFromPattern: () => getRegexFromPattern,
+ getRegularExpressionForWildcard: () => getRegularExpressionForWildcard,
+ getRegularExpressionsForWildcards: () => getRegularExpressionsForWildcards,
+ getRelativePathFromDirectory: () => getRelativePathFromDirectory,
+ getRelativePathFromFile: () => getRelativePathFromFile,
+ getRelativePathToDirectoryOrUrl: () => getRelativePathToDirectoryOrUrl,
+ getRenameLocation: () => getRenameLocation,
+ getReplacementSpanForContextToken: () => getReplacementSpanForContextToken,
+ getResolutionDiagnostic: () => getResolutionDiagnostic,
+ getResolutionModeOverrideForClause: () => getResolutionModeOverrideForClause,
+ getResolveJsonModule: () => getResolveJsonModule,
+ getResolvePackageJsonExports: () => getResolvePackageJsonExports,
+ getResolvePackageJsonImports: () => getResolvePackageJsonImports,
+ getResolvedExternalModuleName: () => getResolvedExternalModuleName,
+ getResolvedModule: () => getResolvedModule,
+ getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
+ getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
+ getRestParameterElementType: () => getRestParameterElementType,
+ getRightMostAssignedExpression: () => getRightMostAssignedExpression,
+ getRootDeclaration: () => getRootDeclaration,
+ getRootLength: () => getRootLength,
+ getScriptKind: () => getScriptKind,
+ getScriptKindFromFileName: () => getScriptKindFromFileName,
+ getScriptTargetFeatures: () => getScriptTargetFeatures,
+ getSelectedEffectiveModifierFlags: () => getSelectedEffectiveModifierFlags,
+ getSelectedSyntacticModifierFlags: () => getSelectedSyntacticModifierFlags,
+ getSemanticClassifications: () => getSemanticClassifications,
+ getSemanticJsxChildren: () => getSemanticJsxChildren,
+ getSetAccessorTypeAnnotationNode: () => getSetAccessorTypeAnnotationNode,
+ getSetAccessorValueParameter: () => getSetAccessorValueParameter,
+ getSetExternalModuleIndicator: () => getSetExternalModuleIndicator,
+ getShebang: () => getShebang,
+ getSingleInitializerOfVariableStatementOrPropertyDeclaration: () => getSingleInitializerOfVariableStatementOrPropertyDeclaration,
+ getSingleVariableOfVariableStatement: () => getSingleVariableOfVariableStatement,
+ getSnapshotText: () => getSnapshotText,
+ getSnippetElement: () => getSnippetElement,
+ getSourceFileOfModule: () => getSourceFileOfModule,
+ getSourceFileOfNode: () => getSourceFileOfNode,
+ getSourceFilePathInNewDir: () => getSourceFilePathInNewDir,
+ getSourceFilePathInNewDirWorker: () => getSourceFilePathInNewDirWorker,
+ getSourceFileVersionAsHashFromText: () => getSourceFileVersionAsHashFromText,
+ getSourceFilesToEmit: () => getSourceFilesToEmit,
+ getSourceMapRange: () => getSourceMapRange,
+ getSourceMapper: () => getSourceMapper,
+ getSourceTextOfNodeFromSourceFile: () => getSourceTextOfNodeFromSourceFile,
+ getSpanOfTokenAtPosition: () => getSpanOfTokenAtPosition,
+ getSpellingSuggestion: () => getSpellingSuggestion,
+ getStartPositionOfLine: () => getStartPositionOfLine,
+ getStartPositionOfRange: () => getStartPositionOfRange,
+ getStartsOnNewLine: () => getStartsOnNewLine,
+ getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
+ getStrictOptionValue: () => getStrictOptionValue,
+ getStringComparer: () => getStringComparer,
+ getSuperCallFromStatement: () => getSuperCallFromStatement,
+ getSuperContainer: () => getSuperContainer,
+ getSupportedCodeFixes: () => getSupportedCodeFixes,
+ getSupportedExtensions: () => getSupportedExtensions,
+ getSupportedExtensionsWithJsonIfResolveJsonModule: () => getSupportedExtensionsWithJsonIfResolveJsonModule,
+ getSwitchedType: () => getSwitchedType,
+ getSymbolId: () => getSymbolId,
+ getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
+ getSymbolTarget: () => getSymbolTarget,
+ getSyntacticClassifications: () => getSyntacticClassifications,
+ getSyntacticModifierFlags: () => getSyntacticModifierFlags,
+ getSyntacticModifierFlagsNoCache: () => getSyntacticModifierFlagsNoCache,
+ getSynthesizedDeepClone: () => getSynthesizedDeepClone,
+ getSynthesizedDeepCloneWithReplacements: () => getSynthesizedDeepCloneWithReplacements,
+ getSynthesizedDeepClones: () => getSynthesizedDeepClones,
+ getSynthesizedDeepClonesWithReplacements: () => getSynthesizedDeepClonesWithReplacements,
+ getSyntheticLeadingComments: () => getSyntheticLeadingComments,
+ getSyntheticTrailingComments: () => getSyntheticTrailingComments,
+ getTargetLabel: () => getTargetLabel,
+ getTargetOfBindingOrAssignmentElement: () => getTargetOfBindingOrAssignmentElement,
+ getTemporaryModuleResolutionState: () => getTemporaryModuleResolutionState,
+ getTextOfConstantValue: () => getTextOfConstantValue,
+ getTextOfIdentifierOrLiteral: () => getTextOfIdentifierOrLiteral,
+ getTextOfJSDocComment: () => getTextOfJSDocComment,
+ getTextOfNode: () => getTextOfNode,
+ getTextOfNodeFromSourceText: () => getTextOfNodeFromSourceText,
+ getTextOfPropertyName: () => getTextOfPropertyName,
+ getThisContainer: () => getThisContainer,
+ getThisParameter: () => getThisParameter,
+ getTokenAtPosition: () => getTokenAtPosition,
+ getTokenPosOfNode: () => getTokenPosOfNode,
+ getTokenSourceMapRange: () => getTokenSourceMapRange,
+ getTouchingPropertyName: () => getTouchingPropertyName,
+ getTouchingToken: () => getTouchingToken,
+ getTrailingCommentRanges: () => getTrailingCommentRanges,
+ getTrailingSemicolonDeferringWriter: () => getTrailingSemicolonDeferringWriter,
+ getTransformFlagsSubtreeExclusions: () => getTransformFlagsSubtreeExclusions,
+ getTransformers: () => getTransformers,
+ getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath,
+ getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression,
+ getTsConfigPropArray: () => getTsConfigPropArray,
+ getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue,
+ getTypeAnnotationNode: () => getTypeAnnotationNode,
+ getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList,
+ getTypeKeywordOfTypeOnlyImport: () => getTypeKeywordOfTypeOnlyImport,
+ getTypeNode: () => getTypeNode,
+ getTypeNodeIfAccessible: () => getTypeNodeIfAccessible,
+ getTypeParameterFromJsDoc: () => getTypeParameterFromJsDoc,
+ getTypeParameterOwner: () => getTypeParameterOwner,
+ getTypesPackageName: () => getTypesPackageName,
+ getUILocale: () => getUILocale,
+ getUniqueName: () => getUniqueName,
+ getUniqueSymbolId: () => getUniqueSymbolId,
+ getUseDefineForClassFields: () => getUseDefineForClassFields,
+ getWatchErrorSummaryDiagnosticMessage: () => getWatchErrorSummaryDiagnosticMessage,
+ getWatchFactory: () => getWatchFactory,
+ group: () => group,
+ groupBy: () => groupBy,
+ guessIndentation: () => guessIndentation,
+ handleNoEmitOptions: () => handleNoEmitOptions,
+ hasAbstractModifier: () => hasAbstractModifier,
+ hasAccessorModifier: () => hasAccessorModifier,
+ hasAmbientModifier: () => hasAmbientModifier,
+ hasChangesInResolutions: () => hasChangesInResolutions,
+ hasChildOfKind: () => hasChildOfKind,
+ hasContextSensitiveParameters: () => hasContextSensitiveParameters,
+ hasDecorators: () => hasDecorators,
+ hasDocComment: () => hasDocComment,
+ hasDynamicName: () => hasDynamicName,
+ hasEffectiveModifier: () => hasEffectiveModifier,
+ hasEffectiveModifiers: () => hasEffectiveModifiers,
+ hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
+ hasExtension: () => hasExtension,
+ hasIndexSignature: () => hasIndexSignature,
+ hasInitializer: () => hasInitializer,
+ hasInvalidEscape: () => hasInvalidEscape,
+ hasJSDocNodes: () => hasJSDocNodes,
+ hasJSDocParameterTags: () => hasJSDocParameterTags,
+ hasJSFileExtension: () => hasJSFileExtension,
+ hasJsonModuleEmitEnabled: () => hasJsonModuleEmitEnabled,
+ hasOnlyExpressionInitializer: () => hasOnlyExpressionInitializer,
+ hasOverrideModifier: () => hasOverrideModifier,
+ hasPossibleExternalModuleReference: () => hasPossibleExternalModuleReference,
+ hasProperty: () => hasProperty,
+ hasPropertyAccessExpressionWithName: () => hasPropertyAccessExpressionWithName,
+ hasQuestionToken: () => hasQuestionToken,
+ hasRecordedExternalHelpers: () => hasRecordedExternalHelpers,
+ hasRestParameter: () => hasRestParameter,
+ hasScopeMarker: () => hasScopeMarker,
+ hasStaticModifier: () => hasStaticModifier,
+ hasSyntacticModifier: () => hasSyntacticModifier,
+ hasSyntacticModifiers: () => hasSyntacticModifiers,
+ hasTSFileExtension: () => hasTSFileExtension,
+ hasTabstop: () => hasTabstop,
+ hasTrailingDirectorySeparator: () => hasTrailingDirectorySeparator,
+ hasType: () => hasType,
+ hasTypeArguments: () => hasTypeArguments,
+ hasZeroOrOneAsteriskCharacter: () => hasZeroOrOneAsteriskCharacter,
+ helperString: () => helperString,
+ hostGetCanonicalFileName: () => hostGetCanonicalFileName,
+ hostUsesCaseSensitiveFileNames: () => hostUsesCaseSensitiveFileNames,
+ idText: () => idText,
+ identifierIsThisKeyword: () => identifierIsThisKeyword,
+ identifierToKeywordKind: () => identifierToKeywordKind,
+ identity: () => identity,
+ identitySourceMapConsumer: () => identitySourceMapConsumer,
+ ignoreSourceNewlines: () => ignoreSourceNewlines,
+ ignoredPaths: () => ignoredPaths,
+ importDefaultHelper: () => importDefaultHelper,
+ importFromModuleSpecifier: () => importFromModuleSpecifier,
+ importNameElisionDisabled: () => importNameElisionDisabled,
+ importStarHelper: () => importStarHelper,
+ indexOfAnyCharCode: () => indexOfAnyCharCode,
+ indexOfNode: () => indexOfNode,
+ indicesOf: () => indicesOf,
+ inferredTypesContainingFile: () => inferredTypesContainingFile,
+ insertImports: () => insertImports,
+ insertLeadingStatement: () => insertLeadingStatement,
+ insertSorted: () => insertSorted,
+ insertStatementAfterCustomPrologue: () => insertStatementAfterCustomPrologue,
+ insertStatementAfterStandardPrologue: () => insertStatementAfterStandardPrologue,
+ insertStatementsAfterCustomPrologue: () => insertStatementsAfterCustomPrologue,
+ insertStatementsAfterStandardPrologue: () => insertStatementsAfterStandardPrologue,
+ intersperse: () => intersperse,
+ introducesArgumentsExoticObject: () => introducesArgumentsExoticObject,
+ inverseJsxOptionMap: () => inverseJsxOptionMap,
+ isAbstractConstructorSymbol: () => isAbstractConstructorSymbol,
+ isAbstractModifier: () => isAbstractModifier,
+ isAccessExpression: () => isAccessExpression,
+ isAccessibilityModifier: () => isAccessibilityModifier,
+ isAccessor: () => isAccessor,
+ isAccessorModifier: () => isAccessorModifier,
+ isAliasSymbolDeclaration: () => isAliasSymbolDeclaration,
+ isAliasableExpression: () => isAliasableExpression,
+ isAmbientModule: () => isAmbientModule,
+ isAmbientPropertyDeclaration: () => isAmbientPropertyDeclaration,
+ isAnonymousFunctionDefinition: () => isAnonymousFunctionDefinition,
+ isAnyDirectorySeparator: () => isAnyDirectorySeparator,
+ isAnyImportOrBareOrAccessedRequire: () => isAnyImportOrBareOrAccessedRequire,
+ isAnyImportOrReExport: () => isAnyImportOrReExport,
+ isAnyImportSyntax: () => isAnyImportSyntax,
+ isAnySupportedFileExtension: () => isAnySupportedFileExtension,
+ isApplicableVersionedTypesKey: () => isApplicableVersionedTypesKey,
+ isArgumentExpressionOfElementAccess: () => isArgumentExpressionOfElementAccess,
+ isArray: () => isArray,
+ isArrayBindingElement: () => isArrayBindingElement,
+ isArrayBindingOrAssignmentElement: () => isArrayBindingOrAssignmentElement,
+ isArrayBindingOrAssignmentPattern: () => isArrayBindingOrAssignmentPattern,
+ isArrayBindingPattern: () => isArrayBindingPattern,
+ isArrayLiteralExpression: () => isArrayLiteralExpression,
+ isArrayLiteralOrObjectLiteralDestructuringPattern: () => isArrayLiteralOrObjectLiteralDestructuringPattern,
+ isArrayTypeNode: () => isArrayTypeNode,
+ isArrowFunction: () => isArrowFunction,
+ isAsExpression: () => isAsExpression,
+ isAssertClause: () => isAssertClause,
+ isAssertEntry: () => isAssertEntry,
+ isAssertionExpression: () => isAssertionExpression,
+ isAssertionKey: () => isAssertionKey,
+ isAssertsKeyword: () => isAssertsKeyword,
+ isAssignmentDeclaration: () => isAssignmentDeclaration,
+ isAssignmentExpression: () => isAssignmentExpression,
+ isAssignmentOperator: () => isAssignmentOperator,
+ isAssignmentPattern: () => isAssignmentPattern,
+ isAssignmentTarget: () => isAssignmentTarget,
+ isAsteriskToken: () => isAsteriskToken,
+ isAsyncFunction: () => isAsyncFunction,
+ isAsyncModifier: () => isAsyncModifier,
+ isAutoAccessorPropertyDeclaration: () => isAutoAccessorPropertyDeclaration,
+ isAwaitExpression: () => isAwaitExpression,
+ isAwaitKeyword: () => isAwaitKeyword,
+ isBigIntLiteral: () => isBigIntLiteral,
+ isBinaryExpression: () => isBinaryExpression,
+ isBinaryOperatorToken: () => isBinaryOperatorToken,
+ isBindableObjectDefinePropertyCall: () => isBindableObjectDefinePropertyCall,
+ isBindableStaticAccessExpression: () => isBindableStaticAccessExpression,
+ isBindableStaticElementAccessExpression: () => isBindableStaticElementAccessExpression,
+ isBindableStaticNameExpression: () => isBindableStaticNameExpression,
+ isBindingElement: () => isBindingElement,
+ isBindingElementOfBareOrAccessedRequire: () => isBindingElementOfBareOrAccessedRequire,
+ isBindingName: () => isBindingName,
+ isBindingOrAssignmentElement: () => isBindingOrAssignmentElement,
+ isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
+ isBindingPattern: () => isBindingPattern,
+ isBlock: () => isBlock,
+ isBlockOrCatchScoped: () => isBlockOrCatchScoped,
+ isBlockScope: () => isBlockScope,
+ isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
+ isBooleanLiteral: () => isBooleanLiteral,
+ isBreakOrContinueStatement: () => isBreakOrContinueStatement,
+ isBreakStatement: () => isBreakStatement,
+ isBuildInfoFile: () => isBuildInfoFile,
+ isBuilderProgram: () => isBuilderProgram2,
+ isBundle: () => isBundle,
+ isBundleFileTextLike: () => isBundleFileTextLike,
+ isCallChain: () => isCallChain,
+ isCallExpression: () => isCallExpression,
+ isCallExpressionTarget: () => isCallExpressionTarget,
+ isCallLikeExpression: () => isCallLikeExpression,
+ isCallOrNewExpression: () => isCallOrNewExpression,
+ isCallOrNewExpressionTarget: () => isCallOrNewExpressionTarget,
+ isCallSignatureDeclaration: () => isCallSignatureDeclaration,
+ isCallToHelper: () => isCallToHelper,
+ isCaseBlock: () => isCaseBlock,
+ isCaseClause: () => isCaseClause,
+ isCaseKeyword: () => isCaseKeyword,
+ isCaseOrDefaultClause: () => isCaseOrDefaultClause,
+ isCatchClause: () => isCatchClause,
+ isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
+ isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
+ isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
+ isChildOfNodeWithKind: () => isChildOfNodeWithKind,
+ isCircularBuildOrder: () => isCircularBuildOrder,
+ isClassDeclaration: () => isClassDeclaration,
+ isClassElement: () => isClassElement,
+ isClassExpression: () => isClassExpression,
+ isClassLike: () => isClassLike,
+ isClassMemberModifier: () => isClassMemberModifier,
+ isClassOrTypeElement: () => isClassOrTypeElement,
+ isClassStaticBlockDeclaration: () => isClassStaticBlockDeclaration,
+ isCollapsedRange: () => isCollapsedRange,
+ isColonToken: () => isColonToken,
+ isCommaExpression: () => isCommaExpression,
+ isCommaListExpression: () => isCommaListExpression,
+ isCommaSequence: () => isCommaSequence,
+ isCommaToken: () => isCommaToken,
+ isComment: () => isComment,
+ isCommonJsExportPropertyAssignment: () => isCommonJsExportPropertyAssignment,
+ isCommonJsExportedExpression: () => isCommonJsExportedExpression,
+ isCompoundAssignment: () => isCompoundAssignment,
+ isComputedNonLiteralName: () => isComputedNonLiteralName,
+ isComputedPropertyName: () => isComputedPropertyName,
+ isConciseBody: () => isConciseBody,
+ isConditionalExpression: () => isConditionalExpression,
+ isConditionalTypeNode: () => isConditionalTypeNode,
+ isConstTypeReference: () => isConstTypeReference,
+ isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
+ isConstructorDeclaration: () => isConstructorDeclaration,
+ isConstructorTypeNode: () => isConstructorTypeNode,
+ isContextualKeyword: () => isContextualKeyword,
+ isContinueStatement: () => isContinueStatement,
+ isCustomPrologue: () => isCustomPrologue,
+ isDebuggerStatement: () => isDebuggerStatement,
+ isDeclaration: () => isDeclaration,
+ isDeclarationBindingElement: () => isDeclarationBindingElement,
+ isDeclarationFileName: () => isDeclarationFileName,
+ isDeclarationName: () => isDeclarationName,
+ isDeclarationNameOfEnumOrNamespace: () => isDeclarationNameOfEnumOrNamespace,
+ isDeclarationReadonly: () => isDeclarationReadonly,
+ isDeclarationStatement: () => isDeclarationStatement,
+ isDeclarationWithTypeParameterChildren: () => isDeclarationWithTypeParameterChildren,
+ isDeclarationWithTypeParameters: () => isDeclarationWithTypeParameters,
+ isDecorator: () => isDecorator,
+ isDecoratorTarget: () => isDecoratorTarget,
+ isDefaultClause: () => isDefaultClause,
+ isDefaultImport: () => isDefaultImport,
+ isDefaultModifier: () => isDefaultModifier,
+ isDefaultedExpandoInitializer: () => isDefaultedExpandoInitializer,
+ isDeleteExpression: () => isDeleteExpression,
+ isDeleteTarget: () => isDeleteTarget,
+ isDeprecatedDeclaration: () => isDeprecatedDeclaration,
+ isDestructuringAssignment: () => isDestructuringAssignment,
+ isDiagnosticWithLocation: () => isDiagnosticWithLocation,
+ isDiskPathRoot: () => isDiskPathRoot,
+ isDoStatement: () => isDoStatement,
+ isDotDotDotToken: () => isDotDotDotToken,
+ isDottedName: () => isDottedName,
+ isDynamicName: () => isDynamicName,
+ isESSymbolIdentifier: () => isESSymbolIdentifier,
+ isEffectiveExternalModule: () => isEffectiveExternalModule,
+ isEffectiveModuleDeclaration: () => isEffectiveModuleDeclaration,
+ isEffectiveStrictModeSourceFile: () => isEffectiveStrictModeSourceFile,
+ isElementAccessChain: () => isElementAccessChain,
+ isElementAccessExpression: () => isElementAccessExpression,
+ isEmittedFileOfProgram: () => isEmittedFileOfProgram,
+ isEmptyArrayLiteral: () => isEmptyArrayLiteral,
+ isEmptyBindingElement: () => isEmptyBindingElement,
+ isEmptyBindingPattern: () => isEmptyBindingPattern,
+ isEmptyObjectLiteral: () => isEmptyObjectLiteral,
+ isEmptyStatement: () => isEmptyStatement,
+ isEmptyStringLiteral: () => isEmptyStringLiteral,
+ isEndOfDeclarationMarker: () => isEndOfDeclarationMarker,
+ isEntityName: () => isEntityName,
+ isEntityNameExpression: () => isEntityNameExpression,
+ isEnumConst: () => isEnumConst,
+ isEnumDeclaration: () => isEnumDeclaration,
+ isEnumMember: () => isEnumMember,
+ isEqualityOperatorKind: () => isEqualityOperatorKind,
+ isEqualsGreaterThanToken: () => isEqualsGreaterThanToken,
+ isExclamationToken: () => isExclamationToken,
+ isExcludedFile: () => isExcludedFile,
+ isExclusivelyTypeOnlyImportOrExport: () => isExclusivelyTypeOnlyImportOrExport,
+ isExportAssignment: () => isExportAssignment,
+ isExportDeclaration: () => isExportDeclaration,
+ isExportModifier: () => isExportModifier,
+ isExportName: () => isExportName,
+ isExportNamespaceAsDefaultDeclaration: () => isExportNamespaceAsDefaultDeclaration,
+ isExportOrDefaultModifier: () => isExportOrDefaultModifier,
+ isExportSpecifier: () => isExportSpecifier,
+ isExportsIdentifier: () => isExportsIdentifier,
+ isExportsOrModuleExportsOrAlias: () => isExportsOrModuleExportsOrAlias,
+ isExpression: () => isExpression,
+ isExpressionNode: () => isExpressionNode,
+ isExpressionOfExternalModuleImportEqualsDeclaration: () => isExpressionOfExternalModuleImportEqualsDeclaration,
+ isExpressionOfOptionalChainRoot: () => isExpressionOfOptionalChainRoot,
+ isExpressionStatement: () => isExpressionStatement,
+ isExpressionWithTypeArguments: () => isExpressionWithTypeArguments,
+ isExpressionWithTypeArgumentsInClassExtendsClause: () => isExpressionWithTypeArgumentsInClassExtendsClause,
+ isExternalModule: () => isExternalModule,
+ isExternalModuleAugmentation: () => isExternalModuleAugmentation,
+ isExternalModuleImportEqualsDeclaration: () => isExternalModuleImportEqualsDeclaration,
+ isExternalModuleIndicator: () => isExternalModuleIndicator,
+ isExternalModuleNameRelative: () => isExternalModuleNameRelative,
+ isExternalModuleReference: () => isExternalModuleReference,
+ isExternalModuleSymbol: () => isExternalModuleSymbol,
+ isExternalOrCommonJsModule: () => isExternalOrCommonJsModule,
+ isFileLevelUniqueName: () => isFileLevelUniqueName,
+ isFileProbablyExternalModule: () => isFileProbablyExternalModule,
+ isFirstDeclarationOfSymbolParameter: () => isFirstDeclarationOfSymbolParameter,
+ isFixablePromiseHandler: () => isFixablePromiseHandler,
+ isForInOrOfStatement: () => isForInOrOfStatement,
+ isForInStatement: () => isForInStatement,
+ isForInitializer: () => isForInitializer,
+ isForOfStatement: () => isForOfStatement,
+ isForStatement: () => isForStatement,
+ isFunctionBlock: () => isFunctionBlock,
+ isFunctionBody: () => isFunctionBody,
+ isFunctionDeclaration: () => isFunctionDeclaration,
+ isFunctionExpression: () => isFunctionExpression,
+ isFunctionExpressionOrArrowFunction: () => isFunctionExpressionOrArrowFunction,
+ isFunctionLike: () => isFunctionLike,
+ isFunctionLikeDeclaration: () => isFunctionLikeDeclaration,
+ isFunctionLikeKind: () => isFunctionLikeKind,
+ isFunctionLikeOrClassStaticBlockDeclaration: () => isFunctionLikeOrClassStaticBlockDeclaration,
+ isFunctionOrConstructorTypeNode: () => isFunctionOrConstructorTypeNode,
+ isFunctionOrModuleBlock: () => isFunctionOrModuleBlock,
+ isFunctionSymbol: () => isFunctionSymbol,
+ isFunctionTypeNode: () => isFunctionTypeNode,
+ isFutureReservedKeyword: () => isFutureReservedKeyword,
+ isGeneratedIdentifier: () => isGeneratedIdentifier,
+ isGeneratedPrivateIdentifier: () => isGeneratedPrivateIdentifier,
+ isGetAccessor: () => isGetAccessor,
+ isGetAccessorDeclaration: () => isGetAccessorDeclaration,
+ isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
+ isGlobalDeclaration: () => isGlobalDeclaration,
+ isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
+ isGrammarError: () => isGrammarError,
+ isHeritageClause: () => isHeritageClause,
+ isHoistedFunction: () => isHoistedFunction,
+ isHoistedVariableStatement: () => isHoistedVariableStatement,
+ isIdentifier: () => isIdentifier,
+ isIdentifierANonContextualKeyword: () => isIdentifierANonContextualKeyword,
+ isIdentifierName: () => isIdentifierName,
+ isIdentifierOrThisTypeNode: () => isIdentifierOrThisTypeNode,
+ isIdentifierPart: () => isIdentifierPart,
+ isIdentifierStart: () => isIdentifierStart,
+ isIdentifierText: () => isIdentifierText,
+ isIdentifierTypePredicate: () => isIdentifierTypePredicate,
+ isIdentifierTypeReference: () => isIdentifierTypeReference,
+ isIfStatement: () => isIfStatement,
+ isIgnoredFileFromWildCardWatching: () => isIgnoredFileFromWildCardWatching,
+ isImplicitGlob: () => isImplicitGlob,
+ isImportCall: () => isImportCall,
+ isImportClause: () => isImportClause,
+ isImportDeclaration: () => isImportDeclaration,
+ isImportEqualsDeclaration: () => isImportEqualsDeclaration,
+ isImportKeyword: () => isImportKeyword,
+ isImportMeta: () => isImportMeta,
+ isImportOrExportSpecifier: () => isImportOrExportSpecifier,
+ isImportOrExportSpecifierName: () => isImportOrExportSpecifierName,
+ isImportSpecifier: () => isImportSpecifier,
+ isImportTypeAssertionContainer: () => isImportTypeAssertionContainer,
+ isImportTypeNode: () => isImportTypeNode,
+ isImportableFile: () => isImportableFile,
+ isInComment: () => isInComment,
+ isInExpressionContext: () => isInExpressionContext,
+ isInJSDoc: () => isInJSDoc,
+ isInJSFile: () => isInJSFile,
+ isInJSXText: () => isInJSXText,
+ isInJsonFile: () => isInJsonFile,
+ isInNonReferenceComment: () => isInNonReferenceComment,
+ isInReferenceComment: () => isInReferenceComment,
+ isInRightSideOfInternalImportEqualsDeclaration: () => isInRightSideOfInternalImportEqualsDeclaration,
+ isInString: () => isInString,
+ isInTemplateString: () => isInTemplateString,
+ isInTopLevelContext: () => isInTopLevelContext,
+ isIncrementalCompilation: () => isIncrementalCompilation,
+ isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
+ isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
+ isInferTypeNode: () => isInferTypeNode,
+ isInfinityOrNaNString: () => isInfinityOrNaNString,
+ isInitializedProperty: () => isInitializedProperty,
+ isInitializedVariable: () => isInitializedVariable,
+ isInsideJsxElement: () => isInsideJsxElement,
+ isInsideJsxElementOrAttribute: () => isInsideJsxElementOrAttribute,
+ isInsideNodeModules: () => isInsideNodeModules,
+ isInsideTemplateLiteral: () => isInsideTemplateLiteral,
+ isInstantiatedModule: () => isInstantiatedModule,
+ isInterfaceDeclaration: () => isInterfaceDeclaration,
+ isInternalDeclaration: () => isInternalDeclaration,
+ isInternalModuleImportEqualsDeclaration: () => isInternalModuleImportEqualsDeclaration,
+ isInternalName: () => isInternalName,
+ isIntersectionTypeNode: () => isIntersectionTypeNode,
+ isIntrinsicJsxName: () => isIntrinsicJsxName,
+ isIterationStatement: () => isIterationStatement,
+ isJSDoc: () => isJSDoc,
+ isJSDocAllType: () => isJSDocAllType,
+ isJSDocAugmentsTag: () => isJSDocAugmentsTag,
+ isJSDocAuthorTag: () => isJSDocAuthorTag,
+ isJSDocCallbackTag: () => isJSDocCallbackTag,
+ isJSDocClassTag: () => isJSDocClassTag,
+ isJSDocCommentContainingNode: () => isJSDocCommentContainingNode,
+ isJSDocConstructSignature: () => isJSDocConstructSignature,
+ isJSDocDeprecatedTag: () => isJSDocDeprecatedTag,
+ isJSDocEnumTag: () => isJSDocEnumTag,
+ isJSDocFunctionType: () => isJSDocFunctionType,
+ isJSDocImplementsTag: () => isJSDocImplementsTag,
+ isJSDocIndexSignature: () => isJSDocIndexSignature,
+ isJSDocLikeText: () => isJSDocLikeText,
+ isJSDocLink: () => isJSDocLink,
+ isJSDocLinkCode: () => isJSDocLinkCode,
+ isJSDocLinkLike: () => isJSDocLinkLike,
+ isJSDocLinkPlain: () => isJSDocLinkPlain,
+ isJSDocMemberName: () => isJSDocMemberName,
+ isJSDocNameReference: () => isJSDocNameReference,
+ isJSDocNamepathType: () => isJSDocNamepathType,
+ isJSDocNamespaceBody: () => isJSDocNamespaceBody,
+ isJSDocNode: () => isJSDocNode,
+ isJSDocNonNullableType: () => isJSDocNonNullableType,
+ isJSDocNullableType: () => isJSDocNullableType,
+ isJSDocOptionalParameter: () => isJSDocOptionalParameter,
+ isJSDocOptionalType: () => isJSDocOptionalType,
+ isJSDocOverloadTag: () => isJSDocOverloadTag,
+ isJSDocOverrideTag: () => isJSDocOverrideTag,
+ isJSDocParameterTag: () => isJSDocParameterTag,
+ isJSDocPrivateTag: () => isJSDocPrivateTag,
+ isJSDocPropertyLikeTag: () => isJSDocPropertyLikeTag,
+ isJSDocPropertyTag: () => isJSDocPropertyTag,
+ isJSDocProtectedTag: () => isJSDocProtectedTag,
+ isJSDocPublicTag: () => isJSDocPublicTag,
+ isJSDocReadonlyTag: () => isJSDocReadonlyTag,
+ isJSDocReturnTag: () => isJSDocReturnTag,
+ isJSDocSatisfiesExpression: () => isJSDocSatisfiesExpression,
+ isJSDocSatisfiesTag: () => isJSDocSatisfiesTag,
+ isJSDocSeeTag: () => isJSDocSeeTag,
+ isJSDocSignature: () => isJSDocSignature,
+ isJSDocTag: () => isJSDocTag,
+ isJSDocTemplateTag: () => isJSDocTemplateTag,
+ isJSDocThisTag: () => isJSDocThisTag,
+ isJSDocThrowsTag: () => isJSDocThrowsTag,
+ isJSDocTypeAlias: () => isJSDocTypeAlias,
+ isJSDocTypeAssertion: () => isJSDocTypeAssertion,
+ isJSDocTypeExpression: () => isJSDocTypeExpression,
+ isJSDocTypeLiteral: () => isJSDocTypeLiteral,
+ isJSDocTypeTag: () => isJSDocTypeTag,
+ isJSDocTypedefTag: () => isJSDocTypedefTag,
+ isJSDocUnknownTag: () => isJSDocUnknownTag,
+ isJSDocUnknownType: () => isJSDocUnknownType,
+ isJSDocVariadicType: () => isJSDocVariadicType,
+ isJSXTagName: () => isJSXTagName,
+ isJsonEqual: () => isJsonEqual,
+ isJsonSourceFile: () => isJsonSourceFile,
+ isJsxAttribute: () => isJsxAttribute,
+ isJsxAttributeLike: () => isJsxAttributeLike,
+ isJsxAttributes: () => isJsxAttributes,
+ isJsxChild: () => isJsxChild,
+ isJsxClosingElement: () => isJsxClosingElement,
+ isJsxClosingFragment: () => isJsxClosingFragment,
+ isJsxElement: () => isJsxElement,
+ isJsxExpression: () => isJsxExpression,
+ isJsxFragment: () => isJsxFragment,
+ isJsxOpeningElement: () => isJsxOpeningElement,
+ isJsxOpeningFragment: () => isJsxOpeningFragment,
+ isJsxOpeningLikeElement: () => isJsxOpeningLikeElement,
+ isJsxOpeningLikeElementTagName: () => isJsxOpeningLikeElementTagName,
+ isJsxSelfClosingElement: () => isJsxSelfClosingElement,
+ isJsxSpreadAttribute: () => isJsxSpreadAttribute,
+ isJsxTagNameExpression: () => isJsxTagNameExpression,
+ isJsxText: () => isJsxText,
+ isJumpStatementTarget: () => isJumpStatementTarget,
+ isKeyword: () => isKeyword,
+ isKnownSymbol: () => isKnownSymbol,
+ isLabelName: () => isLabelName,
+ isLabelOfLabeledStatement: () => isLabelOfLabeledStatement,
+ isLabeledStatement: () => isLabeledStatement,
+ isLateVisibilityPaintedStatement: () => isLateVisibilityPaintedStatement,
+ isLeftHandSideExpression: () => isLeftHandSideExpression,
+ isLeftHandSideOfAssignment: () => isLeftHandSideOfAssignment,
+ isLet: () => isLet,
+ isLineBreak: () => isLineBreak,
+ isLiteralComputedPropertyDeclarationName: () => isLiteralComputedPropertyDeclarationName,
+ isLiteralExpression: () => isLiteralExpression,
+ isLiteralExpressionOfObject: () => isLiteralExpressionOfObject,
+ isLiteralImportTypeNode: () => isLiteralImportTypeNode,
+ isLiteralKind: () => isLiteralKind,
+ isLiteralLikeAccess: () => isLiteralLikeAccess,
+ isLiteralLikeElementAccess: () => isLiteralLikeElementAccess,
+ isLiteralNameOfPropertyDeclarationOrIndexAccess: () => isLiteralNameOfPropertyDeclarationOrIndexAccess,
+ isLiteralTypeLikeExpression: () => isLiteralTypeLikeExpression,
+ isLiteralTypeLiteral: () => isLiteralTypeLiteral,
+ isLiteralTypeNode: () => isLiteralTypeNode,
+ isLocalName: () => isLocalName,
+ isLogicalOperator: () => isLogicalOperator,
+ isLogicalOrCoalescingAssignmentExpression: () => isLogicalOrCoalescingAssignmentExpression,
+ isLogicalOrCoalescingAssignmentOperator: () => isLogicalOrCoalescingAssignmentOperator,
+ isLogicalOrCoalescingBinaryExpression: () => isLogicalOrCoalescingBinaryExpression,
+ isLogicalOrCoalescingBinaryOperator: () => isLogicalOrCoalescingBinaryOperator,
+ isMappedTypeNode: () => isMappedTypeNode,
+ isMemberName: () => isMemberName,
+ isMergeDeclarationMarker: () => isMergeDeclarationMarker,
+ isMetaProperty: () => isMetaProperty,
+ isMethodDeclaration: () => isMethodDeclaration,
+ isMethodOrAccessor: () => isMethodOrAccessor,
+ isMethodSignature: () => isMethodSignature,
+ isMinusToken: () => isMinusToken,
+ isMissingDeclaration: () => isMissingDeclaration,
+ isModifier: () => isModifier,
+ isModifierKind: () => isModifierKind,
+ isModifierLike: () => isModifierLike,
+ isModuleAugmentationExternal: () => isModuleAugmentationExternal,
+ isModuleBlock: () => isModuleBlock,
+ isModuleBody: () => isModuleBody,
+ isModuleDeclaration: () => isModuleDeclaration,
+ isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
+ isModuleIdentifier: () => isModuleIdentifier,
+ isModuleName: () => isModuleName,
+ isModuleOrEnumDeclaration: () => isModuleOrEnumDeclaration,
+ isModuleReference: () => isModuleReference,
+ isModuleSpecifierLike: () => isModuleSpecifierLike,
+ isModuleWithStringLiteralName: () => isModuleWithStringLiteralName,
+ isNameOfFunctionDeclaration: () => isNameOfFunctionDeclaration,
+ isNameOfModuleDeclaration: () => isNameOfModuleDeclaration,
+ isNamedClassElement: () => isNamedClassElement,
+ isNamedDeclaration: () => isNamedDeclaration,
+ isNamedEvaluation: () => isNamedEvaluation,
+ isNamedEvaluationSource: () => isNamedEvaluationSource,
+ isNamedExportBindings: () => isNamedExportBindings,
+ isNamedExports: () => isNamedExports,
+ isNamedImportBindings: () => isNamedImportBindings,
+ isNamedImports: () => isNamedImports,
+ isNamedImportsOrExports: () => isNamedImportsOrExports,
+ isNamedTupleMember: () => isNamedTupleMember,
+ isNamespaceBody: () => isNamespaceBody,
+ isNamespaceExport: () => isNamespaceExport,
+ isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
+ isNamespaceImport: () => isNamespaceImport,
+ isNamespaceReexportDeclaration: () => isNamespaceReexportDeclaration,
+ isNewExpression: () => isNewExpression,
+ isNewExpressionTarget: () => isNewExpressionTarget,
+ isNightly: () => isNightly,
+ isNoSubstitutionTemplateLiteral: () => isNoSubstitutionTemplateLiteral,
+ isNode: () => isNode,
+ isNodeArray: () => isNodeArray,
+ isNodeArrayMultiLine: () => isNodeArrayMultiLine,
+ isNodeDescendantOf: () => isNodeDescendantOf,
+ isNodeKind: () => isNodeKind,
+ isNodeLikeSystem: () => isNodeLikeSystem,
+ isNodeModulesDirectory: () => isNodeModulesDirectory,
+ isNodeWithPossibleHoistedDeclaration: () => isNodeWithPossibleHoistedDeclaration,
+ isNonContextualKeyword: () => isNonContextualKeyword,
+ isNonExportDefaultModifier: () => isNonExportDefaultModifier,
+ isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
+ isNonGlobalDeclaration: () => isNonGlobalDeclaration,
+ isNonNullAccess: () => isNonNullAccess,
+ isNonNullChain: () => isNonNullChain,
+ isNonNullExpression: () => isNonNullExpression,
+ isNonStaticMethodOrAccessorWithPrivateName: () => isNonStaticMethodOrAccessorWithPrivateName,
+ isNotEmittedOrPartiallyEmittedNode: () => isNotEmittedOrPartiallyEmittedNode,
+ isNotEmittedStatement: () => isNotEmittedStatement,
+ isNullishCoalesce: () => isNullishCoalesce,
+ isNumber: () => isNumber,
+ isNumericLiteral: () => isNumericLiteral,
+ isNumericLiteralName: () => isNumericLiteralName,
+ isObjectBindingElementWithoutPropertyName: () => isObjectBindingElementWithoutPropertyName,
+ isObjectBindingOrAssignmentElement: () => isObjectBindingOrAssignmentElement,
+ isObjectBindingOrAssignmentPattern: () => isObjectBindingOrAssignmentPattern,
+ isObjectBindingPattern: () => isObjectBindingPattern,
+ isObjectLiteralElement: () => isObjectLiteralElement,
+ isObjectLiteralElementLike: () => isObjectLiteralElementLike,
+ isObjectLiteralExpression: () => isObjectLiteralExpression,
+ isObjectLiteralMethod: () => isObjectLiteralMethod,
+ isObjectLiteralOrClassExpressionMethodOrAccessor: () => isObjectLiteralOrClassExpressionMethodOrAccessor,
+ isObjectTypeDeclaration: () => isObjectTypeDeclaration,
+ isOctalDigit: () => isOctalDigit,
+ isOmittedExpression: () => isOmittedExpression,
+ isOptionalChain: () => isOptionalChain,
+ isOptionalChainRoot: () => isOptionalChainRoot,
+ isOptionalDeclaration: () => isOptionalDeclaration,
+ isOptionalJSDocPropertyLikeTag: () => isOptionalJSDocPropertyLikeTag,
+ isOptionalTypeNode: () => isOptionalTypeNode,
+ isOuterExpression: () => isOuterExpression,
+ isOutermostOptionalChain: () => isOutermostOptionalChain,
+ isOverrideModifier: () => isOverrideModifier,
+ isPackedArrayLiteral: () => isPackedArrayLiteral,
+ isParameter: () => isParameter,
+ isParameterDeclaration: () => isParameterDeclaration,
+ isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
+ isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
+ isParameterPropertyModifier: () => isParameterPropertyModifier,
+ isParenthesizedExpression: () => isParenthesizedExpression,
+ isParenthesizedTypeNode: () => isParenthesizedTypeNode,
+ isParseTreeNode: () => isParseTreeNode,
+ isPartOfTypeNode: () => isPartOfTypeNode,
+ isPartOfTypeQuery: () => isPartOfTypeQuery,
+ isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
+ isPatternMatch: () => isPatternMatch,
+ isPinnedComment: () => isPinnedComment,
+ isPlainJsFile: () => isPlainJsFile,
+ isPlusToken: () => isPlusToken,
+ isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition,
+ isPostfixUnaryExpression: () => isPostfixUnaryExpression,
+ isPrefixUnaryExpression: () => isPrefixUnaryExpression,
+ isPrivateIdentifier: () => isPrivateIdentifier,
+ isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
+ isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
+ isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
+ isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
+ isProgramUptoDate: () => isProgramUptoDate,
+ isPrologueDirective: () => isPrologueDirective,
+ isPropertyAccessChain: () => isPropertyAccessChain,
+ isPropertyAccessEntityNameExpression: () => isPropertyAccessEntityNameExpression,
+ isPropertyAccessExpression: () => isPropertyAccessExpression,
+ isPropertyAccessOrQualifiedName: () => isPropertyAccessOrQualifiedName,
+ isPropertyAccessOrQualifiedNameOrImportTypeNode: () => isPropertyAccessOrQualifiedNameOrImportTypeNode,
+ isPropertyAssignment: () => isPropertyAssignment,
+ isPropertyDeclaration: () => isPropertyDeclaration,
+ isPropertyName: () => isPropertyName,
+ isPropertyNameLiteral: () => isPropertyNameLiteral,
+ isPropertySignature: () => isPropertySignature,
+ isProtoSetter: () => isProtoSetter,
+ isPrototypeAccess: () => isPrototypeAccess,
+ isPrototypePropertyAssignment: () => isPrototypePropertyAssignment,
+ isPunctuation: () => isPunctuation,
+ isPushOrUnshiftIdentifier: () => isPushOrUnshiftIdentifier,
+ isQualifiedName: () => isQualifiedName,
+ isQuestionDotToken: () => isQuestionDotToken,
+ isQuestionOrExclamationToken: () => isQuestionOrExclamationToken,
+ isQuestionOrPlusOrMinusToken: () => isQuestionOrPlusOrMinusToken,
+ isQuestionToken: () => isQuestionToken,
+ isRawSourceMap: () => isRawSourceMap,
+ isReadonlyKeyword: () => isReadonlyKeyword,
+ isReadonlyKeywordOrPlusOrMinusToken: () => isReadonlyKeywordOrPlusOrMinusToken,
+ isRecognizedTripleSlashComment: () => isRecognizedTripleSlashComment,
+ isReferenceFileLocation: () => isReferenceFileLocation,
+ isReferencedFile: () => isReferencedFile,
+ isRegularExpressionLiteral: () => isRegularExpressionLiteral,
+ isRequireCall: () => isRequireCall,
+ isRequireVariableStatement: () => isRequireVariableStatement,
+ isRestParameter: () => isRestParameter,
+ isRestTypeNode: () => isRestTypeNode,
+ isReturnStatement: () => isReturnStatement,
+ isReturnStatementWithFixablePromiseHandler: () => isReturnStatementWithFixablePromiseHandler,
+ isRightSideOfAccessExpression: () => isRightSideOfAccessExpression,
+ isRightSideOfPropertyAccess: () => isRightSideOfPropertyAccess,
+ isRightSideOfQualifiedName: () => isRightSideOfQualifiedName,
+ isRightSideOfQualifiedNameOrPropertyAccess: () => isRightSideOfQualifiedNameOrPropertyAccess,
+ isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName: () => isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName,
+ isRootedDiskPath: () => isRootedDiskPath,
+ isSameEntityName: () => isSameEntityName,
+ isSatisfiesExpression: () => isSatisfiesExpression,
+ isScopeMarker: () => isScopeMarker,
+ isSemicolonClassElement: () => isSemicolonClassElement,
+ isSetAccessor: () => isSetAccessor,
+ isSetAccessorDeclaration: () => isSetAccessorDeclaration,
+ isShebangTrivia: () => isShebangTrivia,
+ isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
+ isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
+ isSignedNumericLiteral: () => isSignedNumericLiteral,
+ isSimpleCopiableExpression: () => isSimpleCopiableExpression,
+ isSimpleInlineableExpression: () => isSimpleInlineableExpression,
+ isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
+ isSourceFile: () => isSourceFile,
+ isSourceFileFromLibrary: () => isSourceFileFromLibrary,
+ isSourceFileJS: () => isSourceFileJS,
+ isSourceFileNotJS: () => isSourceFileNotJS,
+ isSourceFileNotJson: () => isSourceFileNotJson,
+ isSourceMapping: () => isSourceMapping,
+ isSpecialPropertyDeclaration: () => isSpecialPropertyDeclaration,
+ isSpreadAssignment: () => isSpreadAssignment,
+ isSpreadElement: () => isSpreadElement,
+ isStatement: () => isStatement,
+ isStatementButNotDeclaration: () => isStatementButNotDeclaration,
+ isStatementOrBlock: () => isStatementOrBlock,
+ isStatementWithLocals: () => isStatementWithLocals,
+ isStatic: () => isStatic,
+ isStaticModifier: () => isStaticModifier,
+ isString: () => isString,
+ isStringAKeyword: () => isStringAKeyword,
+ isStringANonContextualKeyword: () => isStringANonContextualKeyword,
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
+ isStringDoubleQuoted: () => isStringDoubleQuoted,
+ isStringLiteral: () => isStringLiteral,
+ isStringLiteralLike: () => isStringLiteralLike,
+ isStringLiteralOrJsxExpression: () => isStringLiteralOrJsxExpression,
+ isStringLiteralOrTemplate: () => isStringLiteralOrTemplate,
+ isStringOrNumericLiteralLike: () => isStringOrNumericLiteralLike,
+ isStringOrRegularExpressionOrTemplateLiteral: () => isStringOrRegularExpressionOrTemplateLiteral,
+ isStringTextContainingNode: () => isStringTextContainingNode,
+ isSuperCall: () => isSuperCall,
+ isSuperKeyword: () => isSuperKeyword,
+ isSuperOrSuperProperty: () => isSuperOrSuperProperty,
+ isSuperProperty: () => isSuperProperty,
+ isSupportedSourceFileName: () => isSupportedSourceFileName,
+ isSwitchStatement: () => isSwitchStatement,
+ isSyntaxList: () => isSyntaxList,
+ isSyntheticExpression: () => isSyntheticExpression,
+ isSyntheticReference: () => isSyntheticReference,
+ isTagName: () => isTagName,
+ isTaggedTemplateExpression: () => isTaggedTemplateExpression,
+ isTaggedTemplateTag: () => isTaggedTemplateTag,
+ isTemplateExpression: () => isTemplateExpression,
+ isTemplateHead: () => isTemplateHead,
+ isTemplateLiteral: () => isTemplateLiteral,
+ isTemplateLiteralKind: () => isTemplateLiteralKind,
+ isTemplateLiteralToken: () => isTemplateLiteralToken,
+ isTemplateLiteralTypeNode: () => isTemplateLiteralTypeNode,
+ isTemplateLiteralTypeSpan: () => isTemplateLiteralTypeSpan,
+ isTemplateMiddle: () => isTemplateMiddle,
+ isTemplateMiddleOrTemplateTail: () => isTemplateMiddleOrTemplateTail,
+ isTemplateSpan: () => isTemplateSpan,
+ isTemplateTail: () => isTemplateTail,
+ isTextWhiteSpaceLike: () => isTextWhiteSpaceLike,
+ isThis: () => isThis,
+ isThisContainerOrFunctionBlock: () => isThisContainerOrFunctionBlock,
+ isThisIdentifier: () => isThisIdentifier,
+ isThisInTypeQuery: () => isThisInTypeQuery,
+ isThisInitializedDeclaration: () => isThisInitializedDeclaration,
+ isThisInitializedObjectBindingExpression: () => isThisInitializedObjectBindingExpression,
+ isThisProperty: () => isThisProperty,
+ isThisTypeNode: () => isThisTypeNode,
+ isThisTypeParameter: () => isThisTypeParameter,
+ isThisTypePredicate: () => isThisTypePredicate,
+ isThrowStatement: () => isThrowStatement,
+ isToken: () => isToken,
+ isTokenKind: () => isTokenKind,
+ isTraceEnabled: () => isTraceEnabled,
+ isTransientSymbol: () => isTransientSymbol,
+ isTrivia: () => isTrivia,
+ isTryStatement: () => isTryStatement,
+ isTupleTypeNode: () => isTupleTypeNode,
+ isTypeAlias: () => isTypeAlias,
+ isTypeAliasDeclaration: () => isTypeAliasDeclaration,
+ isTypeAssertionExpression: () => isTypeAssertionExpression,
+ isTypeDeclaration: () => isTypeDeclaration,
+ isTypeElement: () => isTypeElement,
+ isTypeKeyword: () => isTypeKeyword,
+ isTypeKeywordToken: () => isTypeKeywordToken,
+ isTypeKeywordTokenOrIdentifier: () => isTypeKeywordTokenOrIdentifier,
+ isTypeLiteralNode: () => isTypeLiteralNode,
+ isTypeNode: () => isTypeNode,
+ isTypeNodeKind: () => isTypeNodeKind,
+ isTypeOfExpression: () => isTypeOfExpression,
+ isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
+ isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
+ isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
+ isTypeOperatorNode: () => isTypeOperatorNode,
+ isTypeParameterDeclaration: () => isTypeParameterDeclaration,
+ isTypePredicateNode: () => isTypePredicateNode,
+ isTypeQueryNode: () => isTypeQueryNode,
+ isTypeReferenceNode: () => isTypeReferenceNode,
+ isTypeReferenceType: () => isTypeReferenceType,
+ isUMDExportSymbol: () => isUMDExportSymbol,
+ isUnaryExpression: () => isUnaryExpression,
+ isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
+ isUnicodeIdentifierStart: () => isUnicodeIdentifierStart,
+ isUnionTypeNode: () => isUnionTypeNode,
+ isUnparsedNode: () => isUnparsedNode,
+ isUnparsedPrepend: () => isUnparsedPrepend,
+ isUnparsedSource: () => isUnparsedSource,
+ isUnparsedTextLike: () => isUnparsedTextLike,
+ isUrl: () => isUrl,
+ isValidBigIntString: () => isValidBigIntString,
+ isValidESSymbolDeclaration: () => isValidESSymbolDeclaration,
+ isValidTypeOnlyAliasUseSite: () => isValidTypeOnlyAliasUseSite,
+ isValueSignatureDeclaration: () => isValueSignatureDeclaration,
+ isVarConst: () => isVarConst,
+ isVariableDeclaration: () => isVariableDeclaration,
+ isVariableDeclarationInVariableStatement: () => isVariableDeclarationInVariableStatement,
+ isVariableDeclarationInitializedToBareOrAccessedRequire: () => isVariableDeclarationInitializedToBareOrAccessedRequire,
+ isVariableDeclarationInitializedToRequire: () => isVariableDeclarationInitializedToRequire,
+ isVariableDeclarationList: () => isVariableDeclarationList,
+ isVariableLike: () => isVariableLike,
+ isVariableLikeOrAccessor: () => isVariableLikeOrAccessor,
+ isVariableStatement: () => isVariableStatement,
+ isVoidExpression: () => isVoidExpression,
+ isWatchSet: () => isWatchSet,
+ isWhileStatement: () => isWhileStatement,
+ isWhiteSpaceLike: () => isWhiteSpaceLike,
+ isWhiteSpaceSingleLine: () => isWhiteSpaceSingleLine,
+ isWithStatement: () => isWithStatement,
+ isWriteAccess: () => isWriteAccess,
+ isWriteOnlyAccess: () => isWriteOnlyAccess,
+ isYieldExpression: () => isYieldExpression,
+ jsxModeNeedsExplicitImport: () => jsxModeNeedsExplicitImport,
+ keywordPart: () => keywordPart,
+ last: () => last,
+ lastOrUndefined: () => lastOrUndefined,
+ length: () => length,
+ libMap: () => libMap,
+ libs: () => libs,
+ lineBreakPart: () => lineBreakPart,
+ linkNamePart: () => linkNamePart,
+ linkPart: () => linkPart,
+ linkTextPart: () => linkTextPart,
+ listFiles: () => listFiles,
+ loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
+ loadWithModeAwareCache: () => loadWithModeAwareCache,
+ makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
+ makeImport: () => makeImport,
+ makeImportIfNecessary: () => makeImportIfNecessary,
+ makeStringLiteral: () => makeStringLiteral,
+ mangleScopedPackageName: () => mangleScopedPackageName,
+ map: () => map,
+ mapAllOrFail: () => mapAllOrFail,
+ mapDefined: () => mapDefined,
+ mapDefinedEntries: () => mapDefinedEntries,
+ mapDefinedIterator: () => mapDefinedIterator,
+ mapEntries: () => mapEntries,
+ mapIterator: () => mapIterator,
+ mapOneOrMany: () => mapOneOrMany,
+ mapToDisplayParts: () => mapToDisplayParts,
+ matchFiles: () => matchFiles,
+ matchPatternOrExact: () => matchPatternOrExact,
+ matchedText: () => matchedText,
+ matchesExclude: () => matchesExclude,
+ maybeBind: () => maybeBind,
+ maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
+ memoize: () => memoize,
+ memoizeCached: () => memoizeCached,
+ memoizeOne: () => memoizeOne,
+ memoizeWeak: () => memoizeWeak,
+ metadataHelper: () => metadataHelper,
+ min: () => min,
+ minAndMax: () => minAndMax,
+ missingFileModifiedTime: () => missingFileModifiedTime,
+ modifierToFlag: () => modifierToFlag,
+ modifiersToFlags: () => modifiersToFlags,
+ moduleOptionDeclaration: () => moduleOptionDeclaration,
+ moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
+ moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
+ moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
+ moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
+ moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
+ moduleSpecifiers: () => ts_moduleSpecifiers_exports,
+ moveEmitHelpers: () => moveEmitHelpers,
+ moveRangeEnd: () => moveRangeEnd,
+ moveRangePastDecorators: () => moveRangePastDecorators,
+ moveRangePastModifiers: () => moveRangePastModifiers,
+ moveRangePos: () => moveRangePos,
+ moveSyntheticComments: () => moveSyntheticComments,
+ mutateMap: () => mutateMap,
+ mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
+ needsParentheses: () => needsParentheses,
+ needsScopeMarker: () => needsScopeMarker,
+ newCaseClauseTracker: () => newCaseClauseTracker,
+ newPrivateEnvironment: () => newPrivateEnvironment,
+ noEmitNotification: () => noEmitNotification,
+ noEmitSubstitution: () => noEmitSubstitution,
+ noTransformers: () => noTransformers,
+ noTruncationMaximumTruncationLength: () => noTruncationMaximumTruncationLength,
+ nodeCanBeDecorated: () => nodeCanBeDecorated,
+ nodeHasName: () => nodeHasName,
+ nodeIsDecorated: () => nodeIsDecorated,
+ nodeIsMissing: () => nodeIsMissing,
+ nodeIsPresent: () => nodeIsPresent,
+ nodeIsSynthesized: () => nodeIsSynthesized,
+ nodeModuleNameResolver: () => nodeModuleNameResolver,
+ nodeModulesPathPart: () => nodeModulesPathPart,
+ nodeNextJsonConfigResolver: () => nodeNextJsonConfigResolver,
+ nodeOrChildIsDecorated: () => nodeOrChildIsDecorated,
+ nodeOverlapsWithStartEnd: () => nodeOverlapsWithStartEnd,
+ nodePosToString: () => nodePosToString,
+ nodeSeenTracker: () => nodeSeenTracker,
+ nodeStartsNewLexicalEnvironment: () => nodeStartsNewLexicalEnvironment,
+ nodeToDisplayParts: () => nodeToDisplayParts,
+ noop: () => noop,
+ noopFileWatcher: () => noopFileWatcher,
+ noopPush: () => noopPush,
+ normalizePath: () => normalizePath,
+ normalizeSlashes: () => normalizeSlashes,
+ not: () => not,
+ notImplemented: () => notImplemented,
+ notImplementedResolver: () => notImplementedResolver,
+ nullNodeConverters: () => nullNodeConverters,
+ nullParenthesizerRules: () => nullParenthesizerRules,
+ nullTransformationContext: () => nullTransformationContext,
+ objectAllocator: () => objectAllocator,
+ operatorPart: () => operatorPart,
+ optionDeclarations: () => optionDeclarations,
+ optionMapToObject: () => optionMapToObject,
+ optionsAffectingProgramStructure: () => optionsAffectingProgramStructure,
+ optionsForBuild: () => optionsForBuild,
+ optionsForWatch: () => optionsForWatch,
+ optionsHaveChanges: () => optionsHaveChanges,
+ optionsHaveModuleResolutionChanges: () => optionsHaveModuleResolutionChanges,
+ or: () => or,
+ orderedRemoveItem: () => orderedRemoveItem,
+ orderedRemoveItemAt: () => orderedRemoveItemAt,
+ outFile: () => outFile,
+ packageIdToPackageName: () => packageIdToPackageName,
+ packageIdToString: () => packageIdToString,
+ padLeft: () => padLeft,
+ padRight: () => padRight,
+ paramHelper: () => paramHelper,
+ parameterIsThisKeyword: () => parameterIsThisKeyword,
+ parameterNamePart: () => parameterNamePart,
+ parseBaseNodeFactory: () => parseBaseNodeFactory,
+ parseBigInt: () => parseBigInt,
+ parseBuildCommand: () => parseBuildCommand,
+ parseCommandLine: () => parseCommandLine,
+ parseCommandLineWorker: () => parseCommandLineWorker,
+ parseConfigFileTextToJson: () => parseConfigFileTextToJson,
+ parseConfigFileWithSystem: () => parseConfigFileWithSystem,
+ parseConfigHostFromCompilerHostLike: () => parseConfigHostFromCompilerHostLike,
+ parseCustomTypeOption: () => parseCustomTypeOption,
+ parseIsolatedEntityName: () => parseIsolatedEntityName,
+ parseIsolatedJSDocComment: () => parseIsolatedJSDocComment,
+ parseJSDocTypeExpressionForTests: () => parseJSDocTypeExpressionForTests,
+ parseJsonConfigFileContent: () => parseJsonConfigFileContent,
+ parseJsonSourceFileConfigFileContent: () => parseJsonSourceFileConfigFileContent,
+ parseJsonText: () => parseJsonText,
+ parseListTypeOption: () => parseListTypeOption,
+ parseNodeFactory: () => parseNodeFactory,
+ parseNodeModuleFromPath: () => parseNodeModuleFromPath,
+ parsePackageName: () => parsePackageName,
+ parsePseudoBigInt: () => parsePseudoBigInt,
+ parseValidBigInt: () => parseValidBigInt,
+ patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
+ pathContainsNodeModules: () => pathContainsNodeModules,
+ pathIsAbsolute: () => pathIsAbsolute,
+ pathIsBareSpecifier: () => pathIsBareSpecifier,
+ pathIsRelative: () => pathIsRelative,
+ patternText: () => patternText,
+ perfLogger: () => perfLogger,
+ performIncrementalCompilation: () => performIncrementalCompilation,
+ performance: () => ts_performance_exports,
+ plainJSErrors: () => plainJSErrors,
+ positionBelongsToNode: () => positionBelongsToNode,
+ positionIsASICandidate: () => positionIsASICandidate,
+ positionIsSynthesized: () => positionIsSynthesized,
+ positionsAreOnSameLine: () => positionsAreOnSameLine,
+ preProcessFile: () => preProcessFile,
+ probablyUsesSemicolons: () => probablyUsesSemicolons,
+ processCommentPragmas: () => processCommentPragmas,
+ processPragmasIntoFields: () => processPragmasIntoFields,
+ processTaggedTemplateExpression: () => processTaggedTemplateExpression,
+ programContainsEsModules: () => programContainsEsModules,
+ programContainsModules: () => programContainsModules,
+ projectReferenceIsEqualTo: () => projectReferenceIsEqualTo,
+ propKeyHelper: () => propKeyHelper,
+ propertyNamePart: () => propertyNamePart,
+ pseudoBigIntToString: () => pseudoBigIntToString,
+ punctuationPart: () => punctuationPart,
+ pushIfUnique: () => pushIfUnique,
+ quote: () => quote,
+ quotePreferenceFromString: () => quotePreferenceFromString,
+ rangeContainsPosition: () => rangeContainsPosition,
+ rangeContainsPositionExclusive: () => rangeContainsPositionExclusive,
+ rangeContainsRange: () => rangeContainsRange,
+ rangeContainsRangeExclusive: () => rangeContainsRangeExclusive,
+ rangeContainsStartEnd: () => rangeContainsStartEnd,
+ rangeEndIsOnSameLineAsRangeStart: () => rangeEndIsOnSameLineAsRangeStart,
+ rangeEndPositionsAreOnSameLine: () => rangeEndPositionsAreOnSameLine,
+ rangeEquals: () => rangeEquals,
+ rangeIsOnSingleLine: () => rangeIsOnSingleLine,
+ rangeOfNode: () => rangeOfNode,
+ rangeOfTypeParameters: () => rangeOfTypeParameters,
+ rangeOverlapsWithStartEnd: () => rangeOverlapsWithStartEnd,
+ rangeStartIsOnSameLineAsRangeEnd: () => rangeStartIsOnSameLineAsRangeEnd,
+ rangeStartPositionsAreOnSameLine: () => rangeStartPositionsAreOnSameLine,
+ readBuilderProgram: () => readBuilderProgram,
+ readConfigFile: () => readConfigFile,
+ readHelper: () => readHelper,
+ readJson: () => readJson,
+ readJsonConfigFile: () => readJsonConfigFile,
+ readJsonOrUndefined: () => readJsonOrUndefined,
+ realizeDiagnostics: () => realizeDiagnostics,
+ reduceEachLeadingCommentRange: () => reduceEachLeadingCommentRange,
+ reduceEachTrailingCommentRange: () => reduceEachTrailingCommentRange,
+ reduceLeft: () => reduceLeft,
+ reduceLeftIterator: () => reduceLeftIterator,
+ reducePathComponents: () => reducePathComponents,
+ refactor: () => ts_refactor_exports,
+ regExpEscape: () => regExpEscape,
+ relativeComplement: () => relativeComplement,
+ removeAllComments: () => removeAllComments,
+ removeEmitHelper: () => removeEmitHelper,
+ removeExtension: () => removeExtension,
+ removeFileExtension: () => removeFileExtension,
+ removeIgnoredPath: () => removeIgnoredPath,
+ removeMinAndVersionNumbers: () => removeMinAndVersionNumbers,
+ removeOptionality: () => removeOptionality,
+ removePrefix: () => removePrefix,
+ removeSuffix: () => removeSuffix,
+ removeTrailingDirectorySeparator: () => removeTrailingDirectorySeparator,
+ repeatString: () => repeatString,
+ replaceElement: () => replaceElement,
+ resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
+ resolveConfigFileProjectName: () => resolveConfigFileProjectName,
+ resolveJSModule: () => resolveJSModule,
+ resolveModuleName: () => resolveModuleName,
+ resolveModuleNameFromCache: () => resolveModuleNameFromCache,
+ resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
+ resolvePath: () => resolvePath,
+ resolveProjectReferencePath: () => resolveProjectReferencePath,
+ resolveTripleslashReference: () => resolveTripleslashReference,
+ resolveTypeReferenceDirective: () => resolveTypeReferenceDirective,
+ resolvingEmptyArray: () => resolvingEmptyArray,
+ restHelper: () => restHelper,
+ returnFalse: () => returnFalse,
+ returnNoopFileWatcher: () => returnNoopFileWatcher,
+ returnTrue: () => returnTrue,
+ returnUndefined: () => returnUndefined,
+ returnsPromise: () => returnsPromise,
+ runInitializersHelper: () => runInitializersHelper,
+ sameFlatMap: () => sameFlatMap,
+ sameMap: () => sameMap,
+ sameMapping: () => sameMapping,
+ scanShebangTrivia: () => scanShebangTrivia,
+ scanTokenAtPosition: () => scanTokenAtPosition,
+ scanner: () => scanner,
+ screenStartingMessageCodes: () => screenStartingMessageCodes,
+ semanticDiagnosticsOptionDeclarations: () => semanticDiagnosticsOptionDeclarations,
+ serializeCompilerOptions: () => serializeCompilerOptions,
+ server: () => ts_server_exports2,
+ servicesVersion: () => servicesVersion,
+ setCommentRange: () => setCommentRange,
+ setConfigFileInOptions: () => setConfigFileInOptions,
+ setConstantValue: () => setConstantValue,
+ setEachParent: () => setEachParent,
+ setEmitFlags: () => setEmitFlags,
+ setFunctionNameHelper: () => setFunctionNameHelper,
+ setGetSourceFileAsHashVersioned: () => setGetSourceFileAsHashVersioned,
+ setIdentifierAutoGenerate: () => setIdentifierAutoGenerate,
+ setIdentifierGeneratedImportReference: () => setIdentifierGeneratedImportReference,
+ setIdentifierTypeArguments: () => setIdentifierTypeArguments,
+ setInternalEmitFlags: () => setInternalEmitFlags,
+ setLocalizedDiagnosticMessages: () => setLocalizedDiagnosticMessages,
+ setModuleDefaultHelper: () => setModuleDefaultHelper,
+ setNodeFlags: () => setNodeFlags,
+ setObjectAllocator: () => setObjectAllocator,
+ setOriginalNode: () => setOriginalNode,
+ setParent: () => setParent,
+ setParentRecursive: () => setParentRecursive,
+ setPrivateIdentifier: () => setPrivateIdentifier,
+ setResolvedModule: () => setResolvedModule,
+ setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
+ setSnippetElement: () => setSnippetElement,
+ setSourceMapRange: () => setSourceMapRange,
+ setStackTraceLimit: () => setStackTraceLimit,
+ setStartsOnNewLine: () => setStartsOnNewLine,
+ setSyntheticLeadingComments: () => setSyntheticLeadingComments,
+ setSyntheticTrailingComments: () => setSyntheticTrailingComments,
+ setSys: () => setSys,
+ setSysLog: () => setSysLog,
+ setTextRange: () => setTextRange,
+ setTextRangeEnd: () => setTextRangeEnd,
+ setTextRangePos: () => setTextRangePos,
+ setTextRangePosEnd: () => setTextRangePosEnd,
+ setTextRangePosWidth: () => setTextRangePosWidth,
+ setTokenSourceMapRange: () => setTokenSourceMapRange,
+ setTypeNode: () => setTypeNode,
+ setUILocale: () => setUILocale,
+ setValueDeclaration: () => setValueDeclaration,
+ shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
+ shouldPreserveConstEnums: () => shouldPreserveConstEnums,
+ shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
+ showModuleSpecifier: () => showModuleSpecifier,
+ signatureHasLiteralTypes: () => signatureHasLiteralTypes,
+ signatureHasRestParameter: () => signatureHasRestParameter,
+ signatureToDisplayParts: () => signatureToDisplayParts,
+ single: () => single,
+ singleElementArray: () => singleElementArray,
+ singleIterator: () => singleIterator,
+ singleOrMany: () => singleOrMany,
+ singleOrUndefined: () => singleOrUndefined,
+ skipAlias: () => skipAlias,
+ skipAssertions: () => skipAssertions,
+ skipConstraint: () => skipConstraint,
+ skipOuterExpressions: () => skipOuterExpressions,
+ skipParentheses: () => skipParentheses,
+ skipPartiallyEmittedExpressions: () => skipPartiallyEmittedExpressions,
+ skipTrivia: () => skipTrivia,
+ skipTypeChecking: () => skipTypeChecking,
+ skipTypeParentheses: () => skipTypeParentheses,
+ skipWhile: () => skipWhile,
+ sliceAfter: () => sliceAfter,
+ some: () => some,
+ sort: () => sort,
+ sortAndDeduplicate: () => sortAndDeduplicate,
+ sortAndDeduplicateDiagnostics: () => sortAndDeduplicateDiagnostics,
+ sourceFileAffectingCompilerOptions: () => sourceFileAffectingCompilerOptions,
+ sourceFileMayBeEmitted: () => sourceFileMayBeEmitted,
+ sourceMapCommentRegExp: () => sourceMapCommentRegExp,
+ sourceMapCommentRegExpDontCareLineStart: () => sourceMapCommentRegExpDontCareLineStart,
+ spacePart: () => spacePart,
+ spanMap: () => spanMap,
+ spreadArrayHelper: () => spreadArrayHelper,
+ stableSort: () => stableSort,
+ startEndContainsRange: () => startEndContainsRange,
+ startEndOverlapsWithStartEnd: () => startEndOverlapsWithStartEnd,
+ startOnNewLine: () => startOnNewLine,
+ startTracing: () => startTracing,
+ startsWith: () => startsWith,
+ startsWithDirectory: () => startsWithDirectory,
+ startsWithUnderscore: () => startsWithUnderscore,
+ startsWithUseStrict: () => startsWithUseStrict,
+ stringContains: () => stringContains,
+ stringContainsAt: () => stringContainsAt,
+ stringToToken: () => stringToToken,
+ stripQuotes: () => stripQuotes,
+ supportedDeclarationExtensions: () => supportedDeclarationExtensions,
+ supportedJSExtensions: () => supportedJSExtensions,
+ supportedJSExtensionsFlat: () => supportedJSExtensionsFlat,
+ supportedLocaleDirectories: () => supportedLocaleDirectories,
+ supportedTSExtensions: () => supportedTSExtensions,
+ supportedTSExtensionsFlat: () => supportedTSExtensionsFlat,
+ supportedTSImplementationExtensions: () => supportedTSImplementationExtensions,
+ suppressLeadingAndTrailingTrivia: () => suppressLeadingAndTrailingTrivia,
+ suppressLeadingTrivia: () => suppressLeadingTrivia,
+ suppressTrailingTrivia: () => suppressTrailingTrivia,
+ symbolEscapedNameNoDefault: () => symbolEscapedNameNoDefault,
+ symbolName: () => symbolName,
+ symbolNameNoDefault: () => symbolNameNoDefault,
+ symbolPart: () => symbolPart,
+ symbolToDisplayParts: () => symbolToDisplayParts,
+ syntaxMayBeASICandidate: () => syntaxMayBeASICandidate,
+ syntaxRequiresTrailingSemicolonOrASI: () => syntaxRequiresTrailingSemicolonOrASI,
+ sys: () => sys,
+ sysLog: () => sysLog,
+ tagNamesAreEquivalent: () => tagNamesAreEquivalent,
+ takeWhile: () => takeWhile,
+ targetOptionDeclaration: () => targetOptionDeclaration,
+ templateObjectHelper: () => templateObjectHelper,
+ testFormatSettings: () => testFormatSettings,
+ textChangeRangeIsUnchanged: () => textChangeRangeIsUnchanged,
+ textChangeRangeNewSpan: () => textChangeRangeNewSpan,
+ textChanges: () => ts_textChanges_exports,
+ textOrKeywordPart: () => textOrKeywordPart,
+ textPart: () => textPart,
+ textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
+ textSpanContainsPosition: () => textSpanContainsPosition,
+ textSpanContainsTextSpan: () => textSpanContainsTextSpan,
+ textSpanEnd: () => textSpanEnd,
+ textSpanIntersection: () => textSpanIntersection,
+ textSpanIntersectsWith: () => textSpanIntersectsWith,
+ textSpanIntersectsWithPosition: () => textSpanIntersectsWithPosition,
+ textSpanIntersectsWithTextSpan: () => textSpanIntersectsWithTextSpan,
+ textSpanIsEmpty: () => textSpanIsEmpty,
+ textSpanOverlap: () => textSpanOverlap,
+ textSpanOverlapsWith: () => textSpanOverlapsWith,
+ textSpansEqual: () => textSpansEqual,
+ textToKeywordObj: () => textToKeywordObj,
+ timestamp: () => timestamp,
+ toArray: () => toArray,
+ toBuilderFileEmit: () => toBuilderFileEmit,
+ toBuilderStateFileInfoForMultiEmit: () => toBuilderStateFileInfoForMultiEmit,
+ toEditorSettings: () => toEditorSettings,
+ toFileNameLowerCase: () => toFileNameLowerCase,
+ toLowerCase: () => toLowerCase,
+ toPath: () => toPath,
+ toProgramEmitPending: () => toProgramEmitPending,
+ tokenIsIdentifierOrKeyword: () => tokenIsIdentifierOrKeyword,
+ tokenIsIdentifierOrKeywordOrGreaterThan: () => tokenIsIdentifierOrKeywordOrGreaterThan,
+ tokenToString: () => tokenToString,
+ trace: () => trace,
+ tracing: () => tracing,
+ tracingEnabled: () => tracingEnabled,
+ transform: () => transform,
+ transformClassFields: () => transformClassFields,
+ transformDeclarations: () => transformDeclarations,
+ transformECMAScriptModule: () => transformECMAScriptModule,
+ transformES2015: () => transformES2015,
+ transformES2016: () => transformES2016,
+ transformES2017: () => transformES2017,
+ transformES2018: () => transformES2018,
+ transformES2019: () => transformES2019,
+ transformES2020: () => transformES2020,
+ transformES2021: () => transformES2021,
+ transformES5: () => transformES5,
+ transformESDecorators: () => transformESDecorators,
+ transformESNext: () => transformESNext,
+ transformGenerators: () => transformGenerators,
+ transformJsx: () => transformJsx,
+ transformLegacyDecorators: () => transformLegacyDecorators,
+ transformModule: () => transformModule,
+ transformNodeModule: () => transformNodeModule,
+ transformNodes: () => transformNodes,
+ transformSystemModule: () => transformSystemModule,
+ transformTypeScript: () => transformTypeScript,
+ transpile: () => transpile,
+ transpileModule: () => transpileModule,
+ transpileOptionValueCompilerOptions: () => transpileOptionValueCompilerOptions,
+ trimString: () => trimString,
+ trimStringEnd: () => trimStringEnd,
+ trimStringStart: () => trimStringStart,
+ tryAddToSet: () => tryAddToSet,
+ tryAndIgnoreErrors: () => tryAndIgnoreErrors,
+ tryCast: () => tryCast,
+ tryDirectoryExists: () => tryDirectoryExists,
+ tryExtractTSExtension: () => tryExtractTSExtension,
+ tryFileExists: () => tryFileExists,
+ tryGetClassExtendingExpressionWithTypeArguments: () => tryGetClassExtendingExpressionWithTypeArguments,
+ tryGetClassImplementingOrExtendingExpressionWithTypeArguments: () => tryGetClassImplementingOrExtendingExpressionWithTypeArguments,
+ tryGetDirectories: () => tryGetDirectories,
+ tryGetExtensionFromPath: () => tryGetExtensionFromPath2,
+ tryGetImportFromModuleSpecifier: () => tryGetImportFromModuleSpecifier,
+ tryGetJSDocSatisfiesTypeNode: () => tryGetJSDocSatisfiesTypeNode,
+ tryGetModuleNameFromFile: () => tryGetModuleNameFromFile,
+ tryGetModuleSpecifierFromDeclaration: () => tryGetModuleSpecifierFromDeclaration,
+ tryGetNativePerformanceHooks: () => tryGetNativePerformanceHooks,
+ tryGetPropertyAccessOrIdentifierToString: () => tryGetPropertyAccessOrIdentifierToString,
+ tryGetPropertyNameOfBindingOrAssignmentElement: () => tryGetPropertyNameOfBindingOrAssignmentElement,
+ tryGetSourceMappingURL: () => tryGetSourceMappingURL,
+ tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
+ tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
+ tryParsePattern: () => tryParsePattern,
+ tryParsePatterns: () => tryParsePatterns,
+ tryParseRawSourceMap: () => tryParseRawSourceMap,
+ tryReadDirectory: () => tryReadDirectory,
+ tryReadFile: () => tryReadFile,
+ tryRemoveDirectoryPrefix: () => tryRemoveDirectoryPrefix,
+ tryRemoveExtension: () => tryRemoveExtension,
+ tryRemovePrefix: () => tryRemovePrefix,
+ tryRemoveSuffix: () => tryRemoveSuffix,
+ typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
+ typeAliasNamePart: () => typeAliasNamePart,
+ typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
+ typeKeywords: () => typeKeywords,
+ typeParameterNamePart: () => typeParameterNamePart,
+ typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
+ typeToDisplayParts: () => typeToDisplayParts,
+ unchangedPollThresholds: () => unchangedPollThresholds,
+ unchangedTextChangeRange: () => unchangedTextChangeRange,
+ unescapeLeadingUnderscores: () => unescapeLeadingUnderscores,
+ unmangleScopedPackageName: () => unmangleScopedPackageName,
+ unorderedRemoveItem: () => unorderedRemoveItem,
+ unorderedRemoveItemAt: () => unorderedRemoveItemAt,
+ unreachableCodeIsError: () => unreachableCodeIsError,
+ unusedLabelIsError: () => unusedLabelIsError,
+ unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
+ updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
+ updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
+ updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
+ updatePackageJsonWatch: () => updatePackageJsonWatch,
+ updateResolutionField: () => updateResolutionField,
+ updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
+ updateSourceFile: () => updateSourceFile,
+ updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories,
+ usesExtensionsOnImports: () => usesExtensionsOnImports,
+ usingSingleLineStringWriter: () => usingSingleLineStringWriter,
+ utf16EncodeAsString: () => utf16EncodeAsString,
+ validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage,
+ valuesHelper: () => valuesHelper,
+ version: () => version,
+ versionMajorMinor: () => versionMajorMinor,
+ visitArray: () => visitArray,
+ visitCommaListElements: () => visitCommaListElements,
+ visitEachChild: () => visitEachChild,
+ visitFunctionBody: () => visitFunctionBody,
+ visitIterationBody: () => visitIterationBody,
+ visitLexicalEnvironment: () => visitLexicalEnvironment,
+ visitNode: () => visitNode,
+ visitNodes: () => visitNodes2,
+ visitParameterList: () => visitParameterList,
+ walkUpBindingElementsAndPatterns: () => walkUpBindingElementsAndPatterns,
+ walkUpLexicalEnvironments: () => walkUpLexicalEnvironments,
+ walkUpOuterExpressions: () => walkUpOuterExpressions,
+ walkUpParenthesizedExpressions: () => walkUpParenthesizedExpressions,
+ walkUpParenthesizedTypes: () => walkUpParenthesizedTypes,
+ walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
+ whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
+ writeCommentRange: () => writeCommentRange,
+ writeFile: () => writeFile,
+ writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
+ zipToModeAwareCache: () => zipToModeAwareCache,
+ zipWith: () => zipWith
+});
+
// src/deprecatedCompat/deprecate.ts
var enableDeprecationWarnings = true;
var typeScriptVersion2;
@@ -169330,6 +170057,97 @@ addObjectAllocatorPatcher((objectAllocator2) => {
}
});
+// src/server/_namespaces/ts.server.ts
+var ts_server_exports2 = {};
+__export(ts_server_exports2, {
+ ActionInvalidate: () => ActionInvalidate,
+ ActionPackageInstalled: () => ActionPackageInstalled,
+ ActionSet: () => ActionSet,
+ Arguments: () => Arguments,
+ AutoImportProviderProject: () => AutoImportProviderProject,
+ CharRangeSection: () => CharRangeSection,
+ CommandNames: () => CommandNames,
+ ConfigFileDiagEvent: () => ConfigFileDiagEvent,
+ ConfiguredProject: () => ConfiguredProject2,
+ Errors: () => Errors,
+ EventBeginInstallTypes: () => EventBeginInstallTypes,
+ EventEndInstallTypes: () => EventEndInstallTypes,
+ EventInitializationFailed: () => EventInitializationFailed,
+ EventTypesRegistry: () => EventTypesRegistry,
+ ExternalProject: () => ExternalProject2,
+ GcTimer: () => GcTimer,
+ InferredProject: () => InferredProject2,
+ LargeFileReferencedEvent: () => LargeFileReferencedEvent,
+ LineIndex: () => LineIndex,
+ LineLeaf: () => LineLeaf,
+ LineNode: () => LineNode,
+ LogLevel: () => LogLevel2,
+ Msg: () => Msg,
+ OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
+ Project: () => Project3,
+ ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
+ ProjectKind: () => ProjectKind,
+ ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
+ ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
+ ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
+ ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
+ ProjectService: () => ProjectService3,
+ ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
+ ScriptInfo: () => ScriptInfo,
+ ScriptVersionCache: () => ScriptVersionCache,
+ Session: () => Session3,
+ TextStorage: () => TextStorage,
+ ThrottledOperations: () => ThrottledOperations,
+ TypingsCache: () => TypingsCache,
+ allFilesAreJsOrDts: () => allFilesAreJsOrDts,
+ allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
+ asNormalizedPath: () => asNormalizedPath,
+ convertCompilerOptions: () => convertCompilerOptions,
+ convertFormatOptions: () => convertFormatOptions,
+ convertScriptKindName: () => convertScriptKindName,
+ convertTypeAcquisition: () => convertTypeAcquisition,
+ convertUserPreferences: () => convertUserPreferences,
+ convertWatchOptions: () => convertWatchOptions,
+ countEachFileTypes: () => countEachFileTypes,
+ createInstallTypingsRequest: () => createInstallTypingsRequest,
+ createModuleSpecifierCache: () => createModuleSpecifierCache,
+ createNormalizedPathMap: () => createNormalizedPathMap,
+ createPackageJsonCache: () => createPackageJsonCache,
+ createSortedArray: () => createSortedArray2,
+ emptyArray: () => emptyArray2,
+ findArgument: () => findArgument,
+ forEachResolvedProjectReferenceProject: () => forEachResolvedProjectReferenceProject,
+ formatMessage: () => formatMessage2,
+ getBaseConfigFileName: () => getBaseConfigFileName,
+ getLocationInNewDocument: () => getLocationInNewDocument,
+ hasArgument: () => hasArgument,
+ hasNoTypeScriptSource: () => hasNoTypeScriptSource,
+ indent: () => indent2,
+ isConfigFile: () => isConfigFile,
+ isConfiguredProject: () => isConfiguredProject,
+ isDynamicFileName: () => isDynamicFileName,
+ isExternalProject: () => isExternalProject,
+ isInferredProject: () => isInferredProject,
+ isInferredProjectName: () => isInferredProjectName,
+ makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
+ makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
+ makeInferredProjectName: () => makeInferredProjectName,
+ maxFileSize: () => maxFileSize,
+ maxProgramSizeForNonTsFiles: () => maxProgramSizeForNonTsFiles,
+ normalizedPathToPath: () => normalizedPathToPath,
+ nowString: () => nowString,
+ nullCancellationToken: () => nullCancellationToken,
+ nullTypingsInstaller: () => nullTypingsInstaller,
+ projectContainsInfoDirectly: () => projectContainsInfoDirectly,
+ protocol: () => ts_server_protocol_exports,
+ removeSorted: () => removeSorted,
+ stringifyIndented: () => stringifyIndented,
+ toEvent: () => toEvent,
+ toNormalizedPath: () => toNormalizedPath,
+ tryConvertScriptKindName: () => tryConvertScriptKindName,
+ updateProjectIfDirty: () => updateProjectIfDirty
+});
+
// src/server/utilitiesPublic.ts
var LogLevel2 = /* @__PURE__ */ ((LogLevel3) => {
LogLevel3[LogLevel3["terse"] = 0] = "terse";
@@ -176305,6 +177123,10 @@ function getPerProjectReferences(projects, defaultProject, initialLocation, isFo
continue;
if (isLocationProjectReferenceRedirect(project, location))
continue;
+ updateProjectIfDirty(project);
+ if (!project.containsFile(toNormalizedPath(location.fileName))) {
+ continue;
+ }
const projectResults = searchPosition(project, location);
resultsMap.set(project, projectResults != null ? projectResults : emptyArray2);
searchedProjectKeys.add(getProjectKey(project));
@@ -179955,6 +180777,99 @@ var LineLeaf = class {
}
};
+// src/tsserver/_namespaces/ts.server.ts
+var ts_server_exports3 = {};
+__export(ts_server_exports3, {
+ ActionInvalidate: () => ActionInvalidate,
+ ActionPackageInstalled: () => ActionPackageInstalled,
+ ActionSet: () => ActionSet,
+ Arguments: () => Arguments,
+ AutoImportProviderProject: () => AutoImportProviderProject,
+ CharRangeSection: () => CharRangeSection,
+ CommandNames: () => CommandNames,
+ ConfigFileDiagEvent: () => ConfigFileDiagEvent,
+ ConfiguredProject: () => ConfiguredProject2,
+ Errors: () => Errors,
+ EventBeginInstallTypes: () => EventBeginInstallTypes,
+ EventEndInstallTypes: () => EventEndInstallTypes,
+ EventInitializationFailed: () => EventInitializationFailed,
+ EventTypesRegistry: () => EventTypesRegistry,
+ ExternalProject: () => ExternalProject2,
+ GcTimer: () => GcTimer,
+ InferredProject: () => InferredProject2,
+ LargeFileReferencedEvent: () => LargeFileReferencedEvent,
+ LineIndex: () => LineIndex,
+ LineLeaf: () => LineLeaf,
+ LineNode: () => LineNode,
+ LogLevel: () => LogLevel2,
+ Msg: () => Msg,
+ OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
+ Project: () => Project3,
+ ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
+ ProjectKind: () => ProjectKind,
+ ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
+ ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
+ ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
+ ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
+ ProjectService: () => ProjectService3,
+ ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
+ ScriptInfo: () => ScriptInfo,
+ ScriptVersionCache: () => ScriptVersionCache,
+ Session: () => Session3,
+ TextStorage: () => TextStorage,
+ ThrottledOperations: () => ThrottledOperations,
+ TypingsCache: () => TypingsCache,
+ allFilesAreJsOrDts: () => allFilesAreJsOrDts,
+ allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
+ asNormalizedPath: () => asNormalizedPath,
+ convertCompilerOptions: () => convertCompilerOptions,
+ convertFormatOptions: () => convertFormatOptions,
+ convertScriptKindName: () => convertScriptKindName,
+ convertTypeAcquisition: () => convertTypeAcquisition,
+ convertUserPreferences: () => convertUserPreferences,
+ convertWatchOptions: () => convertWatchOptions,
+ countEachFileTypes: () => countEachFileTypes,
+ createInstallTypingsRequest: () => createInstallTypingsRequest,
+ createModuleSpecifierCache: () => createModuleSpecifierCache,
+ createNormalizedPathMap: () => createNormalizedPathMap,
+ createPackageJsonCache: () => createPackageJsonCache,
+ createSortedArray: () => createSortedArray2,
+ emptyArray: () => emptyArray2,
+ findArgument: () => findArgument,
+ forEachResolvedProjectReferenceProject: () => forEachResolvedProjectReferenceProject,
+ formatMessage: () => formatMessage2,
+ getBaseConfigFileName: () => getBaseConfigFileName,
+ getLocationInNewDocument: () => getLocationInNewDocument,
+ getLogLevel: () => getLogLevel,
+ hasArgument: () => hasArgument,
+ hasNoTypeScriptSource: () => hasNoTypeScriptSource,
+ indent: () => indent2,
+ initializeNodeSystem: () => initializeNodeSystem,
+ isConfigFile: () => isConfigFile,
+ isConfiguredProject: () => isConfiguredProject,
+ isDynamicFileName: () => isDynamicFileName,
+ isExternalProject: () => isExternalProject,
+ isInferredProject: () => isInferredProject,
+ isInferredProjectName: () => isInferredProjectName,
+ makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
+ makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
+ makeInferredProjectName: () => makeInferredProjectName,
+ maxFileSize: () => maxFileSize,
+ maxProgramSizeForNonTsFiles: () => maxProgramSizeForNonTsFiles,
+ normalizedPathToPath: () => normalizedPathToPath,
+ nowString: () => nowString,
+ nullCancellationToken: () => nullCancellationToken,
+ nullTypingsInstaller: () => nullTypingsInstaller,
+ projectContainsInfoDirectly: () => projectContainsInfoDirectly,
+ protocol: () => ts_server_protocol_exports,
+ removeSorted: () => removeSorted,
+ stringifyIndented: () => stringifyIndented,
+ toEvent: () => toEvent,
+ toNormalizedPath: () => toNormalizedPath,
+ tryConvertScriptKindName: () => tryConvertScriptKindName,
+ updateProjectIfDirty: () => updateProjectIfDirty
+});
+
// src/tsserver/nodeServer.ts
function parseLoggingEnvironmentString(logEnvStr) {
if (!logEnvStr) {
@@ -180997,6 +181912,7 @@ start(initializeNodeSystem(), require("os").platform());
consumesNodeCoreModules,
contains,
containsIgnoredPath,
+ containsObjectRestOrSpread,
containsParseError,
containsPath,
convertCompilerOptionsForTelemetry,
@@ -181335,6 +182251,7 @@ start(initializeNodeSystem(), require("os").platform());
getCommonSourceDirectoryOfConfig,
getCompilerOptionValue,
getCompilerOptionsDiffValue,
+ getConditions,
getConfigFileParsingDiagnostics,
getConstantValue,
getContainerNode,
@@ -182016,6 +182933,7 @@ start(initializeNodeSystem(), require("os").platform());
isGetOrSetAccessorDeclaration,
isGlobalDeclaration,
isGlobalScopeAugmentation,
+ isGrammarError,
isHeritageClause,
isHoistedFunction,
isHoistedVariableStatement,
@@ -182358,6 +183276,7 @@ start(initializeNodeSystem(), require("os").platform());
isString,
isStringAKeyword,
isStringANonContextualKeyword,
+ isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted,
isStringLiteral,
isStringLiteralLike,
@@ -182522,6 +183441,7 @@ start(initializeNodeSystem(), require("os").platform());
mutateMapSkippingNewValues,
needsParentheses,
needsScopeMarker,
+ newCaseClauseTracker,
newPrivateEnvironment,
noEmitNotification,
noEmitSubstitution,
@@ -182895,7 +183815,6 @@ start(initializeNodeSystem(), require("os").platform());
typeAcquisitionDeclarations,
typeAliasNamePart,
typeDirectiveIsEqualTo,
- typeHasCallOrConstructSignatures,
typeKeywords,
typeParameterNamePart,
typeReferenceResolutionNameAndModeGetter,
diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
index 65f9a35b41dc6..34006d63b2ea5 100644
--- a/lib/tsserverlibrary.d.ts
+++ b/lib/tsserverlibrary.d.ts
@@ -6310,6 +6310,7 @@ declare namespace ts {
}
interface TypeChecker {
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
+ getTypeOfSymbol(symbol: Symbol): Type;
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getPropertiesOfType(type: Type): Symbol[];
getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
@@ -6400,6 +6401,21 @@ declare namespace ts {
getApparentType(type: Type): Type;
getBaseConstraintOfType(type: Type): Type | undefined;
getDefaultFromTypeParameter(type: Type): Type | undefined;
+ /**
+ * True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
+ * This function will _not_ return true if passed a type which
+ * extends `Array` (for example, the TypeScript AST's `NodeArray` type).
+ */
+ isArrayType(type: Type): boolean;
+ /**
+ * True if this type is a tuple type. This function will _not_ return true if
+ * passed a type which extends from a tuple.
+ */
+ isTupleType(type: Type): boolean;
+ /**
+ * True if this type is assignable to `ReadonlyArray`.
+ */
+ isArrayLikeType(type: Type): boolean;
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
/**
* Depending on the operation performed, it may be appropriate to throw away the checker
@@ -6659,7 +6675,8 @@ declare namespace ts {
TemplateLiteral = 134217728,
StringMapping = 268435456,
Literal = 2944,
- Unit = 109440,
+ Unit = 109472,
+ Freshable = 2976,
StringOrNumberLiteral = 384,
PossiblyFalsy = 117724,
StringLike = 402653316,
@@ -6711,10 +6728,12 @@ declare namespace ts {
isClass(): this is InterfaceType;
isIndexType(): this is IndexType;
}
- interface LiteralType extends Type {
+ interface FreshableType extends Type {
+ freshType: FreshableType;
+ regularType: FreshableType;
+ }
+ interface LiteralType extends FreshableType {
value: string | number | PseudoBigInt;
- freshType: LiteralType;
- regularType: LiteralType;
}
interface UniqueESSymbolType extends Type {
symbol: Symbol;
@@ -6729,7 +6748,7 @@ declare namespace ts {
interface BigIntLiteralType extends LiteralType {
value: PseudoBigInt;
}
- interface EnumType extends Type {
+ interface EnumType extends FreshableType {
}
enum ObjectFlags {
None = 0,
@@ -8673,7 +8692,6 @@ declare namespace ts {
parent: ConstructorDeclaration;
name: Identifier;
};
- function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind): boolean;
/** @deprecated */
function createUnparsedSourceFile(text: string): UnparsedSource;
/** @deprecated */
@@ -9128,7 +9146,6 @@ declare namespace ts {
function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
- function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string): boolean | "" | undefined;
interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache, NonRelativeNameResolutionCache, PackageJsonInfoCache {
}
interface ModeAwareCache {
@@ -10056,6 +10073,13 @@ declare namespace ts {
*/
triggerCharacter?: CompletionsTriggerCharacter;
triggerKind?: CompletionTriggerKind;
+ /**
+ * Include a `symbol` property on each completion entry object.
+ * Symbols reference cyclic data structures and sometimes an entire TypeChecker instance,
+ * so use caution when serializing or retaining completion entries retrieved with this option.
+ * @default false
+ */
+ includeSymbol?: boolean;
/** @deprecated Use includeCompletionsForModuleExports */
includeExternalModuleExports?: boolean;
/** @deprecated Use includeCompletionsWithInsertText */
@@ -10576,6 +10600,7 @@ declare namespace ts {
* in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.
*/
exportName: string;
+ exportMapKey?: string;
moduleSpecifier?: string;
/** The file name declaring the export's module symbol, if it was an external module */
fileName?: string;
@@ -10585,7 +10610,6 @@ declare namespace ts {
isPackageJsonImport?: true;
}
interface CompletionEntryDataUnresolved extends CompletionEntryDataAutoImport {
- /** The key in the `ExportMapCache` where the completion entry's `SymbolExportInfo[]` is found */
exportMapKey: string;
}
interface CompletionEntryDataResolved extends CompletionEntryDataAutoImport {
@@ -10613,6 +10637,12 @@ declare namespace ts {
isFromUncheckedFile?: true;
isPackageJsonImport?: true;
isImportStatementCompletion?: true;
+ /**
+ * For API purposes.
+ * Included for non-string completions only when `includeSymbol: true` option is passed to `getCompletionsAtPosition`.
+ * @example Get declaration of completion: `symbol.valueDeclaration`
+ */
+ symbol?: Symbol;
/**
* A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
* that allows TS Server to look up the symbol represented by the completion item, disambiguating
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
index f16c5a06498a0..a69e846e71fc5 100644
--- a/lib/tsserverlibrary.js
+++ b/lib/tsserverlibrary.js
@@ -18,17 +18,10 @@ and limitations under the License.
var ts = (() => {
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
- }) : x)(function(x) {
- if (typeof require !== "undefined")
- return require.apply(this, arguments);
- throw new Error('Dynamic require of "' + x + '" is not supported');
- });
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
- var __commonJS = (cb, mod) => function __require2() {
+ var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
@@ -42,7 +35,7 @@ var ts = (() => {
"src/compiler/corePublic.ts"() {
"use strict";
versionMajorMinor = "5.0";
- version = `${versionMajorMinor}.0-beta`;
+ version = `${versionMajorMinor}.1-rc`;
Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3123,7 +3116,7 @@ ${lanes.join("\n")}
init_ts2();
nativePerformanceHooks = tryGetWebPerformanceHooks() || tryGetNodePerformanceHooks();
nativePerformance = nativePerformanceHooks == null ? void 0 : nativePerformanceHooks.performance;
- timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +new Date();
+ timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +/* @__PURE__ */ new Date();
}
});
@@ -3196,6 +3189,9 @@ ${lanes.join("\n")}
counts.set(markName, count + 1);
marks.set(markName, timestamp());
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
+ if (typeof onProfilerEvent === "function") {
+ onProfilerEvent(markName);
+ }
}
}
function measure(measureName, startMarkName, endMarkName) {
@@ -4481,13 +4477,14 @@ ${lanes.join("\n")}
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -5496,7 +5493,7 @@ ${lanes.join("\n")}
function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
const watcher = fsWatch(
dirName,
- FileSystemEntryKind.Directory,
+ 1 /* Directory */,
(_eventName, relativeFileName, modifiedTime) => {
if (!isString(relativeFileName))
return;
@@ -5694,7 +5691,7 @@ ${lanes.join("\n")}
}
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
const parentWatcher = cache.get(dirPath);
- if (parentWatcher && fileSystemEntryExists(dirName, FileSystemEntryKind.Directory)) {
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
return;
}
@@ -5759,7 +5756,7 @@ ${lanes.join("\n")}
return false;
let newChildWatches;
const hasChanges = enumerateInsertsAndDeletes(
- fileSystemEntryExists(parentDir, FileSystemEntryKind.Directory) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
+ fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
const childFullName = getNormalizedAbsolutePath(child, parentDir);
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
}) : emptyArray,
@@ -6179,7 +6176,7 @@ ${lanes.join("\n")}
PollingInterval3[PollingInterval3["Low"] = 250] = "Low";
return PollingInterval3;
})(PollingInterval || {});
- missingFileModifiedTime = new Date(0);
+ missingFileModifiedTime = /* @__PURE__ */ new Date(0);
defaultChunkLevels = { Low: 32, Medium: 64, High: 256 };
pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
@@ -6390,7 +6387,7 @@ ${lanes.join("\n")}
if (!err) {
try {
if ((_a2 = statSync(profilePath)) == null ? void 0 : _a2.isDirectory()) {
- profilePath = _path.join(profilePath, `${new Date().toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
+ profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
}
} catch (e) {
}
@@ -7342,7 +7339,6 @@ ${lanes.join("\n")}
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* 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."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* 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}')'?"),
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* 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'."),
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -7471,6 +7467,7 @@ ${lanes.join("\n")}
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, 3 /* Message */, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),
_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
+ Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7864,7 +7861,6 @@ ${lanes.join("\n")}
Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -7988,7 +7984,7 @@ ${lanes.join("\n")}
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -8180,13 +8176,11 @@ ${lanes.join("\n")}
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
- Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
+ Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
- Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
- Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
- Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify 'ignoreDeprecations: "{2}"' to silence this error.`),
+ Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
@@ -8274,7 +8268,7 @@ ${lanes.join("\n")}
Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
- File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
+ File_0_exists_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exists_use_it_as_a_name_resolution_result_6097", "File '{0}' exists - use it as a name resolution result."),
Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
@@ -8564,6 +8558,11 @@ ${lanes.join("\n")}
Use_the_package_json_imports_field_when_resolving_imports: diag(6409, 3 /* Message */, "Use_the_package_json_imports_field_when_resolving_imports_6409", "Use the package.json 'imports' field when resolving imports."),
Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -8725,6 +8724,7 @@ ${lanes.join("\n")}
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
+ This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
@@ -8822,7 +8822,7 @@ ${lanes.join("\n")}
You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
- Decorators_must_come_after_export_or_export_default_in_JavaScript_files: diag(8038, 1 /* Error */, "Decorators_must_come_after_export_or_export_default_in_JavaScript_files_8038", "Decorators must come after 'export' or 'export default' in JavaScript files."),
+ Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -9614,18 +9614,18 @@ ${lanes.join("\n")}
return true;
}
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start, length2) {
- let text = textInitial;
- let pos;
- let end;
- let startPos;
- let tokenPos;
- let token;
- let tokenValue;
- let tokenFlags;
- let commentDirectives;
- let inJSDocType = 0;
+ var text = textInitial;
+ var pos;
+ var end;
+ var startPos;
+ var tokenPos;
+ var token;
+ var tokenValue;
+ var tokenFlags;
+ var commentDirectives;
+ var inJSDocType = 0;
setText(text, start, length2);
- const scanner2 = {
+ var scanner2 = {
getStartPos: () => startPos,
getTextPos: () => pos,
getToken: () => token,
@@ -12804,7 +12804,7 @@ ${lanes.join("\n")}
return (symbol.flags & 33554432 /* Transient */) !== 0;
}
function createSingleLineStringWriter() {
- let str = "";
+ var str = "";
const writeText = (text) => str += text;
return {
getText: () => str,
@@ -13025,6 +13025,36 @@ ${lanes.join("\n")}
function nodeIsPresent(node) {
return !nodeIsMissing(node);
}
+ function isGrammarError(parent2, child) {
+ if (isTypeParameterDeclaration(parent2))
+ return child === parent2.expression;
+ if (isClassStaticBlockDeclaration(parent2))
+ return child === parent2.modifiers;
+ if (isPropertySignature(parent2))
+ return child === parent2.initializer;
+ if (isPropertyDeclaration(parent2))
+ return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
+ if (isPropertyAssignment(parent2))
+ return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ if (isShorthandPropertyAssignment(parent2))
+ return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ if (isMethodDeclaration(parent2))
+ return child === parent2.exclamationToken;
+ if (isConstructorDeclaration(parent2))
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isGetAccessorDeclaration(parent2))
+ return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isSetAccessorDeclaration(parent2))
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isNamespaceExportDeclaration(parent2))
+ return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ return false;
+ }
+ function isGrammarErrorElement(nodeArray, child, isElement) {
+ if (!nodeArray || isArray(child) || !isElement(child))
+ return false;
+ return contains(nodeArray, child);
+ }
function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
if (from === void 0 || from.length === 0)
return to;
@@ -13168,101 +13198,400 @@ ${lanes.join("\n")}
return emitNode && emitNode.internalFlags || 0;
}
function getScriptTargetFeatures() {
- return {
- es2015: {
- Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"],
- RegExp: ["flags", "sticky", "unicode"],
- Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"],
- ArrayConstructor: ["from", "of"],
- ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"],
- NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"],
- Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"],
- Map: ["entries", "keys", "values"],
- Set: ["entries", "keys", "values"],
- Promise: emptyArray,
- PromiseConstructor: ["all", "race", "reject", "resolve"],
- Symbol: ["for", "keyFor"],
- WeakMap: ["entries", "keys", "values"],
- WeakSet: ["entries", "keys", "values"],
- Iterator: emptyArray,
- AsyncIterator: emptyArray,
- String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"],
- StringConstructor: ["fromCodePoint", "raw"]
- },
- es2016: {
- Array: ["includes"]
- },
- es2017: {
- Atomics: emptyArray,
- SharedArrayBuffer: emptyArray,
- String: ["padStart", "padEnd"],
- ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"],
- DateTimeFormat: ["formatToParts"]
- },
- es2018: {
- Promise: ["finally"],
- RegExpMatchArray: ["groups"],
- RegExpExecArray: ["groups"],
- RegExp: ["dotAll"],
- Intl: ["PluralRules"],
- AsyncIterable: emptyArray,
- AsyncIterableIterator: emptyArray,
- AsyncGenerator: emptyArray,
- AsyncGeneratorFunction: emptyArray,
- NumberFormat: ["formatToParts"]
- },
- es2019: {
- Array: ["flat", "flatMap"],
- ObjectConstructor: ["fromEntries"],
- String: ["trimStart", "trimEnd", "trimLeft", "trimRight"],
- Symbol: ["description"]
- },
- es2020: {
- BigInt: emptyArray,
- BigInt64Array: emptyArray,
- BigUint64Array: emptyArray,
- PromiseConstructor: ["allSettled"],
- SymbolConstructor: ["matchAll"],
- String: ["matchAll"],
- DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"],
- RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"]
- },
- es2021: {
- PromiseConstructor: ["any"],
- String: ["replaceAll"]
- },
- es2022: {
- Array: ["at"],
- String: ["at"],
- Int8Array: ["at"],
- Uint8Array: ["at"],
- Uint8ClampedArray: ["at"],
- Int16Array: ["at"],
- Uint16Array: ["at"],
- Int32Array: ["at"],
- Uint32Array: ["at"],
- Float32Array: ["at"],
- Float64Array: ["at"],
- BigInt64Array: ["at"],
- BigUint64Array: ["at"],
- ObjectConstructor: ["hasOwn"],
- Error: ["cause"]
- },
- es2023: {
- Array: ["findLastIndex", "findLast"],
- Int8Array: ["findLastIndex", "findLast"],
- Uint8Array: ["findLastIndex", "findLast"],
- Uint8ClampedArray: ["findLastIndex", "findLast"],
- Int16Array: ["findLastIndex", "findLast"],
- Uint16Array: ["findLastIndex", "findLast"],
- Int32Array: ["findLastIndex", "findLast"],
- Uint32Array: ["findLastIndex", "findLast"],
- Float32Array: ["findLastIndex", "findLast"],
- Float64Array: ["findLastIndex", "findLast"],
- BigInt64Array: ["findLastIndex", "findLast"],
- BigUint64Array: ["findLastIndex", "findLast"]
- }
- };
+ return new Map(Object.entries({
+ Array: new Map(Object.entries({
+ es2015: [
+ "find",
+ "findIndex",
+ "fill",
+ "copyWithin",
+ "entries",
+ "keys",
+ "values"
+ ],
+ es2016: [
+ "includes"
+ ],
+ es2019: [
+ "flat",
+ "flatMap"
+ ],
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Iterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ AsyncIterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ Atomics: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ SharedArrayBuffer: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ AsyncIterable: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncIterableIterator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGenerator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGeneratorFunction: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ RegExp: new Map(Object.entries({
+ es2015: [
+ "flags",
+ "sticky",
+ "unicode"
+ ],
+ es2018: [
+ "dotAll"
+ ]
+ })),
+ Reflect: new Map(Object.entries({
+ es2015: [
+ "apply",
+ "construct",
+ "defineProperty",
+ "deleteProperty",
+ "get",
+ " getOwnPropertyDescriptor",
+ "getPrototypeOf",
+ "has",
+ "isExtensible",
+ "ownKeys",
+ "preventExtensions",
+ "set",
+ "setPrototypeOf"
+ ]
+ })),
+ ArrayConstructor: new Map(Object.entries({
+ es2015: [
+ "from",
+ "of"
+ ]
+ })),
+ ObjectConstructor: new Map(Object.entries({
+ es2015: [
+ "assign",
+ "getOwnPropertySymbols",
+ "keys",
+ "is",
+ "setPrototypeOf"
+ ],
+ es2017: [
+ "values",
+ "entries",
+ "getOwnPropertyDescriptors"
+ ],
+ es2019: [
+ "fromEntries"
+ ],
+ es2022: [
+ "hasOwn"
+ ]
+ })),
+ NumberConstructor: new Map(Object.entries({
+ es2015: [
+ "isFinite",
+ "isInteger",
+ "isNaN",
+ "isSafeInteger",
+ "parseFloat",
+ "parseInt"
+ ]
+ })),
+ Math: new Map(Object.entries({
+ es2015: [
+ "clz32",
+ "imul",
+ "sign",
+ "log10",
+ "log2",
+ "log1p",
+ "expm1",
+ "cosh",
+ "sinh",
+ "tanh",
+ "acosh",
+ "asinh",
+ "atanh",
+ "hypot",
+ "trunc",
+ "fround",
+ "cbrt"
+ ]
+ })),
+ Map: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ Set: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ PromiseConstructor: new Map(Object.entries({
+ es2015: [
+ "all",
+ "race",
+ "reject",
+ "resolve"
+ ],
+ es2020: [
+ "allSettled"
+ ],
+ es2021: [
+ "any"
+ ]
+ })),
+ Symbol: new Map(Object.entries({
+ es2015: [
+ "for",
+ "keyFor"
+ ],
+ es2019: [
+ "description"
+ ]
+ })),
+ WeakMap: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ WeakSet: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ String: new Map(Object.entries({
+ es2015: [
+ "codePointAt",
+ "includes",
+ "endsWith",
+ "normalize",
+ "repeat",
+ "startsWith",
+ "anchor",
+ "big",
+ "blink",
+ "bold",
+ "fixed",
+ "fontcolor",
+ "fontsize",
+ "italics",
+ "link",
+ "small",
+ "strike",
+ "sub",
+ "sup"
+ ],
+ es2017: [
+ "padStart",
+ "padEnd"
+ ],
+ es2019: [
+ "trimStart",
+ "trimEnd",
+ "trimLeft",
+ "trimRight"
+ ],
+ es2020: [
+ "matchAll"
+ ],
+ es2021: [
+ "replaceAll"
+ ],
+ es2022: [
+ "at"
+ ]
+ })),
+ StringConstructor: new Map(Object.entries({
+ es2015: [
+ "fromCodePoint",
+ "raw"
+ ]
+ })),
+ DateTimeFormat: new Map(Object.entries({
+ es2017: [
+ "formatToParts"
+ ]
+ })),
+ Promise: new Map(Object.entries({
+ es2015: emptyArray,
+ es2018: [
+ "finally"
+ ]
+ })),
+ RegExpMatchArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ RegExpExecArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ Intl: new Map(Object.entries({
+ es2018: [
+ "PluralRules"
+ ]
+ })),
+ NumberFormat: new Map(Object.entries({
+ es2018: [
+ "formatToParts"
+ ]
+ })),
+ SymbolConstructor: new Map(Object.entries({
+ es2020: [
+ "matchAll"
+ ]
+ })),
+ DataView: new Map(Object.entries({
+ es2020: [
+ "setBigInt64",
+ "setBigUint64",
+ "getBigInt64",
+ "getBigUint64"
+ ]
+ })),
+ BigInt: new Map(Object.entries({
+ es2020: emptyArray
+ })),
+ RelativeTimeFormat: new Map(Object.entries({
+ es2020: [
+ "format",
+ "formatToParts",
+ "resolvedOptions"
+ ]
+ })),
+ Int8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8ClampedArray: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float64Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigInt64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigUint64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Error: new Map(Object.entries({
+ es2022: [
+ "cause"
+ ]
+ }))
+ }));
}
function getLiteralText(node, sourceFile, flags) {
var _a2;
@@ -13373,7 +13702,7 @@ ${lanes.join("\n")}
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
}
function isEffectiveExternalModule(node, compilerOptions) {
- return isExternalModule(node) || compilerOptions.isolatedModules || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
+ return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
}
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
switch (node.scriptKind) {
@@ -13394,7 +13723,7 @@ ${lanes.join("\n")}
if (startsWithUseStrict(node.statements)) {
return true;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
return true;
}
@@ -15927,12 +16256,12 @@ ${lanes.join("\n")}
return stringContains(version, "-dev") || stringContains(version, "-insiders");
}
function createTextWriter(newLine) {
- let output;
- let indent3;
- let lineStart;
- let lineCount;
- let linePos;
- let hasTrailingComment = false;
+ var output;
+ var indent3;
+ var lineStart;
+ var lineCount;
+ var linePos;
+ var hasTrailingComment = false;
function updateLineCountAndPosFor(s) {
const lineStartsOfS = computeLineStarts(s);
if (lineStartsOfS.length > 1) {
@@ -17055,10 +17384,10 @@ ${lanes.join("\n")}
return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
}
function isWriteOnlyAccess(node) {
- return accessKind(node) === AccessKind.Write;
+ return accessKind(node) === 1 /* Write */;
}
function isWriteAccess(node) {
- return accessKind(node) !== AccessKind.Read;
+ return accessKind(node) !== 0 /* Read */;
}
function accessKind(node) {
const { parent: parent2 } = node;
@@ -17159,9 +17488,6 @@ ${lanes.join("\n")}
function getObjectFlags(type) {
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
}
- function typeHasCallOrConstructSignatures(type, checker) {
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
- }
function forSomeAncestorDirectory(directory, callback) {
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
}
@@ -17726,7 +18052,7 @@ ${lanes.join("\n")}
return !!(compilerOptions.declaration || compilerOptions.composite);
}
function shouldPreserveConstEnums(compilerOptions) {
- return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
+ return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
}
function isIncrementalCompilation(options) {
return !!(options.incremental || options.composite);
@@ -18254,7 +18580,7 @@ ${lanes.join("\n")}
}
function rangeOfTypeParameters(sourceFile, typeParameters) {
const pos = typeParameters.pos - 1;
- const end = skipTrivia(sourceFile.text, typeParameters.end) + 1;
+ const end = Math.min(sourceFile.text.length, skipTrivia(sourceFile.text, typeParameters.end) + 1);
return { pos, end };
}
function skipTypeChecking(sourceFile, options, host) {
@@ -18725,7 +19051,7 @@ ${lanes.join("\n")}
const tag = getJSDocSatisfiesTag(node);
return tag && tag.typeExpression && tag.typeExpression.type;
}
- var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
+ var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
var init_utilities = __esm({
"src/compiler/utilities.ts"() {
"use strict";
@@ -18829,12 +19155,6 @@ ${lanes.join("\n")}
base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
carriageReturnLineFeed = "\r\n";
lineFeed = "\n";
- AccessKind = /* @__PURE__ */ ((AccessKind2) => {
- AccessKind2[AccessKind2["Read"] = 0] = "Read";
- AccessKind2[AccessKind2["Write"] = 1] = "Write";
- AccessKind2[AccessKind2["ReadWrite"] = 2] = "ReadWrite";
- return AccessKind2;
- })(AccessKind || {});
objectAllocator = {
getNodeConstructor: () => Node4,
getTokenConstructor: () => Token,
@@ -21518,24 +21838,7 @@ ${lanes.join("\n")}
return node;
}
function propagateAssignmentPatternFlags(node) {
- if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
- return 65536 /* ContainsObjectRestOrSpread */;
- if (node.transformFlags & 128 /* ContainsES2018 */) {
- for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
- const target = getTargetOfBindingOrAssignmentElement(element);
- if (target && isAssignmentPattern(target)) {
- if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
- return 65536 /* ContainsObjectRestOrSpread */;
- }
- if (target.transformFlags & 128 /* ContainsES2018 */) {
- const flags2 = propagateAssignmentPatternFlags(target);
- if (flags2)
- return flags2;
- }
- }
- }
- }
- return 0 /* None */;
+ return containsObjectRestOrSpread(node) ? 65536 /* ContainsObjectRestOrSpread */ : 0 /* None */;
}
function updateBinaryExpression(node, left, operator, right) {
return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node;
@@ -24558,14 +24861,114 @@ ${lanes.join("\n")}
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name)
]);
}
+ function createESDecorateClassElementAccessGetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "get",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ accessor
+ )
+ );
+ }
+ function createESDecorateClassElementAccessSetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "set",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ ),
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("value")
+ )
+ ],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBlock([
+ factory2.createExpressionStatement(
+ factory2.createAssignment(
+ accessor,
+ factory2.createIdentifier("value")
+ )
+ )
+ ])
+ )
+ );
+ }
+ function createESDecorateClassElementAccessHasMethod(elementName) {
+ const propertyName = elementName.computed ? elementName.name : isIdentifier(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name;
+ return factory2.createPropertyAssignment(
+ "has",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBinaryExpression(
+ propertyName,
+ 101 /* InKeyword */,
+ factory2.createIdentifier("obj")
+ )
+ )
+ );
+ }
+ function createESDecorateClassElementAccessObject(name, access) {
+ const properties = [];
+ properties.push(createESDecorateClassElementAccessHasMethod(name));
+ if (access.get)
+ properties.push(createESDecorateClassElementAccessGetMethod(name));
+ if (access.set)
+ properties.push(createESDecorateClassElementAccessSetMethod(name));
+ return factory2.createObjectLiteralExpression(properties);
+ }
function createESDecorateClassElementContextObject(contextIn) {
return factory2.createObjectLiteralExpression([
factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral(contextIn.kind)),
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory2.createStringLiteralFromNode(contextIn.name.name)),
factory2.createPropertyAssignment(factory2.createIdentifier("static"), contextIn.static ? factory2.createTrue() : factory2.createFalse()),
- factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse())
- // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494
- // factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
+ factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse()),
+ factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
]);
}
function createESDecorateContextObject(contextIn) {
@@ -26773,7 +27176,7 @@ ${lanes.join("\n")}
}
function canHaveIllegalModifiers(node) {
const kind = node.kind;
- return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 181 /* FunctionType */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
+ return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
}
function isQuestionOrExclamationToken(node) {
return isQuestionToken(node) || isExclamationToken(node);
@@ -27035,6 +27438,25 @@ ${lanes.join("\n")}
flattenCommaListWorker(node, expressions);
return expressions;
}
+ function containsObjectRestOrSpread(node) {
+ if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
+ return true;
+ if (node.transformFlags & 128 /* ContainsES2018 */) {
+ for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
+ const target = getTargetOfBindingOrAssignmentElement(element);
+ if (target && isAssignmentPattern(target)) {
+ if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ return true;
+ }
+ if (target.transformFlags & 128 /* ContainsES2018 */) {
+ if (containsObjectRestOrSpread(target))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
var BinaryExpressionState, BinaryExpressionStateMachine;
var init_utilities2 = __esm({
"src/compiler/factory/utilities.ts"() {
@@ -28039,22 +28461,22 @@ ${lanes.join("\n")}
[356 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
};
((Parser2) => {
- const scanner2 = createScanner(
+ var scanner2 = createScanner(
99 /* Latest */,
/*skipTrivia*/
true
);
- const disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
- let NodeConstructor2;
- let TokenConstructor2;
- let IdentifierConstructor2;
- let PrivateIdentifierConstructor2;
- let SourceFileConstructor2;
+ var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
+ var NodeConstructor2;
+ var TokenConstructor2;
+ var IdentifierConstructor2;
+ var PrivateIdentifierConstructor2;
+ var SourceFileConstructor2;
function countNode(node) {
nodeCount++;
return node;
}
- const baseNodeFactory = {
+ var baseNodeFactory = {
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
kind,
/*pos*/
@@ -28091,25 +28513,53 @@ ${lanes.join("\n")}
0
))
};
- const factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
- let fileName;
- let sourceFlags;
- let sourceText;
- let languageVersion;
- let scriptKind;
- let languageVariant;
- let parseDiagnostics;
- let jsDocDiagnostics;
- let syntaxCursor;
- let currentToken;
- let nodeCount;
- let identifiers;
- let identifierCount;
- let parsingContext;
- let notParenthesizedArrow;
- let contextFlags;
- let topLevel = true;
- let parseErrorBeforeNextFinishedNode = false;
+ var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
+ var {
+ createNodeArray: factoryCreateNodeArray,
+ createNumericLiteral: factoryCreateNumericLiteral,
+ createStringLiteral: factoryCreateStringLiteral,
+ createLiteralLikeNode: factoryCreateLiteralLikeNode,
+ createIdentifier: factoryCreateIdentifier,
+ createPrivateIdentifier: factoryCreatePrivateIdentifier,
+ createToken: factoryCreateToken,
+ createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
+ createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
+ createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
+ createPropertyAccessChain: factoryCreatePropertyAccessChain,
+ createElementAccessExpression: factoryCreateElementAccessExpression,
+ createElementAccessChain: factoryCreateElementAccessChain,
+ createCallExpression: factoryCreateCallExpression,
+ createCallChain: factoryCreateCallChain,
+ createNewExpression: factoryCreateNewExpression,
+ createParenthesizedExpression: factoryCreateParenthesizedExpression,
+ createBlock: factoryCreateBlock,
+ createVariableStatement: factoryCreateVariableStatement,
+ createExpressionStatement: factoryCreateExpressionStatement,
+ createIfStatement: factoryCreateIfStatement,
+ createWhileStatement: factoryCreateWhileStatement,
+ createForStatement: factoryCreateForStatement,
+ createForOfStatement: factoryCreateForOfStatement,
+ createVariableDeclaration: factoryCreateVariableDeclaration,
+ createVariableDeclarationList: factoryCreateVariableDeclarationList
+ } = factory2;
+ var fileName;
+ var sourceFlags;
+ var sourceText;
+ var languageVersion;
+ var scriptKind;
+ var languageVariant;
+ var parseDiagnostics;
+ var jsDocDiagnostics;
+ var syntaxCursor;
+ var currentToken;
+ var nodeCount;
+ var identifiers;
+ var identifierCount;
+ var parsingContext;
+ var notParenthesizedArrow;
+ var contextFlags;
+ var topLevel = true;
+ var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
var _a2;
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
@@ -28209,8 +28659,8 @@ ${lanes.join("\n")}
}
}
}
- const expression = isArray(expressions) ? finishNode(factory2.createArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
- const statement = factory2.createExpressionStatement(expression);
+ const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
+ const statement = factoryCreateExpressionStatement(expression);
finishNode(statement, pos);
statements = createNodeArray([statement], pos);
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
@@ -28302,7 +28752,7 @@ ${lanes.join("\n")}
}
sourceFlags = contextFlags;
nextToken();
- const statements = parseList(ParsingContext.SourceElements, parseStatement);
+ const statements = parseList(0 /* SourceElements */, parseStatement);
Debug.assert(token() === 1 /* EndOfFileToken */);
const endOfFileToken = addJSDocComment(parseTokenNode());
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
@@ -28365,7 +28815,7 @@ ${lanes.join("\n")}
nextToken();
while (token() !== 1 /* EndOfFileToken */) {
const startPos = scanner2.getStartPos();
- const statement = parseListElement(ParsingContext.SourceElements, parseStatement);
+ const statement = parseListElement(0 /* SourceElements */, parseStatement);
statements.push(statement);
if (startPos === scanner2.getStartPos()) {
nextToken();
@@ -28393,7 +28843,7 @@ ${lanes.join("\n")}
}
}
syntaxCursor = savedSyntaxCursor;
- return factory2.updateSourceFile(sourceFile, setTextRange(factory2.createNodeArray(statements), sourceFile.statements));
+ return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
function containsPossibleTopLevelAwait(node) {
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
}
@@ -28834,13 +29284,13 @@ ${lanes.join("\n")}
const pos = getNodePos();
const kind = token();
nextToken();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseTokenNodeJSDoc() {
const pos = getNodePos();
const kind = token();
nextTokenJSDoc();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function canParseSemicolon() {
if (token() === 26 /* SemicolonToken */) {
@@ -28861,7 +29311,7 @@ ${lanes.join("\n")}
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
}
function createNodeArray(elements, pos, end, hasTrailingComma) {
- const array = factory2.createNodeArray(elements, hasTrailingComma);
+ const array = factoryCreateNodeArray(elements, hasTrailingComma);
setTextRangePosEnd(array, pos, end != null ? end : scanner2.getStartPos());
return array;
}
@@ -28883,7 +29333,7 @@ ${lanes.join("\n")}
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
const pos = getNodePos();
- const result = kind === 79 /* Identifier */ ? factory2.createIdentifier(
+ const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
"",
/*originalKeywordKind*/
void 0
@@ -28893,15 +29343,15 @@ ${lanes.join("\n")}
"",
/*templateFlags*/
void 0
- ) : kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(
+ ) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
"",
/*numericLiteralFlags*/
void 0
- ) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ ) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
"",
/*isSingleQuote*/
void 0
- ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factory2.createToken(kind);
+ ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
return finishNode(result, pos);
}
function internIdentifier(text) {
@@ -28919,7 +29369,7 @@ ${lanes.join("\n")}
const text = internIdentifier(scanner2.getTokenValue());
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
nextTokenWithoutCheck();
- return finishNode(factory2.createIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
+ return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
}
if (token() === 80 /* PrivateIdentifier */) {
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -28990,7 +29440,7 @@ ${lanes.join("\n")}
}
function parsePrivateIdentifier() {
const pos = getNodePos();
- const node = factory2.createPrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
+ const node = factoryCreatePrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
nextToken();
return finishNode(node, pos);
}
@@ -29019,7 +29469,6 @@ ${lanes.join("\n")}
return canFollowExportModifier();
case 88 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 127 /* AccessorKeyword */:
case 124 /* StaticKeyword */:
case 137 /* GetKeyword */:
case 151 /* SetKeyword */:
@@ -29052,19 +29501,19 @@ ${lanes.join("\n")}
return true;
}
switch (parsingContext2) {
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return lookAhead(isClassMemberStart) || token() === 26 /* SemicolonToken */ && !inErrorRecovery;
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return token() === 22 /* OpenBracketToken */ || isLiteralPropertyName();
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
switch (token()) {
case 22 /* OpenBracketToken */:
case 41 /* AsteriskToken */:
@@ -29074,13 +29523,13 @@ ${lanes.join("\n")}
default:
return isLiteralPropertyName();
}
- case ParsingContext.RestProperties:
+ case 18 /* RestProperties */:
return isLiteralPropertyName();
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return token() === 22 /* OpenBracketToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName();
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return isAssertionKey2();
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
if (token() === 18 /* OpenBraceToken */) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
@@ -29089,40 +29538,40 @@ ${lanes.join("\n")}
} else {
return isIdentifier2() && !isHeritageClauseExtendsOrImplementsKeyword();
}
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
switch (token()) {
case 27 /* CommaToken */:
case 24 /* DotToken */:
return true;
}
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 25 /* DotDotDotToken */ || isStartOfExpression();
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isStartOfParameter(
/*isJSDocParameter*/
false
);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return isStartOfParameter(
/*isJSDocParameter*/
true
);
- case ParsingContext.TypeArguments:
- case ParsingContext.TupleElementTypes:
+ case 20 /* TypeArguments */:
+ case 21 /* TupleElementTypes */:
return token() === 27 /* CommaToken */ || isStartOfType();
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return isHeritageClause2();
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return tokenIsIdentifierOrKeyword(token());
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return true;
}
return Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -29166,41 +29615,41 @@ ${lanes.join("\n")}
return true;
}
switch (kind) {
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauses:
- case ParsingContext.TypeMembers:
- case ParsingContext.ClassMembers:
- case ParsingContext.EnumMembers:
- case ParsingContext.ObjectLiteralMembers:
- case ParsingContext.ObjectBindingElements:
- case ParsingContext.ImportOrExportSpecifiers:
- case ParsingContext.AssertEntries:
+ case 1 /* BlockStatements */:
+ case 2 /* SwitchClauses */:
+ case 4 /* TypeMembers */:
+ case 5 /* ClassMembers */:
+ case 6 /* EnumMembers */:
+ case 12 /* ObjectLiteralMembers */:
+ case 9 /* ObjectBindingElements */:
+ case 23 /* ImportOrExportSpecifiers */:
+ case 24 /* AssertEntries */:
return token() === 19 /* CloseBraceToken */;
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return token() === 19 /* CloseBraceToken */ || token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 31 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
- case ParsingContext.ArrayLiteralMembers:
- case ParsingContext.TupleElementTypes:
- case ParsingContext.ArrayBindingElements:
+ case 15 /* ArrayLiteralMembers */:
+ case 21 /* TupleElementTypes */:
+ case 10 /* ArrayBindingElements */:
return token() === 23 /* CloseBracketToken */;
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
- case ParsingContext.RestProperties:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
+ case 18 /* RestProperties */:
return token() === 21 /* CloseParenToken */ || token() === 23 /* CloseBracketToken */;
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return token() !== 27 /* CommaToken */;
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return token() === 18 /* OpenBraceToken */ || token() === 19 /* CloseBraceToken */;
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return token() === 31 /* GreaterThanToken */ || token() === 43 /* SlashToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
default:
return false;
@@ -29219,7 +29668,7 @@ ${lanes.join("\n")}
return false;
}
function isInSomeParsingContext() {
- for (let kind = 0; kind < ParsingContext.Count; kind++) {
+ for (let kind = 0; kind < 25 /* Count */; kind++) {
if (parsingContext & 1 << kind) {
if (isListElement2(
kind,
@@ -29288,38 +29737,38 @@ ${lanes.join("\n")}
}
function isReusableParsingContext(parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
- case ParsingContext.SwitchClauses:
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
- case ParsingContext.EnumMembers:
- case ParsingContext.TypeMembers:
- case ParsingContext.VariableDeclarations:
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 5 /* ClassMembers */:
+ case 2 /* SwitchClauses */:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
+ case 6 /* EnumMembers */:
+ case 4 /* TypeMembers */:
+ case 8 /* VariableDeclarations */:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return true;
}
return false;
}
function canReuseNode(node, parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return isReusableClassMember(node);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return isReusableSwitchClause(node);
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return isReusableStatement(node);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return isReusableEnumMember(node);
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return isReusableTypeMember(node);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isReusableVariableDeclaration(node);
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return isReusableParameter(node);
}
return false;
@@ -29429,56 +29878,56 @@ ${lanes.join("\n")}
}
function parsingContextErrors(context) {
switch (context) {
- case ParsingContext.SourceElements:
+ case 0 /* SourceElements */:
return token() === 88 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(93 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.BlockStatements:
+ case 1 /* BlockStatements */:
return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return parseErrorAtCurrentToken(Diagnostics.case_or_default_expected);
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
- case ParsingContext.RestProperties:
- case ParsingContext.TypeMembers:
+ case 18 /* RestProperties */:
+ case 4 /* TypeMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return parseErrorAtCurrentToken(Diagnostics.Enum_member_expected);
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return parseErrorAtCurrentToken(Diagnostics.Expression_expected);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Variable_declaration_expected);
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Property_destructuring_pattern_expected);
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Array_element_destructuring_pattern_expected);
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return parseErrorAtCurrentToken(Diagnostics.Argument_expression_expected);
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
- case ParsingContext.TupleElementTypes:
+ case 21 /* TupleElementTypes */:
return parseErrorAtCurrentToken(Diagnostics.Type_expected);
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_expected);
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
- case ParsingContext.Count:
+ case 25 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(context);
@@ -29537,7 +29986,7 @@ ${lanes.join("\n")}
);
}
function getExpectedCommaDiagnostic(kind) {
- return kind === ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
+ return kind === 6 /* EnumMembers */ ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
}
function createMissingList() {
const list = createNodeArray([], getNodePos());
@@ -29706,12 +30155,12 @@ ${lanes.join("\n")}
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
// We also do not need to check for negatives because any prefix operator would be part of a
// parent unary expression.
- kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
scanner2.getTokenValue(),
/*isSingleQuote*/
void 0,
scanner2.hasExtendedUnicodeEscape()
- ) : isLiteralKind(kind) ? factory2.createLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
+ ) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
);
if (scanner2.hasExtendedUnicodeEscape()) {
node.hasExtendedUnicodeEscape = true;
@@ -29731,7 +30180,7 @@ ${lanes.join("\n")}
}
function parseTypeArgumentsOfTypeReference() {
if (!scanner2.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function parseTypeReference() {
@@ -29913,7 +30362,7 @@ ${lanes.join("\n")}
}
function parseTypeParameters() {
if (token() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeParameters, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function isStartOfParameter(isJSDocParameter) {
@@ -30019,7 +30468,7 @@ ${lanes.join("\n")}
const savedAwaitContext = inAwaitContext();
setYieldContext(!!(flags & 1 /* Yield */));
setAwaitContext(!!(flags & 2 /* Await */));
- const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
+ const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) : parseDelimitedList(16 /* Parameters */, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
return parameters;
@@ -30087,7 +30536,7 @@ ${lanes.join("\n")}
return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers) {
- const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(
+ const parameters = parseBracketedList(16 /* Parameters */, () => parseParameter(
/*inOuterAwaitContext*/
false
), 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
@@ -30186,7 +30635,7 @@ ${lanes.join("\n")}
function parseObjectTypeMembers() {
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -30240,7 +30689,7 @@ ${lanes.join("\n")}
}
const type = parseTypeAnnotation();
parseSemicolon();
- const members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ const members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
}
@@ -30285,7 +30734,7 @@ ${lanes.join("\n")}
const pos = getNodePos();
return finishNode(
factory2.createTupleTypeNode(
- parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
+ parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
),
pos
);
@@ -30302,7 +30751,7 @@ ${lanes.join("\n")}
if (token() === 126 /* AbstractKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(126 /* AbstractKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -30312,6 +30761,7 @@ ${lanes.join("\n")}
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiersForConstructorType();
const isConstructorType = parseOptional(103 /* NewKeyword */);
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
const typeParameters = parseTypeParameters();
const parameters = parseParameters(4 /* Type */);
const type = parseReturnType(
@@ -30320,8 +30770,6 @@ ${lanes.join("\n")}
false
);
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
- if (!isConstructorType)
- node.modifiers = modifiers;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseKeywordAndNoDot() {
@@ -30913,10 +31361,10 @@ ${lanes.join("\n")}
}
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
const triState = isParenthesizedArrowFunctionExpression();
- if (triState === Tristate.False) {
+ if (triState === 0 /* False */) {
return void 0;
}
- return triState === Tristate.True ? parseParenthesizedArrowFunctionExpression(
+ return triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpression(
/*allowAmbiguity*/
true,
/*allowReturnTypeInArrowFunction*/
@@ -30928,18 +31376,18 @@ ${lanes.join("\n")}
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner2.hasPrecedingLineBreak()) {
- return Tristate.False;
+ return 0 /* False */;
}
if (token() !== 20 /* OpenParenToken */ && token() !== 29 /* LessThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
}
const first2 = token();
@@ -30951,45 +31399,45 @@ ${lanes.join("\n")}
case 38 /* EqualsGreaterThanToken */:
case 58 /* ColonToken */:
case 18 /* OpenBraceToken */:
- return Tristate.True;
+ return 1 /* True */;
default:
- return Tristate.False;
+ return 0 /* False */;
}
}
if (second === 22 /* OpenBracketToken */ || second === 18 /* OpenBraceToken */) {
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
if (second === 25 /* DotDotDotToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
if (isModifierKind(second) && second !== 132 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
if (nextToken() === 128 /* AsKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.True;
+ return 1 /* True */;
}
if (!isIdentifier2() && second !== 108 /* ThisKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
switch (nextToken()) {
case 58 /* ColonToken */:
- return Tristate.True;
+ return 1 /* True */;
case 57 /* QuestionToken */:
nextToken();
if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 63 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
case 27 /* CommaToken */:
case 63 /* EqualsToken */:
case 21 /* CloseParenToken */:
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
- return Tristate.False;
+ return 0 /* False */;
} else {
Debug.assert(first2 === 29 /* LessThanToken */);
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
if (languageVariant === 1 /* JSX */) {
const isArrowFunctionInJsx = lookAhead(() => {
@@ -31000,6 +31448,7 @@ ${lanes.join("\n")}
switch (fourth) {
case 63 /* EqualsToken */:
case 31 /* GreaterThanToken */:
+ case 43 /* SlashToken */:
return false;
default:
return true;
@@ -31010,11 +31459,11 @@ ${lanes.join("\n")}
return false;
});
if (isArrowFunctionInJsx) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
}
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
@@ -31034,7 +31483,7 @@ ${lanes.join("\n")}
}
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) {
if (token() === 132 /* AsyncKeyword */) {
- if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === Tristate.True) {
+ if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
const pos = getNodePos();
const asyncModifier = parseModifiersForArrowFunction();
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
@@ -31047,14 +31496,14 @@ ${lanes.join("\n")}
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner2.hasPrecedingLineBreak() || token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
if (!scanner2.hasPrecedingLineBreak() && expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
}
- return Tristate.False;
+ return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) {
const pos = getNodePos();
@@ -31259,6 +31708,12 @@ ${lanes.join("\n")}
case 114 /* VoidKeyword */:
return parseVoidExpression();
case 29 /* LessThanToken */:
+ if (languageVariant === 1 /* JSX */) {
+ return parseJsxElementOrSelfClosingElementOrFragment(
+ /*inExpressionContext*/
+ true
+ );
+ }
return parseTypeAssertion();
case 133 /* AwaitKeyword */:
if (isAwaitExpression2()) {
@@ -31353,7 +31808,7 @@ ${lanes.join("\n")}
return expression;
}
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
- return finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -31374,7 +31829,7 @@ ${lanes.join("\n")}
factory2.createJsxElement(
lastChild.openingElement,
lastChild.children,
- finishNode(factory2.createJsxClosingElement(finishNode(factory2.createIdentifier(""), end, end)), end, end)
+ finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
),
lastChild.openingElement.pos,
end
@@ -31462,7 +31917,7 @@ ${lanes.join("\n")}
const list = [];
const listPos = getNodePos();
const saveParsingContext = parsingContext;
- parsingContext |= 1 << ParsingContext.JsxChildren;
+ parsingContext |= 1 << 14 /* JsxChildren */;
while (true) {
const child = parseJsxChild(openingTag, currentToken = scanner2.reScanJsxToken());
if (!child)
@@ -31477,7 +31932,7 @@ ${lanes.join("\n")}
}
function parseJsxAttributes() {
const pos = getNodePos();
- return finishNode(factory2.createJsxAttributes(parseList(ParsingContext.JsxAttributes, parseJsxAttribute)), pos);
+ return finishNode(factory2.createJsxAttributes(parseList(13 /* JsxAttributes */, parseJsxAttribute)), pos);
}
function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
const pos = getNodePos();
@@ -31517,7 +31972,7 @@ ${lanes.join("\n")}
scanJsxIdentifier();
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- expression = finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -31611,13 +32066,9 @@ ${lanes.join("\n")}
function parseJsxClosingFragment(inExpressionContext) {
const pos = getNodePos();
parseExpected(30 /* LessThanSlashToken */);
- if (tokenIsIdentifierOrKeyword(token())) {
- parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
- }
if (parseExpected(
31 /* GreaterThanToken */,
- /*diagnostic*/
- void 0,
+ Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
/*shouldAdvance*/
false
)) {
@@ -31630,6 +32081,7 @@ ${lanes.join("\n")}
return finishNode(factory2.createJsxJsxClosingFragment(), pos);
}
function parseTypeAssertion() {
+ Debug.assert(languageVariant !== 1 /* JSX */, "Type assertions should never be parsed in JSX; they should be parsed as comparisons or JSX elements/fragments.");
const pos = getNodePos();
parseExpected(29 /* LessThanToken */);
const type = parseType();
@@ -31671,7 +32123,7 @@ ${lanes.join("\n")}
true
);
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
- const propertyAccess = isOptionalChain2 ? factory2.createPropertyAccessChain(expression, questionDotToken, name) : factory2.createPropertyAccessExpression(expression, name);
+ const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
}
@@ -31699,7 +32151,7 @@ ${lanes.join("\n")}
argumentExpression = argument;
}
parseExpected(23 /* CloseBracketToken */);
- const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createElementAccessChain(expression, questionDotToken, argumentExpression) : factory2.createElementAccessExpression(expression, argumentExpression);
+ const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
return finishNode(indexedAccess, pos);
}
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
@@ -31786,7 +32238,7 @@ ${lanes.join("\n")}
expression = expression.expression;
}
const argumentList = parseArgumentList();
- const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createCallChain(expression, questionDotToken, typeArguments, argumentList) : factory2.createCallExpression(expression, typeArguments, argumentList);
+ const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
}
@@ -31797,7 +32249,7 @@ ${lanes.join("\n")}
false,
Diagnostics.Identifier_expected
);
- expression = finishNode(factory2.createPropertyAccessChain(expression, questionDotToken, name), pos);
+ expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
}
@@ -31805,7 +32257,7 @@ ${lanes.join("\n")}
}
function parseArgumentList() {
parseExpected(20 /* OpenParenToken */);
- const result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression);
+ const result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);
parseExpected(21 /* CloseParenToken */);
return result;
}
@@ -31817,7 +32269,7 @@ ${lanes.join("\n")}
return void 0;
}
nextToken();
- const typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType);
+ const typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
return void 0;
}
@@ -31892,7 +32344,7 @@ ${lanes.join("\n")}
parseExpected(20 /* OpenParenToken */);
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- return withJSDoc(finishNode(factory2.createParenthesizedExpression(expression), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
}
function parseSpreadElement() {
const pos = getNodePos();
@@ -31917,9 +32369,9 @@ ${lanes.join("\n")}
const openBracketPosition = scanner2.getTokenPos();
const openBracketParsed = parseExpected(22 /* OpenBracketToken */);
const multiLine = scanner2.hasPrecedingLineBreak();
- const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
+ const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
- return finishNode(factory2.createArrayLiteralExpression(elements, multiLine), pos);
+ return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
}
function parseObjectLiteralElement() {
const pos = getNodePos();
@@ -31978,13 +32430,13 @@ ${lanes.join("\n")}
const openBraceParsed = parseExpected(18 /* OpenBraceToken */);
const multiLine = scanner2.hasPrecedingLineBreak();
const properties = parseDelimitedList(
- ParsingContext.ObjectLiteralMembers,
+ 12 /* ObjectLiteralMembers */,
parseObjectLiteralElement,
/*considerSemicolonAsDelimiter*/
true
);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- return finishNode(factory2.createObjectLiteralExpression(properties, multiLine), pos);
+ return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
}
function parseFunctionExpression() {
const savedDecoratorContext = inDecoratorContext();
@@ -32041,7 +32493,7 @@ ${lanes.join("\n")}
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
}
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
- return finishNode(factory2.createNewExpression(expression, typeArguments, argumentList), pos);
+ return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
const pos = getNodePos();
@@ -32050,17 +32502,17 @@ ${lanes.join("\n")}
const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
if (openBraceParsed || ignoreMissingOpenBrace) {
const multiLine = scanner2.hasPrecedingLineBreak();
- const statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ const statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
+ const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
if (token() === 63 /* EqualsToken */) {
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
nextToken();
}
return result;
} else {
const statements = createMissingList();
- return withJSDoc(finishNode(factory2.createBlock(
+ return withJSDoc(finishNode(factoryCreateBlock(
statements,
/*multiLine*/
void 0
@@ -32109,7 +32561,7 @@ ${lanes.join("\n")}
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const thenStatement = parseStatement();
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
- return withJSDoc(finishNode(factory2.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
}
function parseDoStatement() {
const pos = getNodePos();
@@ -32133,7 +32585,7 @@ ${lanes.join("\n")}
const expression = allowInAnd(parseExpression);
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const statement = parseStatement();
- return withJSDoc(finishNode(factory2.createWhileStatement(expression, statement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
}
function parseForOrForInOrForOfStatement() {
const pos = getNodePos();
@@ -32159,7 +32611,7 @@ ${lanes.join("\n")}
true
));
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForOfStatement(awaitToken, initializer, expression, parseStatement());
+ node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
} else if (parseOptional(101 /* InKeyword */)) {
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -32170,7 +32622,7 @@ ${lanes.join("\n")}
parseExpected(26 /* SemicolonToken */);
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForStatement(initializer, condition, incrementor, parseStatement());
+ node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
}
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -32208,14 +32660,14 @@ ${lanes.join("\n")}
parseExpected(82 /* CaseKeyword */);
const expression = allowInAnd(parseExpression);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return withJSDoc(finishNode(factory2.createCaseClause(expression, statements), pos), hasJSDoc);
}
function parseDefaultClause() {
const pos = getNodePos();
parseExpected(88 /* DefaultKeyword */);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(factory2.createDefaultClause(statements), pos);
}
function parseCaseOrDefaultClause() {
@@ -32224,7 +32676,7 @@ ${lanes.join("\n")}
function parseCaseBlock() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const clauses = parseList(ParsingContext.SwitchClauses, parseCaseOrDefaultClause);
+ const clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createCaseBlock(clauses), pos);
}
@@ -32245,7 +32697,7 @@ ${lanes.join("\n")}
let expression = scanner2.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
if (expression === void 0) {
identifierCount++;
- expression = finishNode(factory2.createIdentifier(""), getNodePos());
+ expression = finishNode(factoryCreateIdentifier(""), getNodePos());
}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
@@ -32306,7 +32758,7 @@ ${lanes.join("\n")}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
}
- node = factory2.createExpressionStatement(expression);
+ node = factoryCreateExpressionStatement(expression);
if (hasParen) {
hasJSDoc = false;
}
@@ -32665,14 +33117,14 @@ ${lanes.join("\n")}
function parseObjectBindingPattern() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement);
+ const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createObjectBindingPattern(elements), pos);
}
function parseArrayBindingPattern() {
const pos = getNodePos();
parseExpected(22 /* OpenBracketToken */);
- const elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement);
+ const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
return finishNode(factory2.createArrayBindingPattern(elements), pos);
}
@@ -32704,7 +33156,7 @@ ${lanes.join("\n")}
}
const type = parseTypeAnnotation();
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
- const node = factory2.createVariableDeclaration(name, exclamationToken, type, initializer);
+ const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseVariableDeclarationList(inForStatementInitializer) {
@@ -32730,12 +33182,12 @@ ${lanes.join("\n")}
const savedDisallowIn = inDisallowInContext();
setDisallowInContext(inForStatementInitializer);
declarations = parseDelimitedList(
- ParsingContext.VariableDeclarations,
+ 8 /* VariableDeclarations */,
inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation
);
setDisallowInContext(savedDisallowIn);
}
- return finishNode(factory2.createVariableDeclarationList(declarations, flags), pos);
+ return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
}
function canFollowContextualOfKeyword() {
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
@@ -32746,7 +33198,7 @@ ${lanes.join("\n")}
false
);
parseSemicolon();
- const node = factory2.createVariableStatement(modifiers, declarationList);
+ const node = factoryCreateVariableStatement(modifiers, declarationList);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
@@ -32975,22 +33427,30 @@ ${lanes.join("\n")}
return void 0;
}
}
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
const pos = getNodePos();
let list;
- let modifier, hasSeenStaticModifier = false;
+ let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false;
+ if (allowDecorators && token() === 59 /* AtToken */) {
+ while (decorator = tryParseDecorator()) {
+ list = append(list, decorator);
+ }
+ }
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
list = append(list, modifier);
+ hasLeadingModifier = true;
}
- if (allowDecorators && token() === 59 /* AtToken */) {
- let decorator;
+ if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) {
while (decorator = tryParseDecorator()) {
list = append(list, decorator);
+ hasTrailingDecorator = true;
}
+ }
+ if (hasTrailingDecorator) {
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
@@ -33004,7 +33464,7 @@ ${lanes.join("\n")}
if (token() === 132 /* AsyncKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(132 /* AsyncKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -33133,7 +33593,7 @@ ${lanes.join("\n")}
}
function parseHeritageClauses() {
if (isHeritageClause2()) {
- return parseList(ParsingContext.HeritageClauses, parseHeritageClause);
+ return parseList(22 /* HeritageClauses */, parseHeritageClause);
}
return void 0;
}
@@ -33142,7 +33602,7 @@ ${lanes.join("\n")}
const tok = token();
Debug.assert(tok === 94 /* ExtendsKeyword */ || tok === 117 /* ImplementsKeyword */);
nextToken();
- const types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
+ const types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(factory2.createHeritageClause(tok, types), pos);
}
function parseExpressionWithTypeArguments() {
@@ -33155,13 +33615,13 @@ ${lanes.join("\n")}
return finishNode(factory2.createExpressionWithTypeArguments(expression, typeArguments), pos);
}
function tryParseTypeArguments() {
- return token() === 29 /* LessThanToken */ ? parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
+ return token() === 29 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
}
function isHeritageClause2() {
return token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
}
function parseClassMembers() {
- return parseList(ParsingContext.ClassMembers, parseClassElement);
+ return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(pos, hasJSDoc, modifiers) {
parseExpected(118 /* InterfaceKeyword */);
@@ -33194,7 +33654,7 @@ ${lanes.join("\n")}
const name = parseIdentifier();
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember));
+ members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(6 /* EnumMembers */, parseEnumMember));
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -33206,7 +33666,7 @@ ${lanes.join("\n")}
const pos = getNodePos();
let statements;
if (parseExpected(18 /* OpenBraceToken */)) {
- statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
} else {
statements = createMissingList();
@@ -33331,7 +33791,7 @@ ${lanes.join("\n")}
if (parseExpected(18 /* OpenBraceToken */)) {
const multiLine = scanner2.hasPrecedingLineBreak();
const elements = parseDelimitedList(
- ParsingContext.AssertEntries,
+ 24 /* AssertEntries */,
parseAssertEntry,
/*considerSemicolonAsDelimiter*/
true
@@ -33415,7 +33875,7 @@ ${lanes.join("\n")}
}
function parseNamedImportsOrExports(kind) {
const pos = getNodePos();
- const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
+ const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
return finishNode(node, pos);
}
function parseExportSpecifier() {
@@ -33591,7 +34051,7 @@ ${lanes.join("\n")}
/*isDeclarationFile*/
false,
[],
- factory2.createToken(1 /* EndOfFileToken */),
+ factoryCreateToken(1 /* EndOfFileToken */),
0 /* None */,
noop
);
@@ -34252,7 +34712,7 @@ ${lanes.join("\n")}
let node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
const name = parseJSDocIdentifierName();
- node = finishNode(factory2.createPropertyAccessExpression(node, name), pos);
+ node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
}
return node;
}
@@ -34543,7 +35003,7 @@ ${lanes.join("\n")}
const end2 = scanner2.getTextPos();
const originalKeywordKind = token();
const text = internIdentifier(scanner2.getTokenValue());
- const result = finishNode(factory2.createIdentifier(text, originalKeywordKind), pos, end2);
+ const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
nextTokenJSDoc();
return result;
}
@@ -34864,7 +35324,7 @@ ${lanes.join("\n")}
let currentArrayIndex = 0;
Debug.assert(currentArrayIndex < currentArray.length);
let current = currentArray[currentArrayIndex];
- let lastQueriedPosition = InvalidPosition.Value;
+ let lastQueriedPosition = -1 /* Value */;
return {
currentNode(position) {
if (position !== lastQueriedPosition) {
@@ -34883,7 +35343,7 @@ ${lanes.join("\n")}
};
function findHighestListElementThatStartsAtPosition(position) {
currentArray = void 0;
- currentArrayIndex = InvalidPosition.Value;
+ currentArrayIndex = -1 /* Value */;
current = void 0;
forEachChild(sourceFile, visitNode3, visitArray2);
return;
@@ -37740,7 +38200,7 @@ ${lanes.join("\n")}
{
name: "allowArbitraryExtensions",
type: "boolean",
- affectsModuleResolution: true,
+ affectsProgramStructure: true,
category: Diagnostics.Modules,
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
defaultValueDescription: false
@@ -38243,6 +38703,22 @@ ${lanes.join("\n")}
Debug.assert(extensionIsTS(resolved.extension));
return { fileName: resolved.path, packageId: resolved.packageId };
}
+ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
+ if (originalPath)
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
+ }
+ return createResolvedModuleWithFailedLookupLocations(
+ resolved,
+ isExternalLibraryImport,
+ failedLookupLocations,
+ affectingLocations,
+ diagnostics,
+ state.resultFromCache,
+ legacyResult
+ );
+ }
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
if (resultFromCache) {
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -38401,6 +38877,15 @@ ${lanes.join("\n")}
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
}
+ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ return {
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
+ originalPath: pathsAreEqual ? void 0 : fileName
+ };
+ }
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
const traceEnabled = isTraceEnabled(options, host);
@@ -38445,9 +38930,9 @@ ${lanes.join("\n")}
const affectingLocations = [];
let features = getNodeResolutionFeatures(options);
if (resolutionMode === 99 /* ESNext */ && (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */)) {
- features |= NodeResolutionFeatures.EsmMode;
+ features |= 32 /* EsmMode */;
}
- const conditions = features & NodeResolutionFeatures.Exports ? getConditions(options, !!(features & NodeResolutionFeatures.EsmMode)) : [];
+ const conditions = features & 8 /* Exports */ ? getConditions(options, !!(features & 32 /* EsmMode */)) : [];
const diagnostics = [];
const moduleResolutionState = {
compilerOptions: options,
@@ -38472,13 +38957,13 @@ ${lanes.join("\n")}
let resolvedTypeReferenceDirective;
if (resolved) {
const { fileName, packageId } = resolved;
- const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ let resolvedFileName = fileName, originalPath;
+ if (!options.preserveSymlinks)
+ ({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
resolvedTypeReferenceDirective = {
primary,
- // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
- resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
- originalPath: pathsAreEqual ? void 0 : fileName,
+ resolvedFileName,
+ originalPath,
packageId,
isExternalLibraryImport: pathContainsNodeModules(fileName)
};
@@ -38580,35 +39065,38 @@ ${lanes.join("\n")}
}
}
function getNodeResolutionFeatures(options) {
- let features = NodeResolutionFeatures.None;
+ let features = 0 /* None */;
switch (getEmitModuleResolutionKind(options)) {
case 3 /* Node16 */:
- features = NodeResolutionFeatures.Node16Default;
+ features = 30 /* Node16Default */;
break;
case 99 /* NodeNext */:
- features = NodeResolutionFeatures.NodeNextDefault;
+ features = 30 /* NodeNextDefault */;
break;
case 100 /* Bundler */:
- features = NodeResolutionFeatures.BundlerDefault;
+ features = 30 /* BundlerDefault */;
break;
}
if (options.resolvePackageJsonExports) {
- features |= NodeResolutionFeatures.Exports;
+ features |= 8 /* Exports */;
} else if (options.resolvePackageJsonExports === false) {
- features &= ~NodeResolutionFeatures.Exports;
+ features &= ~8 /* Exports */;
}
if (options.resolvePackageJsonImports) {
- features |= NodeResolutionFeatures.Imports;
+ features |= 2 /* Imports */;
} else if (options.resolvePackageJsonImports === false) {
- features &= ~NodeResolutionFeatures.Imports;
+ features &= ~2 /* Imports */;
}
return features;
}
function getConditions(options, esmMode) {
- const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["node", "import"] : ["node", "require"];
+ const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
if (!options.noDtsResolution) {
conditions.push("types");
}
+ if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
+ conditions.push("node");
+ }
return concatenate(conditions, options.customConditions);
}
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
@@ -39322,7 +39810,7 @@ ${lanes.join("\n")}
isConfigLookup,
candidateIsFromPackageJsonField: false
};
- if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
+ if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
}
let result;
@@ -39348,13 +39836,14 @@ ${lanes.join("\n")}
legacyResult = diagnosticResult.value.resolved.path;
}
}
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache,
+ state,
legacyResult
);
function tryResolve(extensions2, state2) {
@@ -39384,16 +39873,7 @@ ${lanes.join("\n")}
}
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
}
- if (!resolved2)
- return void 0;
- let resolvedValue = resolved2.value;
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
- const path = realPath(resolvedValue.path, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
- }
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
} else {
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
const resolved2 = nodeLoadModuleByRelativeName(
@@ -39575,7 +40055,7 @@ ${lanes.join("\n")}
if (!onlyRecordFailures) {
if (state.host.fileExists(fileName)) {
if (state.traceEnabled) {
- trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
+ trace(state.host, Diagnostics.File_0_exists_use_it_as_a_name_resolution_result, fileName);
}
return fileName;
} else {
@@ -40170,18 +40650,24 @@ ${lanes.join("\n")}
)));
} else if (typeof target === "object" && target !== null) {
if (!Array.isArray(target)) {
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
for (const condition of getOwnKeys(target)) {
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
const subTarget = target[condition];
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
if (result) {
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return result;
+ } else {
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
}
} else {
traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
}
}
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return void 0;
} else {
if (!length(target)) {
@@ -40547,13 +41033,14 @@ ${lanes.join("\n")}
candidateIsFromPackageJsonField: false
};
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
resolved && resolved.value,
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache
+ state
);
function tryResolve(extensions) {
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -40809,35 +41296,36 @@ ${lanes.join("\n")}
measure("Bind", "beforeBind", "afterBind");
}
function createBinder() {
- let file;
- let options;
- let languageVersion;
- let parent2;
- let container;
- let thisParentContainer;
- let blockScopeContainer;
- let lastContainer;
- let delayedTypeAliases;
- let seenThisKeyword;
- let currentFlow;
- let currentBreakTarget;
- let currentContinueTarget;
- let currentReturnTarget;
- let currentTrueTarget;
- let currentFalseTarget;
- let currentExceptionTarget;
- let preSwitchCaseFlow;
- let activeLabelList;
- let hasExplicitReturn;
- let emitFlags;
- let inStrictMode;
- let inAssignmentPattern = false;
- let symbolCount = 0;
- let Symbol46;
- let classifiableNames;
- const unreachableFlow = { flags: 1 /* Unreachable */ };
- const reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
- const bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ var file;
+ var options;
+ var languageVersion;
+ var parent2;
+ var container;
+ var thisParentContainer;
+ var blockScopeContainer;
+ var lastContainer;
+ var delayedTypeAliases;
+ var seenThisKeyword;
+ var currentFlow;
+ var currentBreakTarget;
+ var currentContinueTarget;
+ var currentReturnTarget;
+ var currentTrueTarget;
+ var currentFalseTarget;
+ var currentExceptionTarget;
+ var preSwitchCaseFlow;
+ var activeLabelList;
+ var hasExplicitReturn;
+ var emitFlags;
+ var inStrictMode;
+ var inAssignmentPattern = false;
+ var symbolCount = 0;
+ var Symbol46;
+ var classifiableNames;
+ var unreachableFlow = { flags: 1 /* Unreachable */ };
+ var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
+ var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ return bindSourceFile2;
function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
}
@@ -40888,7 +41376,6 @@ ${lanes.join("\n")}
inAssignmentPattern = false;
emitFlags = 0 /* None */;
}
- return bindSourceFile2;
function bindInStrictMode(file2, opts) {
if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) {
return true;
@@ -43885,7 +44372,7 @@ ${lanes.join("\n")}
let redirectPathsSpecifiers;
let relativeSpecifiers;
for (const modulePath of modulePaths) {
- const specifier = tryGetModuleNameAsNodeModule(
+ const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
modulePath,
info,
importingSourceFile,
@@ -43895,7 +44382,7 @@ ${lanes.join("\n")}
/*packageNameOnly*/
void 0,
options.overrideImportMode
- );
+ ) : void 0;
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
if (specifier && modulePath.isRedirect) {
return nodeModulesSpecifiers;
@@ -44307,9 +44794,11 @@ ${lanes.join("\n")}
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
- if (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */) {
- const conditions = ["node", importMode === 99 /* ESNext */ ? "import" : "require", "types"];
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
+ if (getResolvePackageJsonExports(options)) {
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
+ const conditions = getConditions(options, importMode === 99 /* ESNext */);
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
if (fromExports) {
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
return { ...withJsExtension, verbatimFromExports: true };
@@ -44503,8 +44992,8 @@ ${lanes.join("\n")}
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
}
function createTypeChecker(host) {
- const getPackagesMap = memoize(() => {
- const map2 = /* @__PURE__ */ new Map();
+ var getPackagesMap = memoize(() => {
+ var map2 = /* @__PURE__ */ new Map();
host.getSourceFiles().forEach((sf) => {
if (!sf.resolvedModules)
return;
@@ -44515,57 +45004,58 @@ ${lanes.join("\n")}
});
return map2;
});
- let deferredDiagnosticsCallbacks = [];
- let addLazyDiagnostic = (arg) => {
+ var deferredDiagnosticsCallbacks = [];
+ var addLazyDiagnostic = (arg) => {
deferredDiagnosticsCallbacks.push(arg);
};
- let cancellationToken;
- const requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
- let requestedExternalEmitHelpers;
- let externalHelpersModule;
- const Symbol46 = objectAllocator.getSymbolConstructor();
- const Type27 = objectAllocator.getTypeConstructor();
- const Signature15 = objectAllocator.getSignatureConstructor();
- let typeCount = 0;
- let symbolCount = 0;
- let totalInstantiationCount = 0;
- let instantiationCount = 0;
- let instantiationDepth = 0;
- let inlineLevel = 0;
- let currentNode;
- let varianceTypeParameter;
- const emptySymbols = createSymbolTable();
- const arrayVariances = [1 /* Covariant */];
- const compilerOptions = host.getCompilerOptions();
- const languageVersion = getEmitScriptTarget(compilerOptions);
- const moduleKind = getEmitModuleKind(compilerOptions);
- const legacyDecorators = !!compilerOptions.experimentalDecorators;
- const useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
- const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
- const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
- const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
- const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
- const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
- const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
- const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
- const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
- const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
- const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
- const exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
- const checkBinaryExpression = createCheckBinaryExpression();
- const emitResolver = createResolver();
- const nodeBuilder = createNodeBuilder();
- const globals = createSymbolTable();
- const undefinedSymbol = createSymbol(4 /* Property */, "undefined");
+ var cancellationToken;
+ var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
+ var requestedExternalEmitHelpers;
+ var externalHelpersModule;
+ var Symbol46 = objectAllocator.getSymbolConstructor();
+ var Type27 = objectAllocator.getTypeConstructor();
+ var Signature15 = objectAllocator.getSignatureConstructor();
+ var typeCount = 0;
+ var symbolCount = 0;
+ var totalInstantiationCount = 0;
+ var instantiationCount = 0;
+ var instantiationDepth = 0;
+ var inlineLevel = 0;
+ var currentNode;
+ var varianceTypeParameter;
+ var isInferencePartiallyBlocked = false;
+ var emptySymbols = createSymbolTable();
+ var arrayVariances = [1 /* Covariant */];
+ var compilerOptions = host.getCompilerOptions();
+ var languageVersion = getEmitScriptTarget(compilerOptions);
+ var moduleKind = getEmitModuleKind(compilerOptions);
+ var legacyDecorators = !!compilerOptions.experimentalDecorators;
+ var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
+ var allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
+ var strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
+ var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
+ var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
+ var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
+ var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
+ var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
+ var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
+ var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
+ var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
+ var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
+ var checkBinaryExpression = createCheckBinaryExpression();
+ var emitResolver = createResolver();
+ var nodeBuilder = createNodeBuilder();
+ var globals = createSymbolTable();
+ var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
undefinedSymbol.declarations = [];
- const globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
+ var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
globalThisSymbol.declarations = [];
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
- const argumentsSymbol = createSymbol(4 /* Property */, "arguments");
- const requireSymbol = createSymbol(4 /* Property */, "require");
- const isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
- let apparentArgumentCount;
+ var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
+ var requireSymbol = createSymbol(4 /* Property */, "require");
+ var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
+ var apparentArgumentCount;
const checker = {
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -44743,15 +45233,14 @@ ${lanes.join("\n")}
getTypeOfPropertyOfContextualType,
getFullyQualifiedName,
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
call,
candidatesOutArray,
/*argumentCount*/
void 0,
- 32 /* IsForStringLiteralArgumentCompletions */,
- editingArgument
- ),
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
+ 32 /* IsForStringLiteralArgumentCompletions */
+ )),
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
getExpandedParameters,
hasEffectiveRestParameter,
containsArgumentsReference,
@@ -44856,6 +45345,7 @@ ${lanes.join("\n")}
isArrayType,
isTupleType,
isArrayLikeType,
+ isEmptyAnonymousObjectType,
isTypeInvalidDueToUnionDiscriminant,
getExactOptionalProperties,
getAllPossiblePropertiesOfTypes,
@@ -44942,81 +45432,93 @@ ${lanes.join("\n")}
isPropertyAccessible,
getTypeOnlyAliasDeclaration,
getMemberOverrideModifierStatus,
- isTypeParameterPossiblyReferenced
+ isTypeParameterPossiblyReferenced,
+ typeHasCallOrConstructSignatures
};
- function runWithInferenceBlockedFromSourceNode(node, fn) {
+ function runWithoutResolvedSignatureCaching(node, fn) {
const containingCall = findAncestor(node, isCallLikeExpression);
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = void 0;
+ }
+ const result = fn();
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
+ }
+ return result;
+ }
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
+ const containingCall = findAncestor(node, isCallLikeExpression);
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = true;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = void 0;
}
- const result = fn();
+ isInferencePartiallyBlocked = true;
+ const result = runWithoutResolvedSignatureCaching(node, fn);
+ isInferencePartiallyBlocked = false;
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
}
return result;
}
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
apparentArgumentCount = argumentCount;
- const res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignature(node, candidatesOutArray, checkMode)) : getResolvedSignature(node, candidatesOutArray, checkMode);
+ const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
apparentArgumentCount = void 0;
return res;
}
- const tupleTypes = /* @__PURE__ */ new Map();
- const unionTypes = /* @__PURE__ */ new Map();
- const intersectionTypes = /* @__PURE__ */ new Map();
- const stringLiteralTypes = /* @__PURE__ */ new Map();
- const numberLiteralTypes = /* @__PURE__ */ new Map();
- const bigIntLiteralTypes = /* @__PURE__ */ new Map();
- const enumLiteralTypes = /* @__PURE__ */ new Map();
- const indexedAccessTypes = /* @__PURE__ */ new Map();
- const templateLiteralTypes = /* @__PURE__ */ new Map();
- const stringMappingTypes = /* @__PURE__ */ new Map();
- const substitutionTypes = /* @__PURE__ */ new Map();
- const subtypeReductionCache = /* @__PURE__ */ new Map();
- const decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
- const cachedTypes = /* @__PURE__ */ new Map();
- const evolvingArrayTypes = [];
- const undefinedProperties = /* @__PURE__ */ new Map();
- const markerTypes = /* @__PURE__ */ new Set();
- const unknownSymbol = createSymbol(4 /* Property */, "unknown");
- const resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
- const unresolvedSymbols = /* @__PURE__ */ new Map();
- const errorTypes = /* @__PURE__ */ new Map();
- const anyType = createIntrinsicType(1 /* Any */, "any");
- const autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
- const wildcardType = createIntrinsicType(1 /* Any */, "any");
- const errorType = createIntrinsicType(1 /* Any */, "error");
- const unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
- const nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
- const intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
- const unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
- const missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
- const optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const nullType = createIntrinsicType(65536 /* Null */, "null");
- const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
- const stringType = createIntrinsicType(4 /* String */, "string");
- const numberType = createIntrinsicType(8 /* Number */, "number");
- const bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
- const falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
- const regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var tupleTypes = /* @__PURE__ */ new Map();
+ var unionTypes = /* @__PURE__ */ new Map();
+ var intersectionTypes = /* @__PURE__ */ new Map();
+ var stringLiteralTypes = /* @__PURE__ */ new Map();
+ var numberLiteralTypes = /* @__PURE__ */ new Map();
+ var bigIntLiteralTypes = /* @__PURE__ */ new Map();
+ var enumLiteralTypes = /* @__PURE__ */ new Map();
+ var indexedAccessTypes = /* @__PURE__ */ new Map();
+ var templateLiteralTypes = /* @__PURE__ */ new Map();
+ var stringMappingTypes = /* @__PURE__ */ new Map();
+ var substitutionTypes = /* @__PURE__ */ new Map();
+ var subtypeReductionCache = /* @__PURE__ */ new Map();
+ var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
+ var cachedTypes = /* @__PURE__ */ new Map();
+ var evolvingArrayTypes = [];
+ var undefinedProperties = /* @__PURE__ */ new Map();
+ var markerTypes = /* @__PURE__ */ new Set();
+ var unknownSymbol = createSymbol(4 /* Property */, "unknown");
+ var resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
+ var unresolvedSymbols = /* @__PURE__ */ new Map();
+ var errorTypes = /* @__PURE__ */ new Map();
+ var anyType = createIntrinsicType(1 /* Any */, "any");
+ var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
+ var wildcardType = createIntrinsicType(1 /* Any */, "any");
+ var errorType = createIntrinsicType(1 /* Any */, "error");
+ var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
+ var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
+ var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
+ var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
+ var missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
+ var optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var nullType = createIntrinsicType(65536 /* Null */, "null");
+ var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
+ var stringType = createIntrinsicType(4 /* String */, "string");
+ var numberType = createIntrinsicType(8 /* Number */, "number");
+ var bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
+ var falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
trueType.regularType = regularTrueType;
trueType.freshType = trueType;
regularTrueType.regularType = regularTrueType;
@@ -45025,26 +45527,26 @@ ${lanes.join("\n")}
falseType.freshType = falseType;
regularFalseType.regularType = regularFalseType;
regularFalseType.freshType = falseType;
- const booleanType = getUnionType([regularFalseType, regularTrueType]);
- const esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
- const voidType = createIntrinsicType(16384 /* Void */, "void");
- const neverType = createIntrinsicType(131072 /* Never */, "never");
- const silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
- const implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
- const unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
- const nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
- const stringOrNumberType = getUnionType([stringType, numberType]);
- const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
- const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
- const numberOrBigIntType = getUnionType([numberType, bigintType]);
- const templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
- const numericStringType = getTemplateLiteralType(["", ""], [numberType]);
- const restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
- const permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
- const uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
- const uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
- let outofbandVarianceMarkerHandler;
- const reportUnreliableMapper = makeFunctionTypeMapper((t) => {
+ var booleanType = getUnionType([regularFalseType, regularTrueType]);
+ var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
+ var voidType = createIntrinsicType(16384 /* Void */, "void");
+ var neverType = createIntrinsicType(131072 /* Never */, "never");
+ var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
+ var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
+ var stringOrNumberType = getUnionType([stringType, numberType]);
+ var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
+ var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
+ var numberOrBigIntType = getUnionType([numberType, bigintType]);
+ var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
+ var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
+ var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
+ var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
+ var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
+ var outofbandVarianceMarkerHandler;
+ var reportUnreliableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -45053,7 +45555,7 @@ ${lanes.join("\n")}
}
return t;
}, () => "(unmeasurable reporter)");
- const reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
+ var reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -45062,30 +45564,30 @@ ${lanes.join("\n")}
}
return t;
}, () => "(unreliable reporter)");
- const emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
- const emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
+ var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
emptyTypeLiteralSymbol.members = createSymbolTable();
- const emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
- const emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
+ var emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyGenericType.instantiations = /* @__PURE__ */ new Map();
- const anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
anyFunctionType.objectFlags |= 262144 /* NonInferrableType */;
- const noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const markerSuperType = createTypeParameter();
- const markerSubType = createTypeParameter();
+ var noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var markerSuperType = createTypeParameter();
+ var markerSubType = createTypeParameter();
markerSubType.constraint = markerSuperType;
- const markerOtherType = createTypeParameter();
- const markerSuperTypeForCheck = createTypeParameter();
- const markerSubTypeForCheck = createTypeParameter();
+ var markerOtherType = createTypeParameter();
+ var markerSuperTypeForCheck = createTypeParameter();
+ var markerSubTypeForCheck = createTypeParameter();
markerSubTypeForCheck.constraint = markerSuperTypeForCheck;
- const noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
- const anySignature = createSignature(
+ var noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
+ var anySignature = createSignature(
void 0,
void 0,
void 0,
@@ -45096,7 +45598,7 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const unknownSignature = createSignature(
+ var unknownSignature = createSignature(
void 0,
void 0,
void 0,
@@ -45107,7 +45609,7 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const resolvingSignature = createSignature(
+ var resolvingSignature = createSignature(
void 0,
void 0,
void 0,
@@ -45118,7 +45620,7 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const silentNeverSignature = createSignature(
+ var silentNeverSignature = createSignature(
void 0,
void 0,
void 0,
@@ -45129,14 +45631,14 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const enumNumberIndexInfo = createIndexInfo(
+ var enumNumberIndexInfo = createIndexInfo(
numberType,
stringType,
/*isReadonly*/
true
);
- const iterationTypesCache = /* @__PURE__ */ new Map();
- const noIterationTypes = {
+ var iterationTypesCache = /* @__PURE__ */ new Map();
+ var noIterationTypes = {
get yieldType() {
return Debug.fail("Not supported");
},
@@ -45147,10 +45649,10 @@ ${lanes.join("\n")}
return Debug.fail("Not supported");
}
};
- const anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
- const anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
- const defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
- const asyncIterationTypesResolver = {
+ var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
+ var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
+ var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
+ var asyncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfAsyncIterable",
iteratorCacheKey: "iterationTypesOfAsyncIterator",
iteratorSymbolName: "asyncIterator",
@@ -45163,7 +45665,7 @@ ${lanes.join("\n")}
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
};
- const syncIterationTypesResolver = {
+ var syncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfIterable",
iteratorCacheKey: "iterationTypesOfIterator",
iteratorSymbolName: "iterator",
@@ -45176,117 +45678,118 @@ ${lanes.join("\n")}
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property
};
- let amalgamatedDuplicates;
- const reverseMappedCache = /* @__PURE__ */ new Map();
- let inInferTypeForHomomorphicMappedType = false;
- let ambientModulesCache;
- let patternAmbientModules;
- let patternAmbientModuleAugmentations;
- let globalObjectType;
- let globalFunctionType;
- let globalCallableFunctionType;
- let globalNewableFunctionType;
- let globalArrayType;
- let globalReadonlyArrayType;
- let globalStringType;
- let globalNumberType;
- let globalBooleanType;
- let globalRegExpType;
- let globalThisType;
- let anyArrayType;
- let autoArrayType;
- let anyReadonlyArrayType;
- let deferredGlobalNonNullableTypeAlias;
- let deferredGlobalESSymbolConstructorSymbol;
- let deferredGlobalESSymbolConstructorTypeSymbol;
- let deferredGlobalESSymbolType;
- let deferredGlobalTypedPropertyDescriptorType;
- let deferredGlobalPromiseType;
- let deferredGlobalPromiseLikeType;
- let deferredGlobalPromiseConstructorSymbol;
- let deferredGlobalPromiseConstructorLikeType;
- let deferredGlobalIterableType;
- let deferredGlobalIteratorType;
- let deferredGlobalIterableIteratorType;
- let deferredGlobalGeneratorType;
- let deferredGlobalIteratorYieldResultType;
- let deferredGlobalIteratorReturnResultType;
- let deferredGlobalAsyncIterableType;
- let deferredGlobalAsyncIteratorType;
- let deferredGlobalAsyncIterableIteratorType;
- let deferredGlobalAsyncGeneratorType;
- let deferredGlobalTemplateStringsArrayType;
- let deferredGlobalImportMetaType;
- let deferredGlobalImportMetaExpressionType;
- let deferredGlobalImportCallOptionsType;
- let deferredGlobalExtractSymbol;
- let deferredGlobalOmitSymbol;
- let deferredGlobalAwaitedSymbol;
- let deferredGlobalBigIntType;
- let deferredGlobalNaNSymbol;
- let deferredGlobalRecordSymbol;
- let deferredGlobalClassDecoratorContextType;
- let deferredGlobalClassMethodDecoratorContextType;
- let deferredGlobalClassGetterDecoratorContextType;
- let deferredGlobalClassSetterDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorTargetType;
- let deferredGlobalClassAccessorDecoratorResultType;
- let deferredGlobalClassFieldDecoratorContextType;
- const allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
- let flowLoopStart = 0;
- let flowLoopCount = 0;
- let sharedFlowCount = 0;
- let flowAnalysisDisabled = false;
- let flowInvocationCount = 0;
- let lastFlowNode;
- let lastFlowNodeReachable;
- let flowTypeCache;
- const contextualTypeNodes = [];
- const contextualTypes = [];
- let contextualTypeCount = 0;
- const inferenceContextNodes = [];
- const inferenceContexts = [];
- let inferenceContextCount = 0;
- const emptyStringType = getStringLiteralType("");
- const zeroType = getNumberLiteralType(0);
- const zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
- const resolutionTargets = [];
- const resolutionResults = [];
- const resolutionPropertyNames = [];
- let suggestionCount = 0;
- const maximumSuggestionCount = 10;
- const mergedSymbols = [];
- const symbolLinks = [];
- const nodeLinks = [];
- const flowLoopCaches = [];
- const flowLoopNodes = [];
- const flowLoopKeys = [];
- const flowLoopTypes = [];
- const sharedFlowNodes = [];
- const sharedFlowTypes = [];
- const flowNodeReachable = [];
- const flowNodePostSuper = [];
- const potentialThisCollisions = [];
- const potentialNewTargetCollisions = [];
- const potentialWeakMapSetCollisions = [];
- const potentialReflectCollisions = [];
- const potentialUnusedRenamedBindingElementsInTypes = [];
- const awaitedTypeStack = [];
- const diagnostics = createDiagnosticCollection();
- const suggestionDiagnostics = createDiagnosticCollection();
- const typeofType = createTypeofType();
- let _jsxNamespace;
- let _jsxFactoryEntity;
- const subtypeRelation = /* @__PURE__ */ new Map();
- const strictSubtypeRelation = /* @__PURE__ */ new Map();
- const assignableRelation = /* @__PURE__ */ new Map();
- const comparableRelation = /* @__PURE__ */ new Map();
- const identityRelation = /* @__PURE__ */ new Map();
- const enumRelation = /* @__PURE__ */ new Map();
- const builtinGlobals = createSymbolTable();
+ var amalgamatedDuplicates;
+ var reverseMappedCache = /* @__PURE__ */ new Map();
+ var inInferTypeForHomomorphicMappedType = false;
+ var ambientModulesCache;
+ var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
+ var globalObjectType;
+ var globalFunctionType;
+ var globalCallableFunctionType;
+ var globalNewableFunctionType;
+ var globalArrayType;
+ var globalReadonlyArrayType;
+ var globalStringType;
+ var globalNumberType;
+ var globalBooleanType;
+ var globalRegExpType;
+ var globalThisType;
+ var anyArrayType;
+ var autoArrayType;
+ var anyReadonlyArrayType;
+ var deferredGlobalNonNullableTypeAlias;
+ var deferredGlobalESSymbolConstructorSymbol;
+ var deferredGlobalESSymbolConstructorTypeSymbol;
+ var deferredGlobalESSymbolType;
+ var deferredGlobalTypedPropertyDescriptorType;
+ var deferredGlobalPromiseType;
+ var deferredGlobalPromiseLikeType;
+ var deferredGlobalPromiseConstructorSymbol;
+ var deferredGlobalPromiseConstructorLikeType;
+ var deferredGlobalIterableType;
+ var deferredGlobalIteratorType;
+ var deferredGlobalIterableIteratorType;
+ var deferredGlobalGeneratorType;
+ var deferredGlobalIteratorYieldResultType;
+ var deferredGlobalIteratorReturnResultType;
+ var deferredGlobalAsyncIterableType;
+ var deferredGlobalAsyncIteratorType;
+ var deferredGlobalAsyncIterableIteratorType;
+ var deferredGlobalAsyncGeneratorType;
+ var deferredGlobalTemplateStringsArrayType;
+ var deferredGlobalImportMetaType;
+ var deferredGlobalImportMetaExpressionType;
+ var deferredGlobalImportCallOptionsType;
+ var deferredGlobalExtractSymbol;
+ var deferredGlobalOmitSymbol;
+ var deferredGlobalAwaitedSymbol;
+ var deferredGlobalBigIntType;
+ var deferredGlobalNaNSymbol;
+ var deferredGlobalRecordSymbol;
+ var deferredGlobalClassDecoratorContextType;
+ var deferredGlobalClassMethodDecoratorContextType;
+ var deferredGlobalClassGetterDecoratorContextType;
+ var deferredGlobalClassSetterDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorTargetType;
+ var deferredGlobalClassAccessorDecoratorResultType;
+ var deferredGlobalClassFieldDecoratorContextType;
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
+ var flowLoopStart = 0;
+ var flowLoopCount = 0;
+ var sharedFlowCount = 0;
+ var flowAnalysisDisabled = false;
+ var flowInvocationCount = 0;
+ var lastFlowNode;
+ var lastFlowNodeReachable;
+ var flowTypeCache;
+ var contextualTypeNodes = [];
+ var contextualTypes = [];
+ var contextualIsCache = [];
+ var contextualTypeCount = 0;
+ var inferenceContextNodes = [];
+ var inferenceContexts = [];
+ var inferenceContextCount = 0;
+ var emptyStringType = getStringLiteralType("");
+ var zeroType = getNumberLiteralType(0);
+ var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
+ var resolutionTargets = [];
+ var resolutionResults = [];
+ var resolutionPropertyNames = [];
+ var suggestionCount = 0;
+ var maximumSuggestionCount = 10;
+ var mergedSymbols = [];
+ var symbolLinks = [];
+ var nodeLinks = [];
+ var flowLoopCaches = [];
+ var flowLoopNodes = [];
+ var flowLoopKeys = [];
+ var flowLoopTypes = [];
+ var sharedFlowNodes = [];
+ var sharedFlowTypes = [];
+ var flowNodeReachable = [];
+ var flowNodePostSuper = [];
+ var potentialThisCollisions = [];
+ var potentialNewTargetCollisions = [];
+ var potentialWeakMapSetCollisions = [];
+ var potentialReflectCollisions = [];
+ var potentialUnusedRenamedBindingElementsInTypes = [];
+ var awaitedTypeStack = [];
+ var diagnostics = createDiagnosticCollection();
+ var suggestionDiagnostics = createDiagnosticCollection();
+ var typeofType = createTypeofType();
+ var _jsxNamespace;
+ var _jsxFactoryEntity;
+ var subtypeRelation = /* @__PURE__ */ new Map();
+ var strictSubtypeRelation = /* @__PURE__ */ new Map();
+ var assignableRelation = /* @__PURE__ */ new Map();
+ var comparableRelation = /* @__PURE__ */ new Map();
+ var identityRelation = /* @__PURE__ */ new Map();
+ var enumRelation = /* @__PURE__ */ new Map();
+ var builtinGlobals = createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- const suggestedExtensions = [
+ var suggestedExtensions = [
[".mts", ".mjs"],
[".ts", ".js"],
[".cts", ".cjs"],
@@ -46678,7 +47181,12 @@ ${lanes.join("\n")}
}
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
- const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
+ const exportSymbol = exportValue ? getPropertyOfType(
+ getTypeOfSymbol(exportValue),
+ name,
+ /*skipObjectFunctionPropertyAugment*/
+ true
+ ) : moduleSymbol.exports.get(name);
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
markSymbolOfAliasDeclarationIfTypeOnly(
sourceNode,
@@ -47713,12 +48221,9 @@ ${lanes.join("\n")}
if (resolutionDiagnostic) {
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
} else {
- const tsExtension = tryExtractTSExtension(moduleReference);
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
- if (tsExtension) {
- errorOnTSExtensionImport(tsExtension);
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -47738,14 +48243,12 @@ ${lanes.join("\n")}
}
}
return void 0;
- function errorOnTSExtensionImport(tsExtension) {
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
- }
function getSuggestedImportSource(tsExtension) {
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
- return importSourceWithoutExtension + (tsExtension === ".mts" /* Mts */ ? ".mjs" : tsExtension === ".cts" /* Cts */ ? ".cjs" : ".js");
+ const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
+ const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
+ return importSourceWithoutExtension + ext;
}
return importSourceWithoutExtension;
}
@@ -47932,7 +48435,7 @@ ${lanes.join("\n")}
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
}
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
- return !(resolvedExternalModuleType.flags & 131068 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
+ return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
}
function getExportsOfSymbol(symbol) {
@@ -49231,7 +49734,7 @@ ${lanes.join("\n")}
return result;
}
function createAnonymousTypeNode(type2) {
- var _a3;
+ var _a3, _b2;
const typeId = type2.id;
const symbol = type2.symbol;
if (symbol) {
@@ -49257,6 +49760,20 @@ ${lanes.join("\n")}
return visitAndTransformType(type2, createTypeNodeFromObjectType);
}
} else {
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
+ if (isInstantiationExpressionType) {
+ const instantiationExpressionType = type2;
+ if (isTypeQueryNode(instantiationExpressionType.node)) {
+ const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
+ if (typeNode) {
+ return typeNode;
+ }
+ }
+ if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
+ return createElidedInformationPlaceholder(context);
+ }
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
+ }
return createTypeNodeFromObjectType(type2);
}
function shouldWriteTypeOfFunctionSymbol() {
@@ -49765,7 +50282,7 @@ ${lanes.join("\n")}
);
}
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
- var _a2, _b, _c, _d;
+ var _a2, _b, _c, _d, _e;
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
if (suppressAny)
context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -49782,6 +50299,39 @@ ${lanes.join("\n")}
/*skipUnionExpanding*/
true
)[0];
+ let cleanup;
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
+ const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
+ let newLocals;
+ for (const param of expandedParams) {
+ if (!locals.has(param.escapedName)) {
+ newLocals = append(newLocals, param.escapedName);
+ locals.set(param.escapedName, param);
+ }
+ }
+ if (newLocals) {
+ let removeNewLocals2 = function() {
+ forEach(newLocals, (s) => locals.delete(s));
+ };
+ var removeNewLocals = removeNewLocals2;
+ if (existingFakeScope) {
+ cleanup = removeNewLocals2;
+ } else {
+ const fakeScope = parseNodeFactory.createBlock(emptyArray);
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
+ fakeScope.locals = locals;
+ const saveEnclosingDeclaration = context.enclosingDeclaration;
+ setParent(fakeScope, saveEnclosingDeclaration);
+ context.enclosingDeclaration = fakeScope;
+ cleanup = () => {
+ context.enclosingDeclaration = saveEnclosingDeclaration;
+ removeNewLocals2();
+ };
+ }
+ }
+ }
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
if (thisParameter) {
@@ -49807,11 +50357,11 @@ ${lanes.join("\n")}
const flags = modifiersToFlags(modifiers);
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
}
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
modifiers,
/*asteriskToken*/
void 0,
- (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
/*questionToken*/
void 0,
typeParameters,
@@ -49826,14 +50376,14 @@ ${lanes.join("\n")}
void 0
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
modifiers,
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
parameters,
returnTypeNode,
/*body*/
void 0
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
modifiers,
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
+ (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
parameters,
/*body*/
void 0
@@ -49868,13 +50418,14 @@ ${lanes.join("\n")}
if (typeArguments) {
node.typeArguments = factory.createNodeArray(typeArguments);
}
+ cleanup == null ? void 0 : cleanup();
return node;
}
function tryGetThisParameterDeclaration(signature, context) {
if (signature.thisParameter) {
return symbolToParameterDeclaration(signature.thisParameter, context);
}
- if (signature.declaration) {
+ if (signature.declaration && isInJSFile(signature.declaration)) {
const thisTag = getJSDocThisTag(signature.declaration);
if (thisTag && thisTag.typeExpression) {
return factory.createParameterDeclaration(
@@ -50482,9 +51033,12 @@ ${lanes.join("\n")}
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
}
+ function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
+ }
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
if (!isErrorType(type) && enclosingDeclaration) {
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -50516,7 +51070,8 @@ ${lanes.join("\n")}
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
if (!isErrorType(type) && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
- if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
+ const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
+ if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
const annotated = getTypeFromTypeNode(annotation);
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -52131,8 +52686,8 @@ ${lanes.join("\n")}
const t = types[i];
flags |= t.flags;
if (!(t.flags & 98304 /* Nullable */)) {
- if (t.flags & (512 /* BooleanLiteral */ | 1024 /* EnumLiteral */)) {
- const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLiteralType(t);
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
if (baseType.flags & 1048576 /* Union */) {
const count = baseType.types.length;
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -52387,7 +52942,7 @@ ${lanes.join("\n")}
}
function findResolutionCycleStartIndex(target, propertyName) {
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
return -1;
}
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -52396,7 +52951,7 @@ ${lanes.join("\n")}
}
return -1;
}
- function hasType2(target, propertyName) {
+ function resolutionTargetHasProperty(target, propertyName) {
switch (propertyName) {
case 0 /* Type */:
return !!getSymbolLinks(target).type;
@@ -52416,6 +52971,8 @@ ${lanes.join("\n")}
return !!target.baseTypesResolved;
case 8 /* WriteType */:
return !!getSymbolLinks(target).writeType;
+ case 9 /* ParameterInitializerContainsUndefined */:
+ return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
}
return Debug.assertNever(propertyName);
}
@@ -52855,7 +53412,7 @@ ${lanes.join("\n")}
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
- const tag = getJSDocTypeTag(container);
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
if (tag && tag.typeExpression) {
return getTypeFromTypeNode(tag.typeExpression);
}
@@ -54007,8 +54564,8 @@ ${lanes.join("\n")}
}
return links.declaredType;
}
- function getBaseTypeOfEnumLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
+ function getBaseTypeOfEnumLikeType(type) {
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
}
function getDeclaredTypeOfEnum(symbol) {
const links = getSymbolLinks(symbol);
@@ -54021,7 +54578,7 @@ ${lanes.join("\n")}
if (hasBindableName(member)) {
const memberSymbol = getSymbolOfDeclaration(member);
const value = getEnumMemberValue(member);
- const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
+ const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
getSymbolLinks(memberSymbol).declaredType = memberType;
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
}
@@ -54035,7 +54592,7 @@ ${lanes.join("\n")}
symbol,
/*aliasTypeArguments*/
void 0
- ) : createTypeWithSymbol(32 /* Enum */, symbol);
+ ) : createComputedEnumType(symbol);
if (enumType.flags & 1048576 /* Union */) {
enumType.flags |= 1024 /* EnumLiteral */;
enumType.symbol = symbol;
@@ -54044,6 +54601,15 @@ ${lanes.join("\n")}
}
return links.declaredType;
}
+ function createComputedEnumType(symbol) {
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
+ regularType.regularType = regularType;
+ regularType.freshType = freshType;
+ freshType.regularType = regularType;
+ freshType.freshType = freshType;
+ return regularType;
+ }
function getDeclaredTypeOfEnumMember(symbol) {
const links = getSymbolLinks(symbol);
if (!links.declaredType) {
@@ -54992,6 +55558,7 @@ ${lanes.join("\n")}
const typeParameter = getTypeParameterFromMappedType(type);
const constraintType = getConstraintTypeFromMappedType(type);
const nameType = getNameTypeFromMappedType(type.target || type);
+ const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
const templateType = getTemplateTypeFromMappedType(type.target || type);
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
const templateModifiers = getMappedTypeModifiers(type);
@@ -55029,7 +55596,7 @@ ${lanes.join("\n")}
prop.links.keyType = keyType;
if (modifiersProp) {
prop.links.syntheticOrigin = modifiersProp;
- prop.declarations = nameType ? void 0 : modifiersProp.declarations;
+ prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
}
members.set(propName, prop);
}
@@ -55973,6 +56540,12 @@ ${lanes.join("\n")}
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
+ if (isInJSFile(declaration)) {
+ const thisTag = getJSDocThisTag(declaration);
+ if (thisTag && thisTag.typeExpression) {
+ thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
+ }
+ }
const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0;
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
@@ -56086,7 +56659,11 @@ ${lanes.join("\n")}
if (node.tags) {
for (const tag of node.tags) {
if (isJSDocOverloadTag(tag)) {
- result.push(getSignatureFromDeclaration(tag.typeExpression));
+ const jsDocSignature = tag.typeExpression;
+ if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
+ reportImplicitAny(jsDocSignature, anyType);
+ }
+ result.push(getSignatureFromDeclaration(jsDocSignature));
hasJSDocOverloads = true;
}
}
@@ -56195,6 +56772,12 @@ ${lanes.join("\n")}
if (declaration.kind === 173 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
+ if (isJSDocSignature(declaration)) {
+ const root = getJSDocRoot(declaration);
+ if (root && isConstructorDeclaration(root.parent)) {
+ return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
+ }
+ }
if (isJSDocConstructSignature(declaration)) {
return getTypeFromTypeNode(declaration.parameters[0].type);
}
@@ -56373,7 +56956,7 @@ ${lanes.join("\n")}
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
if (grandParent.kind === 180 /* TypeReference */ && !omitTypeReferences) {
const typeReference = grandParent;
- const typeParameters = getTypeParametersForTypeReference(typeReference);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReference);
if (typeParameters) {
const index = typeReference.typeArguments.indexOf(childTypeParameter);
if (index < typeParameters.length) {
@@ -56723,7 +57306,7 @@ ${lanes.join("\n")}
return links.resolvedJSDocType;
}
function getSubstitutionType(baseType, constraint) {
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
return baseType;
}
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -57666,7 +58249,7 @@ ${lanes.join("\n")}
}
}
function removeStringLiteralsMatchedByTemplateLiterals(types) {
- const templates = filter(types, isPatternLiteralType);
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
if (templates.length) {
let i = types.length;
while (i > 0) {
@@ -57716,7 +58299,7 @@ ${lanes.join("\n")}
orderedRemoveItemAt(typeSet, 1);
}
}
- if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
}
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
@@ -57785,7 +58368,7 @@ ${lanes.join("\n")}
function typePredicateKindsMatch(a, b) {
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
}
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
if (types.length === 0) {
return neverType;
}
@@ -57797,7 +58380,7 @@ ${lanes.join("\n")}
let type = unionTypes.get(id);
if (!type) {
type = createType(1048576 /* Union */);
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
types,
/*excludeKinds*/
98304 /* Nullable */
@@ -57847,7 +58430,7 @@ ${lanes.join("\n")}
type = undefinedType;
}
if (!typeSet.has(type.id.toString())) {
- if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
includes |= 67108864 /* NonPrimitive */;
}
typeSet.set(type.id.toString(), type);
@@ -58123,7 +58706,7 @@ ${lanes.join("\n")}
const typeVariable = getTypeParameterFromMappedType(mappedType);
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
function isDistributive(type) {
- return type.flags & (3 /* AnyOrUnknown */ | 131068 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
+ return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
}
}
function getLiteralTypeFromPropertyName(name) {
@@ -58410,7 +58993,7 @@ ${lanes.join("\n")}
}
}
const propType = getTypeOfSymbol(prop);
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
}
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
const index = +propName;
@@ -58776,7 +59359,7 @@ ${lanes.join("\n")}
}
function getActualTypeVariable(type) {
if (type.flags & 33554432 /* Substitution */) {
- return type.baseType;
+ return getActualTypeVariable(type.baseType);
}
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -58974,11 +59557,6 @@ ${lanes.join("\n")}
var _a2;
const links = getNodeLinks(node);
if (!links.resolvedType) {
- if (node.isTypeOf && node.typeArguments) {
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
- links.resolvedSymbol = unknownSymbol;
- return links.resolvedType = errorType;
- }
if (!isLiteralImportTypeNode(node)) {
error(node.argument, Diagnostics.String_literal_expected);
links.resolvedSymbol = unknownSymbol;
@@ -59039,15 +59617,8 @@ ${lanes.join("\n")}
const resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
if (meaning === 111551 /* Value */) {
- return getTypeOfSymbol(symbol);
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
} else {
- const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
- const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
- if (node.typeArguments && typeParameters) {
- addLazyDiagnostic(() => {
- checkTypeArgumentConstraints(node, typeParameters);
- });
- }
return getTypeReferenceType(node, resolvedSymbol);
}
}
@@ -59225,7 +59796,7 @@ ${lanes.join("\n")}
return type;
}
function getFreshTypeOfLiteralType(type) {
- if (type.flags & 2944 /* Literal */) {
+ if (type.flags & 2976 /* Freshable */) {
if (!type.freshType) {
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
freshType.freshType = freshType;
@@ -59236,10 +59807,10 @@ ${lanes.join("\n")}
return type;
}
function getRegularTypeOfLiteralType(type) {
- return type.flags & 2944 /* Literal */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
}
function isFreshLiteralType(type) {
- return !!(type.flags & 2944 /* Literal */) && type.freshType === type;
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
}
function getStringLiteralType(value) {
let type;
@@ -59918,13 +60489,13 @@ ${lanes.join("\n")}
return type;
}
function getUniqueLiteralFilledInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
}
function getPermissiveInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
}
function getRestrictiveInstantiation(type) {
- if (type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
+ if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
return type;
}
if (type.restrictiveInstantiation) {
@@ -60196,7 +60767,12 @@ ${lanes.join("\n")}
}
}
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
- pushContextualType(next, sourcePropType);
+ pushContextualType(
+ next,
+ sourcePropType,
+ /*isCache*/
+ false
+ );
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
popContextualType();
return result;
@@ -60499,12 +61075,17 @@ ${lanes.join("\n")}
}
}
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
}
- pushContextualType(node, target);
+ pushContextualType(
+ node,
+ target,
+ /*isCache*/
+ false
+ );
const tupleizedType = checkArrayLiteral(
node,
1 /* Contextual */,
@@ -60543,7 +61124,7 @@ ${lanes.join("\n")}
}
}
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
}
@@ -60566,16 +61147,24 @@ ${lanes.join("\n")}
void 0
) !== 0 /* False */;
}
- function isAnySignature(s) {
- return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s));
+ function isTopSignature(s) {
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
+ const paramType = getTypeOfParameter(s.parameters[0]);
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
+ }
+ return false;
}
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
if (source === target) {
return -1 /* True */;
}
- if (isAnySignature(target)) {
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
return -1 /* True */;
}
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
+ return 0 /* False */;
+ }
const targetCount = getParameterCount(target);
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
if (sourceHasMoreParameters) {
@@ -60793,7 +61382,9 @@ ${lanes.join("\n")}
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
const s = source.flags;
const t = target.flags;
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
+ return true;
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
return true;
if (t & 131072 /* Never */)
return false;
@@ -60920,7 +61511,6 @@ ${lanes.join("\n")}
let overrideNextErrorInfo = 0;
let lastSkippedInfo;
let incompatibleStack;
- let inPropertyCheck = false;
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
const result = isRelatedTo(
source,
@@ -61117,7 +61707,8 @@ ${lanes.join("\n")}
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
}
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
const constraint = getBaseConstraintOfType(target2);
let needsOriginalSource;
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -61190,7 +61781,7 @@ ${lanes.join("\n")}
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
}
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
- if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) {
+ if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
return -1 /* True */;
}
@@ -61254,7 +61845,7 @@ ${lanes.join("\n")}
return 0 /* False */;
}
}
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
if (reportErrors2) {
@@ -61316,7 +61907,7 @@ ${lanes.join("\n")}
maybeSuppress = !!errorInfo;
}
}
- if (source2.flags & 524288 /* Object */ && target2.flags & 131068 /* Primitive */) {
+ if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
@@ -61462,15 +62053,15 @@ ${lanes.join("\n")}
}
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
if (source2.flags & 1048576 /* Union */) {
- return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState);
+ return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
}
if (target2.flags & 1048576 /* Union */) {
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */) && !(target2.flags & 131068 /* Primitive */));
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
}
if (target2.flags & 2097152 /* Intersection */) {
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
}
- if (relation === comparableRelation && target2.flags & 131068 /* Primitive */) {
+ if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
if (constraints !== source2.types) {
source2 = getIntersectionType(constraints);
@@ -61878,14 +62469,15 @@ ${lanes.join("\n")}
);
}
}
- if (result2 && !inPropertyCheck && (target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */)))) {
- inPropertyCheck = true;
+ if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
result2 &= propertiesRelatedTo(
source2,
target2,
reportErrors2,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
@@ -61898,7 +62490,17 @@ ${lanes.join("\n")}
0 /* None */
);
}
- inPropertyCheck = false;
+ } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
+ result2 &= propertiesRelatedTo(
+ source2,
+ target2,
+ reportErrors2,
+ /*excludedProperties*/
+ void 0,
+ /*optionalsOnly*/
+ true,
+ intersectionState
+ );
}
}
if (result2) {
@@ -62352,7 +62954,7 @@ ${lanes.join("\n")}
}
return 0 /* False */;
}
- const sourceIsPrimitive = !!(sourceFlags & 131068 /* Primitive */);
+ const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
if (relation !== identityRelation) {
source2 = getApparentType(source2);
sourceFlags = source2.flags;
@@ -62388,12 +62990,14 @@ ${lanes.join("\n")}
reportStructuralErrors,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
intersectionState
);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
if (result2) {
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
}
@@ -62522,6 +63126,8 @@ ${lanes.join("\n")}
/*reportErrors*/
false,
excludedProperties,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2) {
@@ -62530,7 +63136,8 @@ ${lanes.join("\n")}
type,
0 /* Call */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2) {
result2 &= signaturesRelatedTo(
@@ -62538,7 +63145,8 @@ ${lanes.join("\n")}
type,
1 /* Construct */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
result2 &= indexSignaturesRelatedTo(
@@ -62716,7 +63324,7 @@ ${lanes.join("\n")}
}
}
}
- function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
+ function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source2, target2, excludedProperties);
}
@@ -62852,7 +63460,7 @@ ${lanes.join("\n")}
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
for (const targetProp of excludeProperties(properties, excludedProperties)) {
const name = targetProp.escapedName;
- if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
+ if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
const sourceProp = getPropertyOfType(source2, name);
if (sourceProp && sourceProp !== targetProp) {
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
@@ -62888,7 +63496,7 @@ ${lanes.join("\n")}
}
return result2;
}
- function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
+ function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
var _a3, _b;
if (relation === identityRelation) {
return signaturesIdenticalTo(source2, target2, kind);
@@ -62925,6 +63533,7 @@ ${lanes.join("\n")}
/*erase*/
true,
reportErrors2,
+ intersectionState,
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
);
if (!related) {
@@ -62936,7 +63545,7 @@ ${lanes.join("\n")}
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
const sourceSignature = first(sourceSignatures);
const targetSignature = first(targetSignatures);
- result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
+ result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
const constructSignatureToString = (signature) => signatureToString(
signature,
@@ -62961,6 +63570,7 @@ ${lanes.join("\n")}
/*erase*/
true,
shouldElaborateErrors,
+ intersectionState,
incompatibleReporter(s, t)
);
if (related) {
@@ -63013,17 +63623,29 @@ ${lanes.join("\n")}
}
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
}
- function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
+ function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
return compareSignaturesRelated(
erase ? getErasedSignature(source2) : source2,
erase ? getErasedSignature(target2) : target2,
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
+ checkMode,
reportErrors2,
reportError,
incompatibleReporter,
- isRelatedToWorker,
+ isRelatedToWorker2,
reportUnreliableMapper
);
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
+ return isRelatedTo(
+ source3,
+ target3,
+ 3 /* Both */,
+ reportErrors3,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
+ }
}
function signaturesIdenticalTo(source2, target2, kind) {
const sourceSignatures = getSignaturesOfType(source2, kind);
@@ -63082,7 +63704,7 @@ ${lanes.join("\n")}
}
for (const info of getIndexInfosOfType(source2)) {
if (isApplicableIndexType(info.keyType, keyType)) {
- const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
+ const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
if (!related) {
return 0 /* False */;
}
@@ -63091,8 +63713,16 @@ ${lanes.join("\n")}
}
return result2;
}
- function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
- const related = isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */, reportErrors2);
+ function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
+ const related = isRelatedTo(
+ sourceInfo.type,
+ targetInfo.type,
+ 3 /* Both */,
+ reportErrors2,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
if (!related && reportErrors2) {
if (sourceInfo.keyType === targetInfo.keyType) {
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -63121,9 +63751,9 @@ ${lanes.join("\n")}
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
if (sourceInfo) {
- return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
+ return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
}
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
}
if (reportErrors2) {
@@ -63412,12 +64042,15 @@ ${lanes.join("\n")}
}
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
if (depth >= maxDepth) {
+ if (type.flags & 2097152 /* Intersection */) {
+ return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
+ }
const identity2 = getRecursionIdentity(type);
let count = 0;
let lastTypeId = 0;
for (let i = 0; i < depth; i++) {
const t = stack[i];
- if (getRecursionIdentity(t) === identity2) {
+ if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
if (t.id >= lastTypeId) {
count++;
if (count >= maxDepth) {
@@ -63650,15 +64283,25 @@ ${lanes.join("\n")}
return propType;
}
if (everyType(type, isTupleType)) {
- return mapType(type, (t) => getRestTypeOfTupleType(t) || undefinedType);
+ return mapType(type, (t) => {
+ const tupleType = t;
+ const restType = getRestTypeOfTupleType(tupleType);
+ if (!restType) {
+ return undefinedType;
+ }
+ if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) {
+ return getUnionType([restType, undefinedType]);
+ }
+ return restType;
+ });
}
return void 0;
}
function isNeitherUnitTypeNorNever(type) {
- return !(type.flags & (109440 /* Unit */ | 131072 /* Never */));
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
}
function isUnitType(type) {
- return !!(type.flags & 109440 /* Unit */);
+ return !!(type.flags & 109472 /* Unit */);
}
function isUnitLikeType(type) {
const t = getBaseConstraintOrType(type);
@@ -63671,15 +64314,18 @@ ${lanes.join("\n")}
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
}
function getBaseTypeOfLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
+ return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
}
function getBaseTypeOfLiteralTypeUnion(type) {
var _a2;
const key = `B${getTypeId(type)}`;
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
}
+ function getBaseTypeOfLiteralTypeForComparison(type) {
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
+ }
function getWidenedLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
+ return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
}
function getWidenedUniqueESSymbolType(type) {
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
@@ -63720,7 +64366,7 @@ ${lanes.join("\n")}
const restType = getRestTypeOfTupleType(type);
return restType && createArrayType(restType);
}
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
const length2 = getTypeReferenceArity(type) - endSkipCount;
if (index < length2) {
const typeArguments = getTypeArguments(type);
@@ -63729,7 +64375,7 @@ ${lanes.join("\n")}
const t = typeArguments[i];
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
}
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
return void 0;
}
@@ -63797,7 +64443,7 @@ ${lanes.join("\n")}
}
function isObjectTypeWithInferableIndex(type) {
const objectFlags = getObjectFlags(type);
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
}
function createSymbolWithType(source, type) {
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -64035,6 +64681,11 @@ ${lanes.join("\n")}
case 320 /* JSDocFunctionType */:
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
+ case 326 /* JSDocSignature */:
+ if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
+ error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
+ }
+ return;
case 259 /* FunctionDeclaration */:
case 171 /* MethodDeclaration */:
case 170 /* MethodSignature */:
@@ -64207,8 +64858,8 @@ ${lanes.join("\n")}
}
return false;
}
- function isTypeParameterAtTopLevel(type, typeParameter) {
- return !!(type === typeParameter || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, typeParameter)) || type.flags & 16777216 /* Conditional */ && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
+ function isTypeParameterAtTopLevel(type, tp, depth = 0) {
+ return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
}
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
const typePredicate = getTypePredicateOfSignature(signature);
@@ -64302,7 +64953,7 @@ ${lanes.join("\n")}
yield targetProp;
} else if (matchDiscriminantProperties) {
const targetType = getTypeOfSymbol(targetProp);
- if (targetType.flags & 109440 /* Unit */) {
+ if (targetType.flags & 109472 /* Unit */) {
const sourceType = getTypeOfSymbol(sourceProp);
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
yield targetProp;
@@ -64363,10 +65014,10 @@ ${lanes.join("\n")}
return getBigIntLiteralType(parseValidBigInt(text));
}
function isMemberOfStringMapping(source, target) {
- if (target.flags & (4 /* String */ | 1 /* Any */)) {
+ if (target.flags & 1 /* Any */) {
return true;
}
- if (target.flags & 134217728 /* TemplateLiteral */) {
+ if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
return isTypeAssignableTo(source, target);
}
if (target.flags & 268435456 /* StringMapping */) {
@@ -65061,7 +65712,7 @@ ${lanes.join("\n")}
}
function hasPrimitiveConstraint(type) {
const constraint = getConstraintOfTypeParameter(type);
- return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
}
function isObjectLiteralType2(type) {
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
@@ -65543,7 +66194,7 @@ ${lanes.join("\n")}
return 83886079 /* UnknownFacts */;
}
function getIntersectionTypeFacts(type) {
- const ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
+ const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
let oredFacts = 0 /* None */;
let andedFacts = 134217727 /* All */;
for (const t of type.types) {
@@ -65742,7 +66393,7 @@ ${lanes.join("\n")}
}
return true;
}
- if (source.flags & 1024 /* EnumLiteral */ && getBaseTypeOfEnumLiteralType(source) === target) {
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
return true;
}
return containsType(target.types, source);
@@ -65780,7 +66431,7 @@ ${lanes.join("\n")}
}
return getUnionTypeFromSortedList(
filtered,
- type.objectFlags,
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
/*aliasSymbol*/
void 0,
/*aliasTypeArguments*/
@@ -66138,10 +66789,12 @@ ${lanes.join("\n")}
}
function isConstantReference(node) {
switch (node.kind) {
- case 79 /* Identifier */: {
- const symbol = getResolvedSymbol(node);
- return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
- }
+ case 79 /* Identifier */:
+ if (!isThisInTypeQuery(node)) {
+ const symbol = getResolvedSymbol(node);
+ return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
+ }
+ break;
case 208 /* PropertyAccessExpression */:
case 209 /* ElementAccessExpression */:
return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
@@ -66287,7 +66940,7 @@ ${lanes.join("\n")}
}
return declaredType;
}
- if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) {
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
}
return void 0;
@@ -66804,7 +67457,7 @@ ${lanes.join("\n")}
}
if (assumeTrue) {
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
- if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
+ if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
return valueType;
}
if (valueType.flags & 524288 /* Object */) {
@@ -66837,7 +67490,7 @@ ${lanes.join("\n")}
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
}
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
- return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
+ return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getAdjustedTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
}
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
const everyClauseChecks = clauseStart !== clauseEnd && every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -66854,7 +67507,7 @@ ${lanes.join("\n")}
let groundClauseTypes;
for (let i = 0; i < clauseTypes.length; i += 1) {
const t = clauseTypes[i];
- if (t.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
+ if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
if (groundClauseTypes !== void 0) {
groundClauseTypes.push(t);
}
@@ -66973,52 +67626,58 @@ ${lanes.join("\n")}
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
return type;
}
- let targetType;
- const prototypeProperty = getPropertyOfType(rightType, "prototype");
- if (prototypeProperty) {
- const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
- if (!isTypeAny(prototypePropertyType)) {
- targetType = prototypePropertyType;
- }
- }
- if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
+ const instanceType = mapType(rightType, getInstanceType);
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
return type;
}
- if (!targetType) {
- const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
- targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
- }
- if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
- const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
- if (!nonConstructorTypeInUnion)
- return type;
- }
return getNarrowedType(
type,
- targetType,
+ instanceType,
assumeTrue,
/*checkDerived*/
true
);
}
+ function getInstanceType(constructorType) {
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
+ return prototypePropertyType;
+ }
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
+ if (constructSignatures.length) {
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
+ }
+ return emptyObjectType;
+ }
function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
var _a3;
const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
}
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
if (!assumeTrue) {
- return filterType(type, (t) => !isRelated(t, candidate));
+ if (checkDerived) {
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
+ }
+ const trueType2 = getNarrowedType(
+ type,
+ candidate,
+ /*assumeTrue*/
+ true,
+ /*checkDerived*/
+ false
+ );
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
}
if (type.flags & 3 /* AnyOrUnknown */) {
return candidate;
}
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
const narrowedType = mapType(candidate, (c) => {
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
+ const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
});
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -67122,7 +67781,7 @@ ${lanes.join("\n")}
}
}
function getTypeOfSymbolAtLocation(symbol, location) {
- symbol = symbol.exportSymbol || symbol;
+ symbol = getExportSymbolOfValueSymbolIfExported(symbol);
if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) {
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
@@ -67174,15 +67833,25 @@ ${lanes.join("\n")}
function isConstVariable(symbol) {
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
}
- function removeOptionalityFromDeclaredType(declaredType, declaration) {
- if (pushTypeResolution(declaration.symbol, 2 /* DeclaredType */)) {
- const annotationIncludesUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
- popTypeResolution();
- return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
- } else {
- reportCircularityError(declaration.symbol);
- return declaredType;
+ function parameterInitializerContainsUndefined(declaration) {
+ const links = getNodeLinks(declaration);
+ if (links.parameterInitializerContainsUndefined === void 0) {
+ if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
+ if (!popTypeResolution()) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ links.parameterInitializerContainsUndefined = containsUndefined;
}
+ return links.parameterInitializerContainsUndefined;
+ }
+ function removeOptionalityFromDeclaredType(declaredType, declaration) {
+ const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
+ return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
}
function isConstraintPosition(type, node) {
const parent2 = node.parent;
@@ -68293,9 +68962,18 @@ ${lanes.join("\n")}
if (prop) {
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
}
- if (isTupleType(t)) {
- const restType = getRestTypeOfTupleType(t);
- if (restType && isNumericLiteralName(name) && +name >= 0) {
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
+ const restType = getElementTypeOfSliceOfTupleType(
+ t,
+ t.target.fixedLength,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ );
+ if (restType) {
return restType;
}
}
@@ -68342,9 +69020,18 @@ ${lanes.join("\n")}
return void 0;
}
function getContextualTypeForElementExpression(arrayContextualType, index) {
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
arrayContextualType,
- (t) => getIteratedTypeOrElementType(
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
+ t,
+ 0,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ ) : getIteratedTypeOrElementType(
1 /* Element */,
t,
undefinedType,
@@ -68497,14 +69184,17 @@ ${lanes.join("\n")}
return type;
}
function getContextualType2(node, contextFlags) {
+ var _a2, _b;
if (node.flags & 33554432 /* InWithStatement */) {
return void 0;
}
- const index = findContextualNode(node);
+ const index = findContextualNode(
+ node,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
- const cached = contextualTypes[index];
- if (cached || !contextFlags)
- return cached;
+ return contextualTypes[index];
}
const { parent: parent2 } = node;
switch (parent2.kind) {
@@ -68539,7 +69229,9 @@ ${lanes.join("\n")}
case 206 /* ArrayLiteralExpression */: {
const arrayLiteral = parent2;
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
}
case 224 /* ConditionalExpression */:
return getContextualTypeForConditionalOperand(node, contextFlags);
@@ -68575,17 +69267,30 @@ ${lanes.join("\n")}
}
return void 0;
}
- function pushContextualType(node, type) {
+ function pushCachedContextualType(node) {
+ pushContextualType(
+ node,
+ getContextualType2(
+ node,
+ /*contextFlags*/
+ void 0
+ ),
+ /*isCache*/
+ true
+ );
+ }
+ function pushContextualType(node, type, isCache) {
contextualTypeNodes[contextualTypeCount] = node;
contextualTypes[contextualTypeCount] = type;
+ contextualIsCache[contextualTypeCount] = isCache;
contextualTypeCount++;
}
function popContextualType() {
contextualTypeCount--;
}
- function findContextualNode(node) {
+ function findContextualNode(node, includeCaches) {
for (let i = contextualTypeCount - 1; i >= 0; i--) {
- if (node === contextualTypeNodes[i]) {
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
return i;
}
}
@@ -68608,7 +69313,11 @@ ${lanes.join("\n")}
}
function getContextualJsxElementAttributesType(node, contextFlags) {
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
- const index = findContextualNode(node.parent);
+ const index = findContextualNode(
+ node.parent,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
return contextualTypes[index];
}
@@ -68879,11 +69588,7 @@ ${lanes.join("\n")}
const elementCount = elements.length;
const elementTypes = [];
const elementFlags = [];
- pushContextualType(node, getContextualType2(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const inDestructuringPattern = isAssignmentTarget(node);
const inConstContext = isConstContext(node);
const contextualType = getApparentTypeOfContextualType(
@@ -69046,11 +69751,7 @@ ${lanes.join("\n")}
let propertiesTable = createSymbolTable();
let propertiesArray = [];
let spread = emptyObjectType;
- pushContextualType(node, getContextualType2(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const contextualType = getApparentTypeOfContextualType(
node,
/*contextFlags*/
@@ -70337,7 +71038,7 @@ ${lanes.join("\n")}
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
let errorInfo;
let relatedInfo;
- if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 131068 /* Primitive */)) {
+ if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
for (const subtype of containingType.types) {
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
@@ -70390,26 +71091,22 @@ ${lanes.join("\n")}
function getSuggestedLibForNonExistentName(name) {
const missingName = diagnosticName(name);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const containingTypes = getOwnKeys(allFeatures[libTarget]);
- if (containingTypes !== void 0 && contains(containingTypes, missingName)) {
- return libTarget;
- }
- }
+ const typeFeatures = allFeatures.get(missingName);
+ return typeFeatures && firstIterator(typeFeatures.keys());
}
function getSuggestedLibForNonExistentProperty(missingProperty, containingType) {
const container = getApparentType(containingType).symbol;
if (!container) {
return void 0;
}
+ const containingTypeName = symbolName(container);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const featuresOfLib = allFeatures[libTarget];
- const featuresOfContainingType = featuresOfLib[symbolName(container)];
- if (featuresOfContainingType !== void 0 && contains(featuresOfContainingType, missingProperty)) {
- return libTarget;
+ const typeFeatures = allFeatures.get(containingTypeName);
+ if (typeFeatures) {
+ for (const [libTarget, featuresOfType] of typeFeatures) {
+ if (contains(featuresOfType, missingProperty)) {
+ return libTarget;
+ }
}
}
}
@@ -70938,7 +71635,7 @@ ${lanes.join("\n")}
} else {
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
- const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
flags.push(1 /* Required */);
}
@@ -71472,7 +72169,7 @@ ${lanes.join("\n")}
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
const isDecorator2 = node.kind === 167 /* Decorator */;
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
- const reportErrors2 = !candidatesOutArray;
+ const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
let typeArguments;
if (!isDecorator2 && !isSuperCall(node)) {
typeArguments = node.typeArguments;
@@ -72431,7 +73128,7 @@ ${lanes.join("\n")}
}
}
function checkCallExpression(node, checkMode) {
- var _a2;
+ var _a2, _b, _c;
checkGrammarTypeArguments(node, node.typeArguments);
const signature = getResolvedSignature(
node,
@@ -72448,7 +73145,7 @@ ${lanes.join("\n")}
}
if (node.kind === 211 /* NewExpression */) {
const declaration = signature.declaration;
- if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
+ if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
if (noImplicitAny) {
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
}
@@ -72476,7 +73173,7 @@ ${lanes.join("\n")}
/*allowDeclaration*/
false
);
- if ((_a2 = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _a2.size) {
+ if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
return getIntersectionType([returnType, jsAssignmentType]);
@@ -72762,6 +73459,9 @@ ${lanes.join("\n")}
checkGrammarExpressionWithTypeArguments(node);
forEach(node.typeArguments, checkSourceElement);
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
+ return getInstantiationExpressionType(exprType, node);
+ }
+ function getInstantiationExpressionType(exprType, node) {
const typeArguments = node.typeArguments;
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
return exprType;
@@ -74185,10 +74885,10 @@ ${lanes.join("\n")}
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 131068 /* Primitive */)) {
+ if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
}
return booleanType;
@@ -74710,8 +75410,8 @@ ${lanes.join("\n")}
case 32 /* LessThanEqualsToken */:
case 33 /* GreaterThanEqualsToken */:
if (checkForDisallowedESSymbolOperand(operator)) {
- leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
- rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
+ leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
+ rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
reportOperatorErrorUnless((left2, right2) => {
if (isTypeAny(left2) || isTypeAny(right2)) {
return true;
@@ -74771,7 +75471,7 @@ ${lanes.join("\n")}
return leftType;
} else {
checkAssignmentOperator(rightType);
- return getRegularTypeOfObjectLiteral(rightType);
+ return rightType;
}
case 27 /* CommaToken */:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -75062,14 +75762,19 @@ ${lanes.join("\n")}
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
}
function getContextNode2(node) {
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
return node.parent.parent;
}
return node;
}
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
const contextNode = getContextNode2(node);
- pushContextualType(contextNode, contextualType);
+ pushContextualType(
+ contextNode,
+ contextualType,
+ /*isCache*/
+ false
+ );
pushInferenceContext(contextNode, inferenceContext);
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -75400,7 +76105,7 @@ ${lanes.join("\n")}
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
return checkExpression(node);
}
return void 0;
@@ -75410,7 +76115,12 @@ ${lanes.join("\n")}
if (links.contextFreeType) {
return links.contextFreeType;
}
- pushContextualType(node, anyType);
+ pushContextualType(
+ node,
+ anyType,
+ /*isCache*/
+ false
+ );
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
popContextualType();
return type;
@@ -75625,7 +76335,7 @@ ${lanes.join("\n")}
error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
}
}
- if ((node.questionToken || isJSDocOptionalParameter(node)) && isBindingPattern(node.name) && func.body) {
+ if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
}
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
@@ -76147,8 +76857,8 @@ ${lanes.join("\n")}
}
return void 0;
}
- function getTypeParametersForTypeReference(node) {
- const type = getTypeFromTypeReference(node);
+ function getTypeParametersForTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
const symbol = getNodeLinks(node).resolvedSymbol;
if (symbol) {
@@ -76166,11 +76876,14 @@ ${lanes.join("\n")}
}
}
forEach(node.typeArguments, checkSourceElement);
- const type = getTypeFromTypeReference(node);
+ checkTypeReferenceOrImport(node);
+ }
+ function checkTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
if (node.typeArguments) {
addLazyDiagnostic(() => {
- const typeParameters = getTypeParametersForTypeReference(node);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(node);
if (typeParameters) {
checkTypeArgumentConstraints(node, typeParameters);
}
@@ -76192,7 +76905,7 @@ ${lanes.join("\n")}
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
if (!typeReferenceNode)
return void 0;
- const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReferenceNode);
if (!typeParameters)
return void 0;
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
@@ -76372,7 +77085,7 @@ ${lanes.join("\n")}
}
}
}
- getTypeFromTypeNode(node);
+ checkTypeReferenceOrImport(node);
}
function checkNamedTupleMember(node) {
if (node.dotDotDotToken && node.questionToken) {
@@ -76537,6 +77250,17 @@ ${lanes.join("\n")}
lastSeenNonAmbientDeclaration = node;
}
}
+ if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
+ for (const node2 of current.jsDoc) {
+ if (node2.tags) {
+ for (const tag of node2.tags) {
+ if (isJSDocOverloadTag(tag)) {
+ hasOverloads = true;
+ }
+ }
+ }
+ }
+ }
}
}
if (multipleConstructorImplementation) {
@@ -76574,8 +77298,9 @@ ${lanes.join("\n")}
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
for (const signature of signatures) {
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
+ const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
addRelatedInfo(
- error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
+ error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
);
break;
@@ -76668,6 +77393,9 @@ ${lanes.join("\n")}
case 273 /* ImportSpecifier */:
case 79 /* Identifier */:
return 1 /* ExportValue */;
+ case 170 /* MethodSignature */:
+ case 168 /* PropertySignature */:
+ return 2 /* ExportType */;
default:
return Debug.failBadSyntaxKind(d);
}
@@ -76691,7 +77419,7 @@ ${lanes.join("\n")}
))) {
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
}
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return void 0;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -76743,7 +77471,7 @@ ${lanes.join("\n")}
return awaitedType || errorType;
}
function isThenableType(type) {
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return false;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -76792,7 +77520,7 @@ ${lanes.join("\n")}
return awaitedType;
}
}
- Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
+ Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
return type;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -79605,20 +80333,19 @@ ${lanes.join("\n")}
}
}
}
- function getMemberOverrideModifierStatus(node, member) {
+ function getMemberOverrideModifierStatus(node, member, memberSymbol) {
if (!member.name) {
return 0 /* Ok */;
}
- const symbol = getSymbolOfDeclaration(node);
- const type = getDeclaredTypeOfSymbol(symbol);
+ const classSymbol = getSymbolOfDeclaration(node);
+ const type = getDeclaredTypeOfSymbol(classSymbol);
const typeWithThis = getTypeWithThisArgument(type);
- const staticType = getTypeOfSymbol(symbol);
+ const staticType = getTypeOfSymbol(classSymbol);
const baseTypeNode = getEffectiveBaseTypeNode(node);
const baseTypes = baseTypeNode && getBaseTypes(type);
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
const baseStaticType = getBaseConstructorTypeOfClass(type);
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
- const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
return checkMemberForOverrideModifier(
node,
staticType,
@@ -79631,7 +80358,7 @@ ${lanes.join("\n")}
isStatic(member),
/* memberIsParameterProperty */
false,
- memberName
+ symbolName(memberSymbol)
);
}
function getTargetSymbol(s) {
@@ -80183,7 +80910,7 @@ ${lanes.join("\n")}
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
}
}
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
if (exportModifier) {
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -80514,8 +81241,6 @@ ${lanes.join("\n")}
} else {
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
- } else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
- grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
}
@@ -80670,7 +81395,7 @@ ${lanes.join("\n")}
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
- const sym = resolveEntityName(
+ const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
id,
67108863 /* All */,
/*ignoreErrors*/
@@ -80678,7 +81403,7 @@ ${lanes.join("\n")}
/*dontResolveAlias*/
true,
node
- );
+ ));
if (sym) {
markAliasReferenced(sym, id);
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
@@ -80722,8 +81447,6 @@ ${lanes.join("\n")}
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
- } else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
- grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
}
}
}
@@ -81051,6 +81774,8 @@ ${lanes.join("\n")}
if (!(links.flags & 1 /* TypeChecked */)) {
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
links.deferredNodes.add(node);
+ } else {
+ Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
}
}
function checkDeferredNodes(context) {
@@ -81058,6 +81783,7 @@ ${lanes.join("\n")}
if (links.deferredNodes) {
links.deferredNodes.forEach(checkDeferredNode);
}
+ links.deferredNodes = void 0;
}
function checkDeferredNode(node) {
var _a2, _b;
@@ -81313,7 +82039,7 @@ ${lanes.join("\n")}
}
return node.parent.kind === 180 /* TypeReference */;
}
- function isHeritageClauseElementIdentifier(node) {
+ function isInNameOfExpressionWithTypeArguments(node) {
while (node.parent.kind === 208 /* PropertyAccessExpression */) {
node = node.parent;
}
@@ -81423,10 +82149,10 @@ ${lanes.join("\n")}
while (isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
name = name.parent;
}
- if (isHeritageClauseElementIdentifier(name)) {
+ if (isInNameOfExpressionWithTypeArguments(name)) {
let meaning = 0 /* None */;
if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) {
- meaning = 788968 /* Type */;
+ meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */;
if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
meaning |= 111551 /* Value */;
}
@@ -81832,8 +82558,8 @@ ${lanes.join("\n")}
}
return getNamedMembers(propsByName);
}
- function typeHasCallOrConstructSignatures2(type) {
- return typeHasCallOrConstructSignatures(type, checker);
+ function typeHasCallOrConstructSignatures(type) {
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
}
function getRootSymbols(symbol) {
const roots = getImmediateRootSymbols(symbol);
@@ -82138,7 +82864,7 @@ ${lanes.join("\n")}
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
}
function getTypeReferenceSerializationKind(typeNameIn, location) {
- var _a2, _b;
+ var _a2;
const typeName = getParseTreeNode(typeNameIn, isEntityName);
if (!typeName)
return 0 /* Unknown */;
@@ -82170,7 +82896,7 @@ ${lanes.join("\n")}
location
);
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
- isTypeOnly || (isTypeOnly = !!((_b = valueSymbol == null ? void 0 : valueSymbol.declarations) == null ? void 0 : _b.every(isTypeOnlyImportOrExportDeclaration)));
+ isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
const typeSymbol = resolveEntityName(
typeName,
788968 /* Type */,
@@ -82321,7 +83047,7 @@ ${lanes.join("\n")}
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- const enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
type.symbol,
111551 /* Value */,
enclosing,
@@ -82864,6 +83590,7 @@ ${lanes.join("\n")}
let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator;
let flags = 0 /* None */;
let sawExportBeforeDecorators = false;
+ let hasLeadingDecorators = false;
for (const modifier of node.modifiers) {
if (isDecorator(modifier)) {
if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) {
@@ -82881,8 +83608,22 @@ ${lanes.join("\n")}
if (flags & ~(1025 /* ExportDefault */ | 131072 /* Decorator */)) {
return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
}
+ if (hasLeadingDecorators && flags & 126975 /* Modifier */) {
+ Debug.assertIsDefined(firstDecorator);
+ const sourceFile = getSourceFileOfNode(modifier);
+ if (!hasParseDiagnostics(sourceFile)) {
+ addRelatedInfo(
+ error(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
+ );
+ return true;
+ }
+ return false;
+ }
flags |= 131072 /* Decorator */;
- if (flags & 1 /* Export */) {
+ if (!(flags & 126975 /* Modifier */)) {
+ hasLeadingDecorators = true;
+ } else if (flags & 1 /* Export */) {
sawExportBeforeDecorators = true;
}
firstDecorator != null ? firstDecorator : firstDecorator = modifier;
@@ -83170,7 +83911,6 @@ ${lanes.join("\n")}
case 299 /* PropertyAssignment */:
case 300 /* ShorthandPropertyAssignment */:
case 267 /* NamespaceExportDeclaration */:
- case 181 /* FunctionType */:
case 279 /* MissingDeclaration */:
return find(node.modifiers, isModifier);
default:
@@ -83867,7 +84607,7 @@ ${lanes.join("\n")}
}
function isSimpleLiteralEnumReference(expr) {
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
- return !!(checkExpressionCached(expr).flags & 1024 /* EnumLiteral */);
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
}
}
function checkAmbientInitializer(node) {
@@ -84269,10 +85009,10 @@ ${lanes.join("\n")}
}
function findMostOverlappyType(source, unionTarget) {
let bestMatch;
- if (!(source.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
let matchingCount = 0;
for (const target of unionTarget.types) {
- if (!(target.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
if (overlap.flags & 4194304 /* Index */) {
return target;
@@ -84290,7 +85030,7 @@ ${lanes.join("\n")}
}
function filterPrimitivesIfContainsNonPrimitive(type) {
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
- const result = filterType(type, (t) => !(t.flags & 131068 /* Primitive */));
+ const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
if (!(result.flags & 131072 /* Never */)) {
return result;
}
@@ -84375,9 +85115,8 @@ ${lanes.join("\n")}
"src/compiler/checker.ts"() {
"use strict";
init_ts2();
- init_ts2();
- init_ts_performance();
init_ts_moduleSpecifiers();
+ init_ts_performance();
ambientModuleSymbolRegex = /^".+"$/;
anon = "(anonymous)";
nextSymbolId = 1;
@@ -84490,6 +85229,7 @@ ${lanes.join("\n")}
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
return SignatureCheckMode3;
})(SignatureCheckMode || {});
@@ -85835,7 +86575,7 @@ ${lanes.join("\n")}
[291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
return context.factory.updateJsxExpression(
node,
- Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
+ nodeVisitor(node.expression, visitor, isExpression)
);
},
// Clauses
@@ -85920,31 +86660,31 @@ ${lanes.join("\n")}
// src/compiler/sourcemap.ts
function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
- const { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
- const rawSources = [];
- const sources = [];
- const sourceToSourceIndexMap = /* @__PURE__ */ new Map();
- let sourcesContent;
- const names = [];
- let nameToNameIndexMap;
- const mappingCharCodes = [];
- let mappings = "";
- let lastGeneratedLine = 0;
- let lastGeneratedCharacter = 0;
- let lastSourceIndex = 0;
- let lastSourceLine = 0;
- let lastSourceCharacter = 0;
- let lastNameIndex = 0;
- let hasLast = false;
- let pendingGeneratedLine = 0;
- let pendingGeneratedCharacter = 0;
- let pendingSourceIndex = 0;
- let pendingSourceLine = 0;
- let pendingSourceCharacter = 0;
- let pendingNameIndex = 0;
- let hasPending = false;
- let hasPendingSource = false;
- let hasPendingName = false;
+ var { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
+ var rawSources = [];
+ var sources = [];
+ var sourceToSourceIndexMap = /* @__PURE__ */ new Map();
+ var sourcesContent;
+ var names = [];
+ var nameToNameIndexMap;
+ var mappingCharCodes = [];
+ var mappings = "";
+ var lastGeneratedLine = 0;
+ var lastGeneratedCharacter = 0;
+ var lastSourceIndex = 0;
+ var lastSourceLine = 0;
+ var lastSourceCharacter = 0;
+ var lastNameIndex = 0;
+ var hasLast = false;
+ var pendingGeneratedLine = 0;
+ var pendingGeneratedCharacter = 0;
+ var pendingSourceIndex = 0;
+ var pendingSourceLine = 0;
+ var pendingSourceCharacter = 0;
+ var pendingNameIndex = 0;
+ var hasPending = false;
+ var hasPendingSource = false;
+ var hasPendingName = false;
return {
getSources: () => rawSources,
addSource,
@@ -89206,7 +89946,7 @@ ${lanes.join("\n")}
return node;
}
function tryGetConstEnumValue(node) {
- if (compilerOptions.isolatedModules) {
+ if (getIsolatedModules(compilerOptions)) {
return void 0;
}
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
@@ -89763,7 +90503,16 @@ ${lanes.join("\n")}
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
);
}
- return visitEachChild(node, visitor, context);
+ return factory2.updatePropertyDeclaration(
+ node,
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
+ visitNode(node.name, propertyNameVisitor, isPropertyName),
+ /*questionOrExclamationToken*/
+ void 0,
+ /*type*/
+ void 0,
+ visitNode(node.initializer, visitor, isExpression)
+ );
}
function transformPublicFieldInitializer(node) {
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
@@ -95126,7 +95875,7 @@ ${lanes.join("\n")}
);
}
function visitBinaryExpression(node, expressionResultIsUnused2) {
- if (isDestructuringAssignment(node) && node.left.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (isDestructuringAssignment(node) && containsObjectRestOrSpread(node.left)) {
return flattenDestructuringAssignment(
node,
visitor,
@@ -95258,7 +96007,7 @@ ${lanes.join("\n")}
}
function visitForOfStatement(node, outermostLabeledStatement) {
const ancestorFacts = enterSubtree(0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */);
- if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */ || isAssignmentPattern(node.initializer) && containsObjectRestOrSpread(node.initializer)) {
node = transformForOfStatementWithObjectRest(node);
}
const result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory2.restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
@@ -103156,6 +103905,9 @@ ${lanes.join("\n")}
return visitEachChild(node, visitor, context);
}
function visitImportCallExpression(node) {
+ if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
+ return visitEachChild(node, visitor, context);
+ }
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
@@ -105645,7 +106397,7 @@ ${lanes.join("\n")}
if (node.isDeclarationFile) {
return node;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
currentSourceFile = node;
importRequireStatements = void 0;
let result = updateExternalModule(node);
@@ -105852,7 +106604,7 @@ ${lanes.join("\n")}
}
function onEmitNode(hint, node, emitCallback) {
if (isSourceFile(node)) {
- if ((isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) {
+ if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
helperNameSubstitutions = /* @__PURE__ */ new Map();
}
previousOnEmitNode(hint, node, emitCallback);
@@ -106721,7 +107473,7 @@ ${lanes.join("\n")}
if (elem.kind === 229 /* OmittedExpression */) {
return elem;
}
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
return factory2.updateBindingElement(
elem,
elem.dotDotDotToken,
@@ -108610,15 +109362,15 @@ ${lanes.join("\n")}
return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
}
function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
- const compilerOptions = host.getCompilerOptions();
- const sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
- const emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
- const emitterDiagnostics = createDiagnosticCollection();
- const newLine = getNewLineCharacter(compilerOptions);
- const writer = createTextWriter(newLine);
- const { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
- let bundleBuildInfo;
- let emitSkipped = false;
+ var compilerOptions = host.getCompilerOptions();
+ var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
+ var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
+ var emitterDiagnostics = createDiagnosticCollection();
+ var newLine = getNewLineCharacter(compilerOptions);
+ var writer = createTextWriter(newLine);
+ var { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
+ var bundleBuildInfo;
+ var emitSkipped = false;
enter();
forEachEmittedFile(
host,
@@ -109138,7 +109890,7 @@ ${lanes.join("\n")}
return outputFiles;
}
function createPrinter(printerOptions = {}, handlers = {}) {
- const {
+ var {
hasGlobalName,
onEmitNode = noEmitNotification,
isEmitNotificationEnabled,
@@ -109150,57 +109902,57 @@ ${lanes.join("\n")}
onBeforeEmitToken,
onAfterEmitToken
} = handlers;
- const extendedDiagnostics = !!printerOptions.extendedDiagnostics;
- const newLine = getNewLineCharacter(printerOptions);
- const moduleKind = getEmitModuleKind(printerOptions);
- const bundledHelpers = /* @__PURE__ */ new Map();
- let currentSourceFile;
- let nodeIdToGeneratedName;
- let nodeIdToGeneratedPrivateName;
- let autoGeneratedIdToGeneratedName;
- let generatedNames;
- let formattedNameTempFlagsStack;
- let formattedNameTempFlags;
- let privateNameTempFlagsStack;
- let privateNameTempFlags;
- let tempFlagsStack;
- let tempFlags;
- let reservedNamesStack;
- let reservedNames;
- let reservedPrivateNamesStack;
- let reservedPrivateNames;
- let preserveSourceNewlines = printerOptions.preserveSourceNewlines;
- let nextListElementPos;
- let writer;
- let ownWriter;
- let write = writeBase;
- let isOwnFileEmit;
- const bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
- const relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
- const recordInternalSection = printerOptions.recordInternalSection;
- let sourceFileTextPos = 0;
- let sourceFileTextKind = "text" /* Text */;
- let sourceMapsDisabled = true;
- let sourceMapGenerator;
- let sourceMapSource;
- let sourceMapSourceIndex = -1;
- let mostRecentlyAddedSourceMapSource;
- let mostRecentlyAddedSourceMapSourceIndex = -1;
- let containerPos = -1;
- let containerEnd = -1;
- let declarationListContainerEnd = -1;
- let currentLineMap;
- let detachedCommentsInfo;
- let hasWrittenComment = false;
- let commentsDisabled = !!printerOptions.removeComments;
- let lastSubstitution;
- let currentParenthesizerRule;
- const { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
- const parenthesizer = factory.parenthesizer;
- const typeArgumentParenthesizerRuleSelector = {
+ var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
+ var newLine = getNewLineCharacter(printerOptions);
+ var moduleKind = getEmitModuleKind(printerOptions);
+ var bundledHelpers = /* @__PURE__ */ new Map();
+ var currentSourceFile;
+ var nodeIdToGeneratedName;
+ var nodeIdToGeneratedPrivateName;
+ var autoGeneratedIdToGeneratedName;
+ var generatedNames;
+ var formattedNameTempFlagsStack;
+ var formattedNameTempFlags;
+ var privateNameTempFlagsStack;
+ var privateNameTempFlags;
+ var tempFlagsStack;
+ var tempFlags;
+ var reservedNamesStack;
+ var reservedNames;
+ var reservedPrivateNamesStack;
+ var reservedPrivateNames;
+ var preserveSourceNewlines = printerOptions.preserveSourceNewlines;
+ var nextListElementPos;
+ var writer;
+ var ownWriter;
+ var write = writeBase;
+ var isOwnFileEmit;
+ var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
+ var relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
+ var recordInternalSection = printerOptions.recordInternalSection;
+ var sourceFileTextPos = 0;
+ var sourceFileTextKind = "text" /* Text */;
+ var sourceMapsDisabled = true;
+ var sourceMapGenerator;
+ var sourceMapSource;
+ var sourceMapSourceIndex = -1;
+ var mostRecentlyAddedSourceMapSource;
+ var mostRecentlyAddedSourceMapSourceIndex = -1;
+ var containerPos = -1;
+ var containerEnd = -1;
+ var declarationListContainerEnd = -1;
+ var currentLineMap;
+ var detachedCommentsInfo;
+ var hasWrittenComment = false;
+ var commentsDisabled = !!printerOptions.removeComments;
+ var lastSubstitution;
+ var currentParenthesizerRule;
+ var { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
+ var parenthesizer = factory.parenthesizer;
+ var typeArgumentParenthesizerRuleSelector = {
select: (index) => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : void 0
};
- const emitBinaryExpression = createEmitBinaryExpression();
+ var emitBinaryExpression = createEmitBinaryExpression();
reset2();
return {
// public API
@@ -109459,9 +110211,9 @@ ${lanes.join("\n")}
formattedNameTempFlagsStack = [];
formattedNameTempFlags = /* @__PURE__ */ new Map();
privateNameTempFlagsStack = [];
- privateNameTempFlags = TempFlags.Auto;
+ privateNameTempFlags = 0 /* Auto */;
tempFlagsStack = [];
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
reservedNamesStack = [];
reservedNames = void 0;
reservedPrivateNamesStack = [];
@@ -110430,7 +111182,7 @@ ${lanes.join("\n")}
}
function emitTypeLiteral(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -110619,7 +111371,7 @@ ${lanes.join("\n")}
}
function emitObjectLiteralExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -111385,7 +112137,7 @@ ${lanes.join("\n")}
}
function emitClassDeclarationOrExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -111418,7 +112170,7 @@ ${lanes.join("\n")}
}
function emitInterfaceDeclaration(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -112861,7 +113613,7 @@ ${lanes.join("\n")}
return;
}
tempFlagsStack.push(tempFlags);
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
formattedNameTempFlagsStack.push(formattedNameTempFlags);
formattedNameTempFlags = void 0;
reservedNamesStack.push(reservedNames);
@@ -113047,7 +113799,7 @@ ${lanes.join("\n")}
case "#":
return privateNameTempFlags;
default:
- return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : TempFlags.Auto;
+ return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : 0 /* Auto */;
}
}
function setTempFlags(formattedNameKey, flags) {
@@ -113071,7 +113823,7 @@ ${lanes.join("\n")}
const key = formatGeneratedName(privateName, prefix, "", suffix);
let tempFlags2 = getTempFlags(key);
if (flags && !(tempFlags2 & flags)) {
- const name = flags === TempFlags._i ? "_i" : "_n";
+ const name = flags === 268435456 /* _i */ ? "_i" : "_n";
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
if (isUniqueName(fullName, privateName)) {
tempFlags2 |= flags;
@@ -113085,7 +113837,7 @@ ${lanes.join("\n")}
}
}
while (true) {
- const count = tempFlags2 & TempFlags.CountMask;
+ const count = tempFlags2 & 268435455 /* CountMask */;
tempFlags2++;
if (count !== 8 && count !== 13) {
const name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
@@ -113229,7 +113981,7 @@ ${lanes.join("\n")}
return generateNameCached(node.name, privateName);
}
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reservedInNestedScopes*/
false,
privateName,
@@ -113286,7 +114038,7 @@ ${lanes.join("\n")}
return generateNameForMethodOrAccessor(node, privateName, prefix, suffix);
case 164 /* ComputedPropertyName */:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
true,
privateName,
@@ -113295,7 +114047,7 @@ ${lanes.join("\n")}
);
default:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
false,
privateName,
@@ -113310,11 +114062,11 @@ ${lanes.join("\n")}
const suffix = formatGeneratedNamePart(autoGenerate.suffix);
switch (autoGenerate.flags & 7 /* KindMask */) {
case 1 /* Auto */:
- return makeTempVariableName(TempFlags.Auto, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
+ return makeTempVariableName(0 /* Auto */, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
case 2 /* Loop */:
Debug.assertNode(name, isIdentifier);
return makeTempVariableName(
- TempFlags._i,
+ 268435456 /* _i */,
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
/*privateName*/
false,
@@ -113796,7 +114548,7 @@ ${lanes.join("\n")}
function getEmitListItem(emit, parenthesizerRule) {
return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
}
- var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon, TempFlags;
+ var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon;
var init_emitter = __esm({
"src/compiler/emitter.ts"() {
"use strict";
@@ -113847,16 +114599,10 @@ ${lanes.join("\n")}
getDeclarationStatementsForSourceFile: notImplemented,
isImportRequiredByAugmentation: notImplemented
};
- createPrinterWithDefaults = memoize(() => createPrinter({}));
- createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
- createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
- createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
- TempFlags = /* @__PURE__ */ ((TempFlags2) => {
- TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
- TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
- TempFlags2[TempFlags2["_i"] = 268435456] = "_i";
- return TempFlags2;
- })(TempFlags || {});
+ createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
+ createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
+ createPrinterWithRemoveCommentsNeverAsciiEscape = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
}
});
@@ -114810,14 +115556,14 @@ ${lanes.join("\n")}
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
return {
nameAndMode: moduleResolutionNameAndModeGetter,
- resolve: (moduleName, resoluionMode) => resolveModuleName(
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
moduleName,
containingFile,
options,
host,
cache,
redirectedReference,
- resoluionMode
+ resolutionMode
)
};
}
@@ -116256,11 +117002,19 @@ ${lanes.join("\n")}
diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
} else if (isClassDeclaration(parent2)) {
const exportIndex = findIndex(parent2.modifiers, isExportModifier);
- const defaultIndex = findIndex(parent2.modifiers, isDefaultModifier);
- if (exportIndex >= 0 && decoratorIndex < exportIndex) {
- diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_must_come_after_export_or_export_default_in_JavaScript_files));
- } else if (defaultIndex >= 0 && decoratorIndex < defaultIndex) {
- diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ if (exportIndex >= 0) {
+ const defaultIndex = findIndex(parent2.modifiers, isDefaultModifier);
+ if (decoratorIndex > exportIndex && defaultIndex >= 0 && decoratorIndex < defaultIndex) {
+ diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ } else if (exportIndex >= 0 && decoratorIndex < exportIndex) {
+ const trailingDecoratorIndex = findIndex(parent2.modifiers, isDecorator, exportIndex);
+ if (trailingDecoratorIndex >= 0) {
+ diagnostics.push(addRelatedInfo(
+ createDiagnosticForNode2(parent2.modifiers[trailingDecoratorIndex], Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorator_used_before_export_here)
+ ));
+ }
+ }
}
}
}
@@ -116438,7 +117192,7 @@ ${lanes.join("\n")}
let imports;
let moduleAugmentations;
let ambientModules;
- if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) {
+ if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
if (options.importHelpers) {
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
}
@@ -117159,12 +117913,12 @@ ${lanes.join("\n")}
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
}
- if (options.isolatedModules) {
+ if (options.isolatedModules || options.verbatimModuleSyntax) {
if (options.out) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
if (options.outFile) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
}
if (options.inlineSourceMap) {
@@ -117375,10 +118129,10 @@ ${lanes.join("\n")}
}
}
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
- createDiagnosticForOptionName(Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
}
+ const moduleKind = getEmitModuleKind(options);
if (options.verbatimModuleSyntax) {
- const moduleKind = getEmitModuleKind(options);
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
}
@@ -117397,13 +118151,16 @@ ${lanes.join("\n")}
}
const moduleResolution = getEmitModuleResolutionKind(options);
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
}
if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
}
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ }
+ if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
}
if (!options.noEmit && !options.suppressOutputPathCheck) {
const emitHost = getEmitHost();
@@ -117558,7 +118315,7 @@ ${lanes.join("\n")}
if (version2 === "6.0" /* v6_0 */) {
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
} else {
- createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
+ createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
}
}
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
@@ -118721,7 +119478,7 @@ ${lanes.join("\n")}
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
}
const compilerOptions = programOfThisState.getCompilerOptions();
- if (compilerOptions && (compilerOptions.isolatedModules || outFile(compilerOptions))) {
+ if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
return [sourceFileWithUpdatedShape];
}
const seenFileNamesMap = /* @__PURE__ */ new Map();
@@ -119136,7 +119893,7 @@ ${lanes.join("\n")}
return;
if (!isChangedSignature(state, affectedFile.resolvedPath))
return;
- if (state.compilerOptions.isolatedModules) {
+ if (getIsolatedModules(state.compilerOptions)) {
const seenFileNamesMap = /* @__PURE__ */ new Map();
seenFileNamesMap.set(affectedFile.resolvedPath, true);
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
@@ -119229,14 +119986,17 @@ ${lanes.join("\n")}
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
const fileNames = [];
const fileNameToFileId = /* @__PURE__ */ new Map();
+ const root = [];
if (outFile(state.compilerOptions)) {
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
- toFileId(key);
+ const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
});
const program2 = {
fileNames,
fileInfos: fileInfos2,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
outSignature: state.outSignature,
latestChangedDtsFile,
@@ -119264,6 +120024,7 @@ ${lanes.join("\n")}
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
var _a3, _b2;
const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
const oldSignature = (_a3 = state.oldSignatures) == null ? void 0 : _a3.get(key);
const actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value.signature;
@@ -119363,6 +120124,7 @@ ${lanes.join("\n")}
const program = {
fileNames,
fileInfos,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
fileIdsList,
referencedMap,
@@ -119398,6 +120160,24 @@ ${lanes.join("\n")}
}
return fileIdListId;
}
+ function tryAddRoot(path, fileId) {
+ const file = state.program.getSourceFile(path);
+ if (!state.program.getFileIncludeReasons().get(file.path).some((r) => r.kind === 0 /* RootFile */))
+ return;
+ if (!root.length)
+ return root.push(fileId);
+ const last2 = root[root.length - 1];
+ const isLastStartEnd = isArray(last2);
+ if (isLastStartEnd && last2[1] === fileId - 1)
+ return last2[1] = fileId;
+ if (isLastStartEnd || root.length === 1 || last2 !== fileId - 1)
+ return root.push(fileId);
+ const lastButOne = root[root.length - 2];
+ if (!isNumber(lastButOne) || lastButOne !== last2 - 1)
+ return root.push(fileId);
+ root[root.length - 2] = [lastButOne, fileId];
+ return root.length = root.length - 1;
+ }
function convertToProgramBuildInfoCompilerOptions(options) {
let result;
const { optionsNameMap } = getOptionsNameMap();
@@ -119905,12 +120685,28 @@ ${lanes.join("\n")}
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
const fileInfos = /* @__PURE__ */ new Map();
+ let rootIndex = 0;
+ const roots = [];
program.fileInfos.forEach((fileInfo, index) => {
const path = toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
const version2 = isString(fileInfo) ? fileInfo : fileInfo.version;
fileInfos.set(path, version2);
+ if (rootIndex < program.root.length) {
+ const current = program.root[rootIndex];
+ const fileId = index + 1;
+ if (isArray(current)) {
+ if (current[0] <= fileId && fileId <= current[1]) {
+ roots.push(path);
+ if (current[1] === fileId)
+ rootIndex++;
+ }
+ } else if (current === fileId) {
+ roots.push(path);
+ rootIndex++;
+ }
+ }
});
- return fileInfos;
+ return { fileInfos, roots };
}
function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
return {
@@ -120854,7 +121650,7 @@ ${lanes.join("\n")}
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
}
function getLocaleTimeString(system) {
- return !system.now ? new Date().toLocaleTimeString() : (
+ return !system.now ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : (
// On some systems / builds of Node, there's a non-breaking space between the time and AM/PM.
// This branch is solely for testing, so just switch it to a normal space for baseline stability.
// See:
@@ -122243,13 +123039,14 @@ ${lanes.join("\n")}
UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 9] = "OutOfDateOptions";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 10] = "UpstreamOutOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 11] = "UpstreamBlocked";
- UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 12] = "ComputingUpstream";
- UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 13] = "TsVersionOutputOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 14] = "UpToDateWithInputFileText";
- UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 15] = "ContainerOnly";
- UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 16] = "ForceBuild";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 10] = "OutOfDateRoots";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 11] = "UpstreamOutOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 12] = "UpstreamBlocked";
+ UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 13] = "ComputingUpstream";
+ UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 14] = "TsVersionOutputOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 15] = "UpToDateWithInputFileText";
+ UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 16] = "ContainerOnly";
+ UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 17] = "ForceBuild";
return UpToDateStatusType2;
})(UpToDateStatusType || {});
}
@@ -122269,7 +123066,7 @@ ${lanes.join("\n")}
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, () => /* @__PURE__ */ new Map());
}
function getCurrentTime(host) {
- return host.now ? host.now() : new Date();
+ return host.now ? host.now() : /* @__PURE__ */ new Date();
}
function isCircularBuildOrder(buildOrder) {
return !!buildOrder && !!buildOrder.buildOrder;
@@ -123131,7 +123928,7 @@ ${lanes.join("\n")}
}
continue;
}
- if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 14 /* UpToDateWithInputFileText */) {
+ if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
return {
kind: 2 /* UpdateOutputFileStamps */,
@@ -123143,7 +123940,7 @@ ${lanes.join("\n")}
};
}
}
- if (status.type === 11 /* UpstreamBlocked */) {
+ if (status.type === 12 /* UpstreamBlocked */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -123157,7 +123954,7 @@ ${lanes.join("\n")}
}
continue;
}
- if (status.type === 15 /* ContainerOnly */) {
+ if (status.type === 16 /* ContainerOnly */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -123344,31 +124141,31 @@ ${lanes.join("\n")}
var _a2, _b;
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
return {
- type: 15 /* ContainerOnly */
+ type: 16 /* ContainerOnly */
};
}
let referenceStatuses;
const force = !!state.options.force;
if (project.projectReferences) {
- state.projectStatus.set(resolvedPath, { type: 12 /* ComputingUpstream */ });
+ state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
for (const ref of project.projectReferences) {
const resolvedRef = resolveProjectReferencePath(ref);
const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
- if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
+ if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
continue;
}
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
+ if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */) {
return {
- type: 11 /* UpstreamBlocked */,
+ type: 12 /* UpstreamBlocked */,
upstreamProjectName: ref.path,
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
+ upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
};
}
if (refStatus.type !== 1 /* UpToDate */) {
return {
- type: 10 /* UpstreamOutOfDate */,
+ type: 11 /* UpstreamOutOfDate */,
upstreamProjectName: ref.path
};
}
@@ -123377,7 +124174,7 @@ ${lanes.join("\n")}
}
}
if (force)
- return { type: 16 /* ForceBuild */ };
+ return { type: 17 /* ForceBuild */ };
const { host } = state;
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
let oldestOutputFileName;
@@ -123410,7 +124207,7 @@ ${lanes.join("\n")}
}
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== version) {
return {
- type: 13 /* TsVersionOutputOfDate */,
+ type: 14 /* TsVersionOutputOfDate */,
version: buildInfo.version
};
}
@@ -123435,6 +124232,7 @@ ${lanes.join("\n")}
let newestInputFileName = void 0;
let newestInputFileTime = minimumDate;
let pseudoInputUpToDate = false;
+ const seenRoots = /* @__PURE__ */ new Set();
for (const inputFile of project.fileNames) {
const inputTime = getModifiedTime2(state, inputFile);
if (inputTime === missingFileModifiedTime) {
@@ -123449,7 +124247,7 @@ ${lanes.join("\n")}
if (buildInfoProgram) {
if (!buildInfoVersionMap)
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
- version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
+ version2 = buildInfoVersionMap.fileInfos.get(toPath2(state, inputFile));
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
if (version2 && version2 === currentVersion)
@@ -123467,6 +124265,21 @@ ${lanes.join("\n")}
newestInputFileName = inputFile;
newestInputFileTime = inputTime;
}
+ if (buildInfoProgram)
+ seenRoots.add(toPath2(state, inputFile));
+ }
+ if (buildInfoProgram) {
+ if (!buildInfoVersionMap)
+ buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
+ for (const existingRoot of buildInfoVersionMap.roots) {
+ if (!seenRoots.has(existingRoot)) {
+ return {
+ type: 10 /* OutOfDateRoots */,
+ buildInfoFile: buildInfoPath,
+ inputFile: existingRoot
+ };
+ }
+ }
}
if (!buildInfoPath) {
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
@@ -123548,7 +124361,7 @@ ${lanes.join("\n")}
};
}
return {
- type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 14 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
+ type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
newestInputFileTime,
newestInputFileName,
oldestOutputFileName
@@ -123667,7 +124480,7 @@ ${lanes.join("\n")}
}
break;
}
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
case 2 /* UpToDateWithUpstreamTypes */:
case 3 /* OutOfDateWithPrepend */:
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -123678,7 +124491,7 @@ ${lanes.join("\n")}
});
}
break;
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
clearProjectStatus(state, nextProjectPath);
}
@@ -124129,6 +124942,14 @@ ${lanes.join("\n")}
relName(state, configFileName),
relName(state, status.buildInfoFile)
);
+ case 10 /* OutOfDateRoots */:
+ return reportStatus(
+ state,
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
+ relName(state, configFileName),
+ relName(state, status.buildInfoFile),
+ relName(state, status.inputFile)
+ );
case 1 /* UpToDate */:
if (status.newestInputFileTime !== void 0) {
return reportStatus(
@@ -124153,20 +124974,20 @@ ${lanes.join("\n")}
Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
relName(state, configFileName)
);
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
return reportStatus(
state,
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
relName(state, configFileName)
);
- case 10 /* UpstreamOutOfDate */:
+ case 11 /* UpstreamOutOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
return reportStatus(
state,
status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
@@ -124180,7 +125001,7 @@ ${lanes.join("\n")}
relName(state, configFileName),
status.reason
);
- case 13 /* TsVersionOutputOfDate */:
+ case 14 /* TsVersionOutputOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
@@ -124188,14 +125009,14 @@ ${lanes.join("\n")}
status.version,
version
);
- case 16 /* ForceBuild */:
+ case 17 /* ForceBuild */:
return reportStatus(
state,
Diagnostics.Project_0_is_being_forcibly_rebuilt,
relName(state, configFileName)
);
- case 15 /* ContainerOnly */:
- case 12 /* ComputingUpstream */:
+ case 16 /* ContainerOnly */:
+ case 13 /* ComputingUpstream */:
break;
default:
assertType(status);
@@ -124213,8 +125034,8 @@ ${lanes.join("\n")}
init_ts2();
init_ts2();
init_ts_performance();
- minimumDate = new Date(-864e13);
- maximumDate = new Date(864e13);
+ minimumDate = /* @__PURE__ */ new Date(-864e13);
+ maximumDate = /* @__PURE__ */ new Date(864e13);
InvalidatedProjectKind = /* @__PURE__ */ ((InvalidatedProjectKind2) => {
InvalidatedProjectKind2[InvalidatedProjectKind2["Build"] = 0] = "Build";
InvalidatedProjectKind2[InvalidatedProjectKind2["UpdateBundle"] = 1] = "UpdateBundle";
@@ -124645,7 +125466,7 @@ ${lanes.join("\n")}
return index >= 0 && index < sys.args.length - 1 ? sys.args[index + 1] : void 0;
}
function nowString() {
- const d = new Date();
+ const d = /* @__PURE__ */ new Date();
return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`;
}
var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, Arguments;
@@ -126277,6 +127098,13 @@ ${lanes.join("\n")}
}
return false;
}
+ function isStringAndEmptyAnonymousObjectIntersection(type) {
+ if (!type.isIntersection()) {
+ return false;
+ }
+ const { types, checker } = type;
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
+ }
function isPunctuation(kind) {
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
}
@@ -126441,7 +127269,7 @@ ${lanes.join("\n")}
};
}
function moduleResolutionUsesNodeModules(moduleResolution) {
- return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */;
+ return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
}
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0;
@@ -126457,7 +127285,7 @@ ${lanes.join("\n")}
);
}
function makeStringLiteral(text, quotePreference) {
- return factory.createStringLiteral(text, quotePreference === QuotePreference.Single);
+ return factory.createStringLiteral(text, quotePreference === 0 /* Single */);
}
function quotePreferenceFromString(str, sourceFile) {
return isStringDoubleQuoted(str, sourceFile) ? 1 /* Double */ : 0 /* Single */;
@@ -127088,7 +127916,7 @@ ${lanes.join("\n")}
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
}
function getContextualTypeFromParent(node, checker, contextFlags) {
- const { parent: parent2 } = node;
+ const parent2 = walkUpParenthesizedExpressions(node.parent);
switch (parent2.kind) {
case 211 /* NewExpression */:
return checker.getContextualType(parent2, contextFlags);
@@ -127097,7 +127925,7 @@ ${lanes.join("\n")}
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
}
case 292 /* CaseClause */:
- return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
+ return getSwitchedType(parent2, checker);
default:
return checker.getContextualType(node, contextFlags);
}
@@ -127359,7 +128187,13 @@ ${lanes.join("\n")}
function createPackageJsonImportFilter(fromFile, preferences, host) {
const packageJsons = (host.getPackageJsonsVisibleToFile && host.getPackageJsonsVisibleToFile(fromFile.fileName) || getPackageJsonsVisibleToFile(fromFile.fileName, host)).filter((p) => p.parseable);
let usesNodeCoreModules;
- return { allowsImportingAmbientModule, allowsImportingSourceFile, allowsImportingSpecifier };
+ let ambientModuleCache;
+ let sourceFileCache;
+ return {
+ allowsImportingAmbientModule,
+ allowsImportingSourceFile,
+ allowsImportingSpecifier
+ };
function moduleSpecifierIsCoveredByPackageJson(specifier) {
const packageName = getNodeModuleRootSpecifier(specifier);
for (const packageJson of packageJsons) {
@@ -127373,26 +128207,49 @@ ${lanes.join("\n")}
if (!packageJsons.length || !moduleSymbol.valueDeclaration) {
return true;
}
- const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
- const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
- if (typeof declaringNodeModuleName === "undefined") {
- return true;
+ if (!ambientModuleCache) {
+ ambientModuleCache = /* @__PURE__ */ new Map();
+ } else {
+ const cached = ambientModuleCache.get(moduleSymbol);
+ if (cached !== void 0) {
+ return cached;
+ }
}
const declaredModuleSpecifier = stripQuotes(moduleSymbol.getName());
if (isAllowedCoreNodeModulesImport(declaredModuleSpecifier)) {
+ ambientModuleCache.set(moduleSymbol, true);
return true;
}
- return moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
+ const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
+ const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
+ if (typeof declaringNodeModuleName === "undefined") {
+ ambientModuleCache.set(moduleSymbol, true);
+ return true;
+ }
+ const result = moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
+ ambientModuleCache.set(moduleSymbol, result);
+ return result;
}
function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) {
if (!packageJsons.length) {
return true;
}
+ if (!sourceFileCache) {
+ sourceFileCache = /* @__PURE__ */ new Map();
+ } else {
+ const cached = sourceFileCache.get(sourceFile);
+ if (cached !== void 0) {
+ return cached;
+ }
+ }
const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
if (!moduleSpecifier) {
+ sourceFileCache.set(sourceFile, true);
return true;
}
- return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ const result = moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ sourceFileCache.set(sourceFile, result);
+ return result;
}
function allowsImportingSpecifier(moduleSpecifier) {
if (!packageJsons.length || isAllowedCoreNodeModulesImport(moduleSpecifier)) {
@@ -127540,10 +128397,13 @@ ${lanes.join("\n")}
return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
}
function getDefaultLikeExportNameFromDeclaration(symbol) {
- return firstDefined(symbol.declarations, (d) => {
- var _a2;
- return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : void 0;
- });
+ return firstDefined(
+ symbol.declarations,
+ (d) => {
+ var _a2, _b;
+ return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text;
+ }
+ );
}
function getSymbolParentOrFail(symbol) {
var _a2;
@@ -127612,6 +128472,64 @@ ${lanes.join("\n")}
function isSourceFileFromLibrary(program, node) {
return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
}
+ function newCaseClauseTracker(checker, clauses) {
+ const existingStrings = /* @__PURE__ */ new Set();
+ const existingNumbers = /* @__PURE__ */ new Set();
+ const existingBigInts = /* @__PURE__ */ new Set();
+ for (const clause of clauses) {
+ if (!isDefaultClause(clause)) {
+ const expression = skipParentheses(clause.expression);
+ if (isLiteralExpression(expression)) {
+ switch (expression.kind) {
+ case 14 /* NoSubstitutionTemplateLiteral */:
+ case 10 /* StringLiteral */:
+ existingStrings.add(expression.text);
+ break;
+ case 8 /* NumericLiteral */:
+ existingNumbers.add(parseInt(expression.text));
+ break;
+ case 9 /* BigIntLiteral */:
+ const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
+ if (parsedBigInt) {
+ existingBigInts.add(pseudoBigIntToString(parsedBigInt));
+ }
+ break;
+ }
+ } else {
+ const symbol = checker.getSymbolAtLocation(clause.expression);
+ if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
+ const enumValue = checker.getConstantValue(symbol.valueDeclaration);
+ if (enumValue !== void 0) {
+ addValue(enumValue);
+ }
+ }
+ }
+ }
+ }
+ return {
+ addValue,
+ hasValue
+ };
+ function addValue(value) {
+ switch (typeof value) {
+ case "string":
+ existingStrings.add(value);
+ break;
+ case "number":
+ existingNumbers.add(value);
+ }
+ }
+ function hasValue(value) {
+ switch (typeof value) {
+ case "string":
+ return existingStrings.has(value);
+ case "number":
+ return existingNumbers.has(value);
+ case "object":
+ return existingBigInts.has(pseudoBigIntToString(value));
+ }
+ }
+ }
var scanner, SemanticMeaning, tripleSlashDirectivePrefixRegex, typeKeywords, QuotePreference, displayPartWriter, lineFeed2, ANONYMOUS, syntaxMayBeASICandidate;
var init_utilities4 = __esm({
"src/services/utilities.ts"() {
@@ -127908,13 +128826,25 @@ ${lanes.join("\n")}
const autoImportProvider = useAutoImportProvider && ((_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host));
if (autoImportProvider) {
const start = timestamp();
- forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => cb(
- module2,
- file,
- autoImportProvider,
- /*isFromPackageJson*/
- true
- ));
+ const checker = program.getTypeChecker();
+ forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => {
+ if (file && !program.getSourceFile(file.fileName) || !file && !checker.resolveName(
+ module2.name,
+ /*location*/
+ void 0,
+ 1536 /* Module */,
+ /*excludeGlobals*/
+ false
+ )) {
+ cb(
+ module2,
+ file,
+ autoImportProvider,
+ /*isFromPackageJson*/
+ true
+ );
+ }
+ });
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp() - start}`);
}
}
@@ -132415,7 +133345,8 @@ ${lanes.join("\n")}
options.triggerCharacter,
options.triggerKind,
cancellationToken,
- formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
+ formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
+ options.includeSymbol
);
}
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
@@ -133321,9 +134252,9 @@ ${lanes.join("\n")}
"src/services/services.ts"() {
"use strict";
init_ts4();
+ init_ts4();
init_ts_NavigateTo();
init_ts_NavigationBar();
- init_ts4();
servicesVersion = "0.8";
NodeObject = class {
constructor(kind, pos, end) {
@@ -136329,8 +137260,8 @@ ${lanes.join("\n")}
var init_addEmptyExportDeclaration = __esm({
"src/services/codefixes/addEmptyExportDeclaration.ts"() {
"use strict";
- init_ts_codefix();
init_ts4();
+ init_ts_codefix();
registerCodeFix({
errorCodes: [
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
@@ -138694,8 +139625,8 @@ ${lanes.join("\n")}
var init_convertToEsModule = __esm({
"src/services/codefixes/convertToEsModule.ts"() {
"use strict";
- init_ts_codefix();
init_ts4();
+ init_ts_codefix();
registerCodeFix({
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
getCodeActions(context) {
@@ -139093,6 +140024,7 @@ ${lanes.join("\n")}
sourceFile,
symbol,
symbolName2,
+ moduleSymbol,
/*isJsxTagName*/
false,
program,
@@ -139104,7 +140036,6 @@ ${lanes.join("\n")}
const fix = getImportFixForSymbol(
sourceFile,
Debug.checkDefined(exportInfo),
- moduleSymbol,
program,
/*position*/
void 0,
@@ -139121,13 +140052,13 @@ ${lanes.join("\n")}
var _a2, _b;
const { fix, symbolName: symbolName2 } = info;
switch (fix.kind) {
- case ImportFixKind.UseNamespace:
+ case 0 /* UseNamespace */:
addToNamespace.push(fix);
break;
- case ImportFixKind.JsdocTypeImport:
+ case 1 /* JsdocTypeImport */:
importType.push(fix);
break;
- case ImportFixKind.AddToExisting: {
+ case 2 /* AddToExisting */: {
const { importClauseOrBindingPattern, importKind, addAsTypeOnly } = fix;
const key = String(getNodeId(importClauseOrBindingPattern));
let entry = addToExisting.get(key);
@@ -139146,7 +140077,7 @@ ${lanes.join("\n")}
}
break;
}
- case ImportFixKind.AddNew: {
+ case 3 /* AddNew */: {
const { moduleSpecifier, importKind, useRequire, addAsTypeOnly } = fix;
const entry = getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly);
Debug.assert(entry.useRequire === useRequire, "(Add new) Tried to add an `import` and a `require` for the same module");
@@ -139167,7 +140098,7 @@ ${lanes.join("\n")}
}
break;
}
- case ImportFixKind.PromoteTypeOnly:
+ case 4 /* PromoteTypeOnly */:
break;
default:
Debug.assertNever(fix, `fix wasn't never - got kind ${fix.kind}`);
@@ -139194,13 +140125,13 @@ ${lanes.join("\n")}
namespaceLikeImport: void 0,
useRequire
};
- if (importKind === 1 /* Default */ && addAsTypeOnly === AddAsTypeOnly.Required) {
+ if (importKind === 1 /* Default */ && addAsTypeOnly === 2 /* Required */) {
if (typeOnlyEntry)
return typeOnlyEntry;
newImports.set(typeOnlyKey, newEntry);
return newEntry;
}
- if (addAsTypeOnly === AddAsTypeOnly.Allowed && (typeOnlyEntry || nonTypeOnlyEntry)) {
+ if (addAsTypeOnly === 1 /* Allowed */ && (typeOnlyEntry || nonTypeOnlyEntry)) {
return typeOnlyEntry || nonTypeOnlyEntry;
}
if (nonTypeOnlyEntry) {
@@ -139241,7 +140172,8 @@ ${lanes.join("\n")}
quotePreference,
defaultImport,
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
- namespaceLikeImport
+ namespaceLikeImport,
+ compilerOptions
);
newDeclarations = combine(newDeclarations, declarations);
});
@@ -139282,13 +140214,19 @@ ${lanes.join("\n")}
return result && { ...result, computedWithoutCacheCount };
}
}
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
+ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
const compilerOptions = program.getCompilerOptions();
- const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, isJsxTagName, program, host, preferences, cancellationToken);
- Debug.assertIsDefined(exportInfos);
+ let exportInfos;
+ if (exportMapKey) {
+ exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
+ } else {
+ exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
+ }
const useRequire = shouldUseRequire(sourceFile, program);
const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
- const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
+ const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
return {
moduleSpecifier: fix.moduleSpecifier,
codeAction: codeFixActionToCodeAction(codeActionForFix(
@@ -139310,23 +140248,22 @@ ${lanes.join("\n")}
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
}
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
- Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
+ function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
}
function codeFixActionToCodeAction({ description: description2, changes, commands }) {
return { description: description2, changes, commands };
}
- function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
+ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
const getChecker = createGetChecker(program, host);
return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
+ if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
return info;
}
});
}
- function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
+ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
var _a2, _b;
const compilerOptions = program.getCompilerOptions();
const mainProgramInfo = getInfoWithChecker(
@@ -139348,7 +140285,7 @@ ${lanes.join("\n")}
if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
}
- const named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol);
+ const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
if (named && skipAlias(named, checker) === symbol) {
return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
}
@@ -139414,7 +140351,7 @@ ${lanes.join("\n")}
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
return 2 /* Required */;
}
- if ((compilerOptions.isolatedModules && compilerOptions.preserveValueImports || compilerOptions.verbatimModuleSyntax) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
+ if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
return 2 /* Required */;
}
return 1 /* Allowed */;
@@ -139898,7 +140835,14 @@ ${lanes.join("\n")}
insertImports(
changes,
sourceFile,
- getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport),
+ getDeclarations(
+ moduleSpecifier,
+ quotePreference,
+ defaultImport,
+ namedImports,
+ namespaceLikeImport,
+ compilerOptions
+ ),
/*blankLineBetween*/
true,
preferences
@@ -139922,7 +140866,7 @@ ${lanes.join("\n")}
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
}
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
- const convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax;
+ const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
switch (aliasDeclaration.kind) {
case 273 /* ImportSpecifier */:
if (aliasDeclaration.isTypeOnly) {
@@ -139996,7 +140940,7 @@ ${lanes.join("\n")}
}
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
- const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions.preserveValueImports && compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax);
+ const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
if (defaultImport) {
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
@@ -140080,11 +141024,11 @@ ${lanes.join("\n")}
function needsTypeOnly({ addAsTypeOnly }) {
return addAsTypeOnly === 2 /* Required */;
}
- function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
+ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
let statements;
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
- const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
+ const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
statements = combine(statements, makeImport(
defaultImport && factory.createIdentifier(defaultImport.name),
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
@@ -140207,7 +141151,7 @@ ${lanes.join("\n")}
}
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
}
- var importFixName, importFixId, errorCodes17, ImportFixKind, AddAsTypeOnly;
+ var importFixName, importFixId, errorCodes17;
var init_importFixes = __esm({
"src/services/codefixes/importFixes.ts"() {
"use strict";
@@ -140266,20 +141210,6 @@ ${lanes.join("\n")}
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
}
});
- ImportFixKind = /* @__PURE__ */ ((ImportFixKind2) => {
- ImportFixKind2[ImportFixKind2["UseNamespace"] = 0] = "UseNamespace";
- ImportFixKind2[ImportFixKind2["JsdocTypeImport"] = 1] = "JsdocTypeImport";
- ImportFixKind2[ImportFixKind2["AddToExisting"] = 2] = "AddToExisting";
- ImportFixKind2[ImportFixKind2["AddNew"] = 3] = "AddNew";
- ImportFixKind2[ImportFixKind2["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
- return ImportFixKind2;
- })(ImportFixKind || {});
- AddAsTypeOnly = /* @__PURE__ */ ((AddAsTypeOnly2) => {
- AddAsTypeOnly2[AddAsTypeOnly2["Allowed"] = 1] = "Allowed";
- AddAsTypeOnly2[AddAsTypeOnly2["Required"] = 2] = "Required";
- AddAsTypeOnly2[AddAsTypeOnly2["NotAllowed"] = 4] = "NotAllowed";
- return AddAsTypeOnly2;
- })(AddAsTypeOnly || {});
}
});
@@ -140732,7 +141662,7 @@ ${lanes.join("\n")}
}
function updateExport(changes, program, sourceFile, node, names) {
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
- const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || find(namedExports, (e) => e.isTypeOnly));
+ const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
changes.replaceNode(
sourceFile,
node,
@@ -140764,7 +141694,7 @@ ${lanes.join("\n")}
factory.createNamedExports(createExportSpecifiers(
names,
/*allowTypeModifier*/
- !!program.getCompilerOptions().isolatedModules
+ getIsolatedModules(program.getCompilerOptions())
)),
/*moduleSpecifier*/
void 0,
@@ -141727,7 +142657,7 @@ ${lanes.join("\n")}
}
if (isObjectLiteralType(type)) {
const props = map(checker.getPropertiesOfType(type), (prop) => {
- const initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined();
+ const initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), enclosingDeclaration);
return factory.createPropertyAssignment(prop.name, initializer);
});
return factory.createObjectLiteralExpression(
@@ -142294,8 +143224,8 @@ ${lanes.join("\n")}
var init_fixModuleAndTargetOptions = __esm({
"src/services/codefixes/fixModuleAndTargetOptions.ts"() {
"use strict";
- init_ts_codefix();
init_ts4();
+ init_ts_codefix();
registerCodeFix({
errorCodes: [
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
@@ -145048,13 +145978,7 @@ ${lanes.join("\n")}
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
if (length(signatures)) {
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
- return checker.typeToTypeNode(
- type,
- enclosingDeclaration,
- /*flags*/
- void 0,
- getNoopSymbolTrackerWithResolver(context)
- );
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
}
}
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -145346,7 +146270,14 @@ ${lanes.join("\n")}
changeTracker.replaceNode(file, declaration, property);
}
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
- const assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
+ if (assignment === declaration)
+ assignment = factory.cloneNode(assignment);
+ assignment.modifiers = void 0;
+ assignment.questionToken = void 0;
+ assignment.exclamationToken = void 0;
+ }
changeTracker.replacePropertyAssignment(file, declaration, assignment);
}
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
@@ -146475,7 +147406,7 @@ ${lanes.join("\n")}
return !!(origin && origin.kind === 32 /* ResolvedExport */);
}
function originIncludesSymbolName(origin) {
- return originIsExport(origin) || originIsResolvedExport(origin);
+ return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin);
}
function originIsPackageJsonImport(origin) {
return (originIsExport(origin) || originIsResolvedExport(origin)) && !!origin.isFromPackageJson;
@@ -146495,6 +147426,9 @@ ${lanes.join("\n")}
function originIsIgnore(origin) {
return !!(origin && origin.kind & 256 /* Ignore */);
}
+ function originIsComputedPropertyName(origin) {
+ return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
+ }
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
var _a2, _b, _c;
const start = timestamp();
@@ -146537,7 +147471,7 @@ ${lanes.join("\n")}
return result2 || (needsFullResolution ? "failed" : "skipped");
}
}
- function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
+ function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
var _a2;
const { previousToken } = getRelevantTokens(position, sourceFile);
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
@@ -146559,7 +147493,7 @@ ${lanes.join("\n")}
} else {
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
}
- const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
+ const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
if (stringCompletions) {
return stringCompletions;
}
@@ -146583,19 +147517,19 @@ ${lanes.join("\n")}
return void 0;
}
switch (completionData.kind) {
- case CompletionDataKind.Data:
- const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
+ case 0 /* Data */:
+ const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
if (response == null ? void 0 : response.isIncomplete) {
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
}
return response;
- case CompletionDataKind.JsDocTagName:
+ case 1 /* JsDocTagName */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagNameCompletions());
- case CompletionDataKind.JsDocTag:
+ case 2 /* JsDocTag */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagCompletions());
- case CompletionDataKind.JsDocParameterName:
+ case 3 /* JsDocParameterName */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocParameterNameCompletions(completionData.tag));
- case CompletionDataKind.Keywords:
+ case 4 /* Keywords */:
return specificKeywordCompletionInfo(completionData.keywordCompletions, completionData.isNewIdentifierLocation);
default:
return Debug.assertNever(completionData);
@@ -146698,7 +147632,7 @@ ${lanes.join("\n")}
}
function keywordCompletionData(keywordFilters, filterOutTsOnlyKeywords, isNewIdentifierLocation) {
return {
- kind: CompletionDataKind.Keywords,
+ kind: 4 /* Keywords */,
keywordCompletions: getKeywordCompletions(keywordFilters, filterOutTsOnlyKeywords),
isNewIdentifierLocation
};
@@ -146714,7 +147648,7 @@ ${lanes.join("\n")}
function getOptionalReplacementSpan(location) {
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
}
- function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
+ function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
const {
symbols,
contextToken,
@@ -146788,7 +147722,8 @@ ${lanes.join("\n")}
symbolToOriginInfoMap,
symbolToSortTextMap,
isJsxIdentifierExpected,
- isRightOfOpenTag
+ isRightOfOpenTag,
+ includeSymbol
);
if (keywordFilters !== 0 /* None */) {
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
@@ -146928,64 +147863,6 @@ ${lanes.join("\n")}
}
return void 0;
}
- function newCaseClauseTracker(checker, clauses) {
- const existingStrings = /* @__PURE__ */ new Set();
- const existingNumbers = /* @__PURE__ */ new Set();
- const existingBigInts = /* @__PURE__ */ new Set();
- for (const clause of clauses) {
- if (!isDefaultClause(clause)) {
- if (isLiteralExpression(clause.expression)) {
- const expression = clause.expression;
- switch (expression.kind) {
- case 14 /* NoSubstitutionTemplateLiteral */:
- case 10 /* StringLiteral */:
- existingStrings.add(expression.text);
- break;
- case 8 /* NumericLiteral */:
- existingNumbers.add(parseInt(expression.text));
- break;
- case 9 /* BigIntLiteral */:
- const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
- if (parsedBigInt) {
- existingBigInts.add(pseudoBigIntToString(parsedBigInt));
- }
- break;
- }
- } else {
- const symbol = checker.getSymbolAtLocation(clause.expression);
- if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
- const enumValue = checker.getConstantValue(symbol.valueDeclaration);
- if (enumValue !== void 0) {
- addValue(enumValue);
- }
- }
- }
- }
- }
- return {
- addValue,
- hasValue
- };
- function addValue(value) {
- switch (typeof value) {
- case "string":
- existingStrings.add(value);
- break;
- case "number":
- existingNumbers.add(value);
- }
- }
- function hasValue(value) {
- switch (typeof value) {
- case "string":
- return existingStrings.has(value);
- case "number":
- return existingNumbers.has(value);
- case "object":
- return existingBigInts.has(pseudoBigIntToString(value));
- }
- }
- }
function typeNodeToExpression(typeNode, languageVersion, quotePreference) {
switch (typeNode.kind) {
case 180 /* TypeReference */:
@@ -147033,9 +147910,9 @@ ${lanes.join("\n")}
}
function isMemberCompletionKind(kind) {
switch (kind) {
- case CompletionKind.ObjectPropertyDeclaration:
- case CompletionKind.MemberLike:
- case CompletionKind.PropertyAccess:
+ case 0 /* ObjectPropertyDeclaration */:
+ case 3 /* MemberLike */:
+ case 2 /* PropertyAccess */:
return true;
default:
return false;
@@ -147095,7 +147972,7 @@ ${lanes.join("\n")}
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
- function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
+ function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
let insertText;
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
let data;
@@ -147139,7 +148016,9 @@ ${lanes.join("\n")}
}
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
- replacementSpan = createTextSpanFromBounds(propertyAccessToConvert.getStart(sourceFile), propertyAccessToConvert.end);
+ const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
+ const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
+ replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
}
if (originIsResolvedExport(origin)) {
sourceDisplay = [textPart(origin.moduleSpecifier)];
@@ -147151,7 +148030,7 @@ ${lanes.join("\n")}
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
hasAction = true;
}
- if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === CompletionKind.MemberLike && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
+ if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
let importAdder;
({ insertText, isSnippet, importAdder, replacementSpan } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext));
sortText = SortText.ClassMemberSnippets;
@@ -147173,7 +148052,7 @@ ${lanes.join("\n")}
let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
isSnippet = true;
} else {
@@ -147207,7 +148086,8 @@ ${lanes.join("\n")}
isSnippet,
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
isImportStatementCompletion: !!importStatementCompletion || void 0,
- data
+ data,
+ ...includeSymbol ? { symbol } : void 0
};
}
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
@@ -147275,7 +148155,7 @@ ${lanes.join("\n")}
if (isAbstract) {
requiredModifiers |= 256 /* Abstract */;
}
- if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
+ if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
requiredModifiers |= 16384 /* Override */;
}
if (!completionNodes.length) {
@@ -147581,6 +148461,7 @@ ${lanes.join("\n")}
if (originIsResolvedExport(origin)) {
const resolvedData = {
exportName: origin.exportName,
+ exportMapKey: origin.exportMapKey,
moduleSpecifier: origin.moduleSpecifier,
ambientModuleName,
fileName: origin.fileName,
@@ -147604,6 +148485,7 @@ ${lanes.join("\n")}
const resolvedOrigin = {
kind: 32 /* ResolvedExport */,
exportName: data.exportName,
+ exportMapKey: data.exportMapKey,
moduleSpecifier: data.moduleSpecifier,
symbolName: completionName,
fileName: data.fileName,
@@ -147627,7 +148509,7 @@ ${lanes.join("\n")}
}
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
const replacementSpan = importStatementCompletion.replacementSpan;
- const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
+ const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
const importKind = ts_codefix_exports.getImportKind(
@@ -147675,7 +148557,7 @@ ${lanes.join("\n")}
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
}
}
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
var _a2;
const start = timestamp();
const variableDeclaration = getVariableDeclaration(location);
@@ -147686,7 +148568,7 @@ ${lanes.join("\n")}
const symbol = symbols[i];
const origin = symbolToOriginInfoMap == null ? void 0 : symbolToOriginInfoMap[i];
const info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, !!jsxIdentifierExpected);
- if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === CompletionKind.Global && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
+ if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === 1 /* Global */ && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
continue;
}
const { name, needsConvertPropertyAccess } = info;
@@ -147715,7 +148597,8 @@ ${lanes.join("\n")}
kind,
formatContext,
isJsxIdentifierExpected,
- isRightOfOpenTag
+ isRightOfOpenTag,
+ includeSymbol
);
if (!entry) {
continue;
@@ -147825,7 +148708,7 @@ ${lanes.join("\n")}
if (!completionData) {
return { type: "none" };
}
- if (completionData.kind !== CompletionDataKind.Data) {
+ if (completionData.kind !== 0 /* Data */) {
return { type: "request", request: completionData };
}
const { symbols, literals, location, completionKind, symbolToOriginInfoMap, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } = completionData;
@@ -147851,13 +148734,13 @@ ${lanes.join("\n")}
case "request": {
const { request } = symbolCompletion;
switch (request.kind) {
- case CompletionDataKind.JsDocTagName:
+ case 1 /* JsDocTagName */:
return ts_JsDoc_exports.getJSDocTagNameCompletionDetails(name);
- case CompletionDataKind.JsDocTag:
+ case 2 /* JsDocTag */:
return ts_JsDoc_exports.getJSDocTagCompletionDetails(name);
- case CompletionDataKind.JsDocParameterName:
+ case 3 /* JsDocParameterName */:
return ts_JsDoc_exports.getJSDocParameterNameCompletionDetails(name);
- case CompletionDataKind.Keywords:
+ case 4 /* Keywords */:
return some(request.keywordCompletions, (c) => c.name === name) ? createSimpleDetails(name, "keyword" /* keyword */, 5 /* keyword */) : void 0;
default:
return Debug.assertNever(request);
@@ -147866,7 +148749,8 @@ ${lanes.join("\n")}
case "symbol": {
const { symbol, location, contextToken: contextToken2, origin, previousToken: previousToken2 } = symbolCompletion;
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken2, formatContext, preferences, data, source, cancellationToken);
- return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
+ const symbolName2 = originIsComputedPropertyName(origin) ? origin.symbolName : symbol.name;
+ return createCompletionDetailsForSymbol(symbol, symbolName2, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
}
case "literal": {
const { literal } = symbolCompletion;
@@ -147917,12 +148801,12 @@ ${lanes.join("\n")}
function createSimpleDetails(name, kind, kind2) {
return createCompletionDetails(name, "" /* none */, kind, [displayPart(name, kind2)]);
}
- function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
+ function createCompletionDetailsForSymbol(symbol, name, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(
cancellationToken,
(checker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker2, symbol, sourceFile, location, location, 7 /* All */)
);
- return createCompletionDetails(symbol.name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
+ return createCompletionDetails(name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
}
function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) {
return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source };
@@ -147982,6 +148866,7 @@ ${lanes.join("\n")}
const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
targetSymbol,
moduleSymbol,
+ data == null ? void 0 : data.exportMapKey,
sourceFile,
name,
isJsxOpeningTagName,
@@ -148209,7 +149094,7 @@ ${lanes.join("\n")}
break;
case 291 /* JsxExpression */:
case 290 /* JsxSpreadAttribute */:
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
isJsxIdentifierExpected = true;
}
break;
@@ -148671,16 +149556,16 @@ ${lanes.join("\n")}
if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
return;
}
- const firstImportableExportInfo = find(info, isImportableExportInfo);
- if (!firstImportableExportInfo) {
+ info = filter(info, isImportableExportInfo);
+ if (!info.length) {
return;
}
const result = context.tryResolve(info, isFromAmbientModule) || {};
if (result === "failed")
return;
- let exportInfo2 = firstImportableExportInfo, moduleSpecifier;
+ let exportInfo2 = info[0], moduleSpecifier;
if (result !== "skipped") {
- ({ exportInfo: exportInfo2 = firstImportableExportInfo, moduleSpecifier } = result);
+ ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
}
const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
@@ -148844,7 +149729,7 @@ ${lanes.join("\n")}
return false;
}
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) {
- return (isRegularExpressionLiteral(contextToken2) || isStringTextContainingNode(contextToken2)) && (rangeContainsPositionExclusive(createTextRangeFromSpan(createTextSpanFromNode(contextToken2)), position) || position === contextToken2.end && (!!contextToken2.isUnterminated || isRegularExpressionLiteral(contextToken2)));
+ return (isRegularExpressionLiteral(contextToken2) || isStringTextContainingNode(contextToken2)) && (rangeContainsPositionExclusive(contextToken2, position) || position === contextToken2.end && (!!contextToken2.isUnterminated || isRegularExpressionLiteral(contextToken2)));
}
function tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() {
const typeLiteralNode = tryGetTypeLiteralNode(contextToken);
@@ -149019,6 +149904,16 @@ ${lanes.join("\n")}
return classElementModifierFlags & 32 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
});
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
+ forEach(symbols, (symbol, index) => {
+ const declaration = symbol == null ? void 0 : symbol.valueDeclaration;
+ if (declaration && isClassElement(declaration) && declaration.name && isComputedPropertyName(declaration.name)) {
+ const origin = {
+ kind: 512 /* ComputedPropertyName */,
+ symbolName: typeChecker.symbolToString(symbol)
+ };
+ symbolToOriginInfoMap[index] = origin;
+ }
+ });
}
return 1 /* Success */;
}
@@ -149403,7 +150298,7 @@ ${lanes.join("\n")}
}
switch (kind) {
case 3 /* MemberLike */:
- return void 0;
+ return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
case 0 /* ObjectPropertyDeclaration */:
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
case 2 /* PropertyAccess */:
@@ -149543,7 +150438,7 @@ ${lanes.join("\n")}
function getApparentProperties(type, node, checker) {
if (!type.isUnion())
return type.getApparentProperties();
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 131068 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
}
function containsNonPublicProperties(props) {
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -149863,7 +150758,7 @@ ${lanes.join("\n")}
}
return charCode;
}
- var moduleSpecifierResolutionLimit, moduleSpecifierResolutionCacheAttemptLimit, SortText, CompletionSource, SymbolOriginInfoKind, CompletionDataKind, CompletionKind, _keywordCompletions, allKeywordsCompletions;
+ var moduleSpecifierResolutionLimit, moduleSpecifierResolutionCacheAttemptLimit, SortText, CompletionSource, SymbolOriginInfoKind, CompletionKind, _keywordCompletions, allKeywordsCompletions;
var init_completions = __esm({
"src/services/completions.ts"() {
"use strict";
@@ -149911,18 +150806,11 @@ ${lanes.join("\n")}
SymbolOriginInfoKind2[SymbolOriginInfoKind2["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ObjectLiteralMethod"] = 128] = "ObjectLiteralMethod";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore";
+ SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport";
return SymbolOriginInfoKind2;
})(SymbolOriginInfoKind || {});
- CompletionDataKind = /* @__PURE__ */ ((CompletionDataKind2) => {
- CompletionDataKind2[CompletionDataKind2["Data"] = 0] = "Data";
- CompletionDataKind2[CompletionDataKind2["JsDocTagName"] = 1] = "JsDocTagName";
- CompletionDataKind2[CompletionDataKind2["JsDocTag"] = 2] = "JsDocTag";
- CompletionDataKind2[CompletionDataKind2["JsDocParameterName"] = 3] = "JsDocParameterName";
- CompletionDataKind2[CompletionDataKind2["Keywords"] = 4] = "Keywords";
- return CompletionDataKind2;
- })(CompletionDataKind || {});
CompletionKind = /* @__PURE__ */ ((CompletionKind2) => {
CompletionKind2[CompletionKind2["ObjectPropertyDeclaration"] = 0] = "ObjectPropertyDeclaration";
CompletionKind2[CompletionKind2["Global"] = 1] = "Global";
@@ -149963,7 +150851,7 @@ ${lanes.join("\n")}
values: map2.values.bind(map2)
};
}
- function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
+ function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
if (isInReferenceComment(sourceFile, position)) {
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
return entries && convertPathCompletions(entries);
@@ -149972,18 +150860,18 @@ ${lanes.join("\n")}
if (!contextToken || !isStringLiteralLike(contextToken))
return void 0;
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
- return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
+ return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
}
}
- function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
+ function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
if (completion === void 0) {
return void 0;
}
const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken);
switch (completion.kind) {
- case StringLiteralCompletionKind.Paths:
+ case 0 /* Paths */:
return convertPathCompletions(completion.paths);
- case StringLiteralCompletionKind.Properties: {
+ case 1 /* Properties */: {
const entries = createSortedArray();
getCompletionEntriesFromSymbols(
completion.symbols,
@@ -150001,11 +150889,32 @@ ${lanes.join("\n")}
preferences,
options,
/*formatContext*/
- void 0
+ void 0,
+ /*isTypeOnlyLocation */
+ void 0,
+ /*propertyAccessToConvert*/
+ void 0,
+ /*jsxIdentifierExpected*/
+ void 0,
+ /*isJsxInitializer*/
+ void 0,
+ /*importStatementCompletion*/
+ void 0,
+ /*recommendedCompletion*/
+ void 0,
+ /*symbolToOriginInfoMap*/
+ void 0,
+ /*symbolToSortTextMap*/
+ void 0,
+ /*isJsxIdentifierExpected*/
+ void 0,
+ /*isRightOfOpenTag*/
+ void 0,
+ includeSymbol
);
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
}
- case StringLiteralCompletionKind.Types: {
+ case 2 /* Types */: {
const entries = completion.types.map((type) => ({
name: type.value,
kindModifiers: "" /* none */,
@@ -150027,16 +150936,16 @@ ${lanes.join("\n")}
}
function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
switch (completion.kind) {
- case StringLiteralCompletionKind.Paths: {
+ case 0 /* Paths */: {
const match = find(completion.paths, (p) => p.name === name);
return match && createCompletionDetails(name, kindModifiersFromExtension(match.extension), match.kind, [textPart(name)]);
}
- case StringLiteralCompletionKind.Properties: {
+ case 1 /* Properties */: {
const match = find(completion.symbols, (s) => s.name === name);
- return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
+ return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
}
- case StringLiteralCompletionKind.Types:
- return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "type" /* typeElement */, [textPart(name)]) : void 0;
+ case 2 /* Types */:
+ return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
default:
return Debug.assertNever(completion);
}
@@ -150119,7 +151028,7 @@ ${lanes.join("\n")}
if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent);
}
- return fromContextualType();
+ return fromContextualType() || fromContextualType(0 /* None */);
case 209 /* ElementAccessExpression */: {
const { expression, argumentExpression } = parent2;
if (node === skipParentheses(argumentExpression)) {
@@ -150138,11 +151047,23 @@ ${lanes.join("\n")}
case 275 /* ExportDeclaration */:
case 280 /* ExternalModuleReference */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
+ case 292 /* CaseClause */:
+ const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
+ const contextualTypes = fromContextualType();
+ if (!contextualTypes) {
+ return;
+ }
+ const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
+ return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
default:
return fromContextualType();
}
- function fromContextualType() {
- return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, 4 /* Completions */)), isNewIdentifier: false };
+ function fromContextualType(contextFlags = 4 /* Completions */) {
+ const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
+ if (!types.length) {
+ return;
+ }
+ return { kind: 2 /* Types */, types, isNewIdentifier: false };
}
}
function walkUpParentheses(node) {
@@ -150233,12 +151154,12 @@ ${lanes.join("\n")}
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
const scriptPath = sourceFile.path;
const scriptDirectory = getDirectoryPath(scriptPath);
- const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
+ const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
}
- function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
+ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
return {
- extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
+ extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
referenceKind,
importingSourceFile,
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
@@ -150268,8 +151189,17 @@ ${lanes.join("\n")}
).values());
}
}
- function getSupportedExtensionsForModuleResolution(compilerOptions) {
- const extensions = getSupportedExtensions(compilerOptions);
+ function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
+ const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
+ typeChecker.getAmbientModules(),
+ (module2) => {
+ const name = module2.name.slice(1, -1);
+ if (!name.startsWith("*.") || name.includes("/"))
+ return;
+ return name.slice(1);
+ }
+ );
+ const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
}
@@ -150740,7 +151670,7 @@ ${lanes.join("\n")}
function isRequireCallArgument(node) {
return isCallExpression(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier(node.parent.expression) && node.parent.expression.escapedText === "require";
}
- var kindPrecedence, StringLiteralCompletionKind, ReferenceKind, tripleSlashDirectiveFragmentRegex, nodeModulesDependencyKeys;
+ var kindPrecedence, tripleSlashDirectiveFragmentRegex, nodeModulesDependencyKeys;
var init_stringCompletions = __esm({
"src/services/stringCompletions.ts"() {
"use strict";
@@ -150751,17 +151681,6 @@ ${lanes.join("\n")}
["script" /* scriptElement */]: 1,
["external module name" /* externalModuleName */]: 2
};
- StringLiteralCompletionKind = /* @__PURE__ */ ((StringLiteralCompletionKind2) => {
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Paths"] = 0] = "Paths";
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Properties"] = 1] = "Properties";
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Types"] = 2] = "Types";
- return StringLiteralCompletionKind2;
- })(StringLiteralCompletionKind || {});
- ReferenceKind = /* @__PURE__ */ ((ReferenceKind2) => {
- ReferenceKind2[ReferenceKind2["Filename"] = 0] = "Filename";
- ReferenceKind2[ReferenceKind2["ModuleSpecifier"] = 1] = "ModuleSpecifier";
- return ReferenceKind2;
- })(ReferenceKind || {});
tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s* ` * ${c}`).join("\n")}
if (isExpression(body)) {
const returnStatement = factory.createReturnStatement(body);
const file = body.getSourceFile();
+ setTextRange(returnStatement, body);
suppressLeadingAndTrailingTrivia(returnStatement);
copyTrailingAsLeadingComments(
body,
@@ -159240,10 +160156,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
const scopeDescription = isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope);
let functionDescription;
let constantDescription;
- if (scopeDescription === SpecialScope.Global) {
+ if (scopeDescription === 1 /* Global */) {
functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]);
constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"]);
- } else if (scopeDescription === SpecialScope.Module) {
+ } else if (scopeDescription === 0 /* Module */) {
functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]);
constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"]);
} else {
@@ -159309,7 +160225,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
return scope.kind === 260 /* ClassDeclaration */ ? scope.name ? `class '${scope.name.text}'` : "anonymous class declaration" : scope.name ? `class expression '${scope.name.text}'` : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? SpecialScope.Module : SpecialScope.Global;
+ return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) {
const checker = context.program.getTypeChecker();
@@ -159342,7 +160258,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
typeNode
);
parameters.push(paramDecl);
- if (usage.usage === Usage.Write) {
+ if (usage.usage === 2 /* Write */) {
(writes || (writes = [])).push(usage);
}
callArguments.push(factory.createIdentifier(name));
@@ -160300,7 +161216,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
function isStringLiteralJsxAttribute(node) {
return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent);
}
- var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts, SpecialScope, Usage;
+ var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts;
var init_extractSymbol = __esm({
"src/services/refactors/extractSymbol.ts"() {
"use strict";
@@ -160363,16 +161279,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
RangeFacts2[RangeFacts2["InStaticRegion"] = 32] = "InStaticRegion";
return RangeFacts2;
})(RangeFacts || {});
- SpecialScope = /* @__PURE__ */ ((SpecialScope2) => {
- SpecialScope2[SpecialScope2["Module"] = 0] = "Module";
- SpecialScope2[SpecialScope2["Global"] = 1] = "Global";
- return SpecialScope2;
- })(SpecialScope || {});
- Usage = /* @__PURE__ */ ((Usage2) => {
- Usage2[Usage2["Read"] = 1] = "Read";
- Usage2[Usage2["Write"] = 2] = "Write";
- return Usage2;
- })(Usage || {});
}
});
@@ -160804,7 +161710,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
if (!candidateInfo) {
return isSourceFileJS(sourceFile) ? createJSSignatureHelpItems(argumentInfo, program, cancellationToken) : void 0;
}
- return typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => candidateInfo.kind === CandidateOrTypeKind.Candidate ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2));
+ return typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => candidateInfo.kind === 0 /* Candidate */ ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2));
}
function getCandidateOrTypeInfo({ invocation, argumentCount }, checker, sourceFile, startingToken, onlyUseSyntacticOwners) {
switch (invocation.kind) {
@@ -161276,16 +162182,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
});
return { name: typeParameter.symbol.name, documentation: typeParameter.symbol.getDocumentationComment(checker), displayParts, isOptional: false, isRest: false };
}
- var CandidateOrTypeKind, signatureHelpNodeBuilderFlags, separatorDisplayParts;
+ var signatureHelpNodeBuilderFlags, separatorDisplayParts;
var init_signatureHelp = __esm({
"src/services/signatureHelp.ts"() {
"use strict";
init_ts4();
- CandidateOrTypeKind = /* @__PURE__ */ ((CandidateOrTypeKind2) => {
- CandidateOrTypeKind2[CandidateOrTypeKind2["Candidate"] = 0] = "Candidate";
- CandidateOrTypeKind2[CandidateOrTypeKind2["Type"] = 1] = "Type";
- return CandidateOrTypeKind2;
- })(CandidateOrTypeKind || {});
signatureHelpNodeBuilderFlags = 8192 /* OmitParameterModifiers */ | 70221824 /* IgnoreErrors */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
separatorDisplayParts = [punctuationPart(27 /* CommaToken */), spacePart()];
}
@@ -164596,8 +165497,8 @@ ${options.prefix}` : "\n" : options.prefix
var init_rules = __esm({
"src/services/formatting/rules.ts"() {
"use strict";
- init_ts_formatting();
init_ts4();
+ init_ts_formatting();
}
});
@@ -165157,7 +166058,7 @@ ${options.prefix}` : "\n" : options.prefix
}
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
Debug.assert(!nodeIsSynthesized(child));
- if (nodeIsMissing(child)) {
+ if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
return inheritedIndentation;
}
const childStartPos = child.getStart(sourceFile);
@@ -165290,7 +166191,7 @@ ${options.prefix}` : "\n" : options.prefix
if (currentTokenInfo.leadingTrivia) {
processTrivia(currentTokenInfo.leadingTrivia, parent2, childContextNode, dynamicIndentation);
}
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
const isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token);
const tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
if (isTokenInRange) {
@@ -165298,11 +166199,11 @@ ${options.prefix}` : "\n" : options.prefix
const savePreviousRange = previousRange;
lineAction = processRange(currentTokenInfo.token, tokenStart, parent2, childContextNode, dynamicIndentation);
if (!rangeHasError) {
- if (lineAction === LineAction.None) {
+ if (lineAction === 0 /* None */) {
const prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
} else {
- indentToken = lineAction === LineAction.LineAdded;
+ indentToken = lineAction === 1 /* LineAdded */;
}
}
}
@@ -165328,7 +166229,7 @@ ${options.prefix}` : "\n" : options.prefix
);
}
if (tokenIndentation !== -1 /* Unknown */ && indentNextTokenOrTrivia) {
- insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAction === LineAction.LineAdded);
+ insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAction === 1 /* LineAdded */);
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
@@ -165375,7 +166276,7 @@ ${options.prefix}` : "\n" : options.prefix
}
function processRange(range, rangeStart, parent2, contextNode, dynamicIndentation) {
const rangeHasError = rangeContainsError(range);
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
if (!rangeHasError) {
if (!previousRange) {
const originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
@@ -165394,13 +166295,13 @@ ${options.prefix}` : "\n" : options.prefix
formattingContext.updateContext(previousItem, previousParent2, currentItem, currentParent, contextNode);
const rules = getRules(formattingContext);
let trimTrailingWhitespaces = formattingContext.options.trimTrailingWhitespace !== false;
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
if (rules) {
forEachRight(rules, (rule2) => {
lineAction = applyRuleEdits(rule2, previousItem, previousStartLine, currentItem, currentStartLine);
if (dynamicIndentation) {
switch (lineAction) {
- case LineAction.LineRemoved:
+ case 2 /* LineRemoved */:
if (currentParent.getStart(sourceFile) === currentItem.pos) {
dynamicIndentation.recomputeIndentation(
/*lineAddedByFormatting*/
@@ -165409,7 +166310,7 @@ ${options.prefix}` : "\n" : options.prefix
);
}
break;
- case LineAction.LineAdded:
+ case 1 /* LineAdded */:
if (currentParent.getStart(sourceFile) === currentItem.pos) {
dynamicIndentation.recomputeIndentation(
/*lineAddedByFormatting*/
@@ -165419,7 +166320,7 @@ ${options.prefix}` : "\n" : options.prefix
}
break;
default:
- Debug.assert(lineAction === LineAction.None);
+ Debug.assert(lineAction === 0 /* None */);
}
}
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule2.action & 16 /* DeleteSpace */) && rule2.flags !== 1 /* CanDeleteNewLines */;
@@ -165566,11 +166467,11 @@ ${options.prefix}` : "\n" : options.prefix
const onLaterLine = currentStartLine !== previousStartLine;
switch (rule2.action) {
case 1 /* StopProcessingSpaceActions */:
- return LineAction.None;
+ return 0 /* None */;
case 16 /* DeleteSpace */:
if (previousRange2.end !== currentRange.pos) {
recordDelete(previousRange2.end, currentRange.pos - previousRange2.end);
- return onLaterLine ? LineAction.LineRemoved : LineAction.None;
+ return onLaterLine ? 2 /* LineRemoved */ : 0 /* None */;
}
break;
case 32 /* DeleteToken */:
@@ -165578,28 +166479,28 @@ ${options.prefix}` : "\n" : options.prefix
break;
case 8 /* InsertNewLine */:
if (rule2.flags !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {
- return LineAction.None;
+ return 0 /* None */;
}
const lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, getNewLineOrDefaultFromHost(host, options));
- return onLaterLine ? LineAction.None : LineAction.LineAdded;
+ return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
case 4 /* InsertSpace */:
if (rule2.flags !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {
- return LineAction.None;
+ return 0 /* None */;
}
const posDelta = currentRange.pos - previousRange2.end;
if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange2.end) !== 32 /* space */) {
recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, " ");
- return onLaterLine ? LineAction.LineRemoved : LineAction.None;
+ return onLaterLine ? 2 /* LineRemoved */ : 0 /* None */;
}
break;
case 64 /* InsertTrailingSemicolon */:
recordInsert(previousRange2.end, ";");
}
- return LineAction.None;
+ return 0 /* None */;
}
}
function getRangeOfEnclosingComment(sourceFile, position, precedingToken, tokenAtPosition = getTokenAtPosition(sourceFile, position)) {
@@ -165725,18 +166626,12 @@ ${options.prefix}` : "\n" : options.prefix
return remainder ? spacesString + repeatString(" ", remainder) : spacesString;
}
}
- var LineAction, internedSizes, internedTabsIndentation, internedSpacesIndentation;
+ var internedSizes, internedTabsIndentation, internedSpacesIndentation;
var init_formatting = __esm({
"src/services/formatting/formatting.ts"() {
"use strict";
init_ts4();
init_ts_formatting();
- LineAction = /* @__PURE__ */ ((LineAction2) => {
- LineAction2[LineAction2["None"] = 0] = "None";
- LineAction2[LineAction2["LineAdded"] = 1] = "LineAdded";
- LineAction2[LineAction2["LineRemoved"] = 2] = "LineRemoved";
- return LineAction2;
- })(LineAction || {});
}
});
@@ -165840,7 +166735,7 @@ ${options.prefix}` : "\n" : options.prefix
)) {
const currentStart = getStartLineAndCharacterForNode(current, sourceFile);
const nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile);
- const indentationDelta = nextTokenKind !== NextTokenKind.Unknown ? assumeNewLineBeforeCloseBrace && nextTokenKind === NextTokenKind.CloseBrace ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0;
+ const indentationDelta = nextTokenKind !== 0 /* Unknown */ ? assumeNewLineBeforeCloseBrace && nextTokenKind === 2 /* CloseBrace */ ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0;
return getIndentationForNodeWorker(
current,
currentStart,
@@ -167009,8 +167904,8 @@ ${options.prefix}` : "\n" : options.prefix
var init_scriptInfo = __esm({
"src/server/scriptInfo.ts"() {
"use strict";
- init_ts_server2();
init_ts6();
+ init_ts_server2();
TextStorage = class {
constructor(host, info, initialVersion) {
this.host = host;
@@ -167700,8 +168595,8 @@ ${options.prefix}` : "\n" : options.prefix
"src/server/project.ts"() {
"use strict";
init_ts6();
- init_ts_server2();
init_ts6();
+ init_ts_server2();
ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
ProjectKind2[ProjectKind2["Inferred"] = 0] = "Inferred";
ProjectKind2[ProjectKind2["Configured"] = 1] = "Configured";
@@ -170041,8 +170936,8 @@ ${options.prefix}` : "\n" : options.prefix
var init_editorServices = __esm({
"src/server/editorServices.ts"() {
"use strict";
- init_ts_server2();
init_ts6();
+ init_ts_server2();
maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
maxFileSize = 4 * 1024 * 1024;
ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
@@ -173493,6 +174388,10 @@ ${json}${newLine}`;
continue;
if (isLocationProjectReferenceRedirect(project, location))
continue;
+ updateProjectIfDirty(project);
+ if (!project.containsFile(toNormalizedPath(location.fileName))) {
+ continue;
+ }
const projectResults = searchPosition(project, location);
resultsMap.set(project, projectResults != null ? projectResults : emptyArray2);
searchedProjectKeys.add(getProjectKey(project));
@@ -177648,6 +178547,7 @@ ${e.message}`;
consumesNodeCoreModules: () => consumesNodeCoreModules,
contains: () => contains,
containsIgnoredPath: () => containsIgnoredPath,
+ containsObjectRestOrSpread: () => containsObjectRestOrSpread,
containsParseError: () => containsParseError,
containsPath: () => containsPath,
convertCompilerOptionsForTelemetry: () => convertCompilerOptionsForTelemetry,
@@ -177986,6 +178886,7 @@ ${e.message}`;
getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig,
getCompilerOptionValue: () => getCompilerOptionValue,
getCompilerOptionsDiffValue: () => getCompilerOptionsDiffValue,
+ getConditions: () => getConditions,
getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics,
getConstantValue: () => getConstantValue,
getContainerNode: () => getContainerNode,
@@ -178667,6 +179568,7 @@ ${e.message}`;
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
isGlobalDeclaration: () => isGlobalDeclaration,
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
+ isGrammarError: () => isGrammarError,
isHeritageClause: () => isHeritageClause,
isHoistedFunction: () => isHoistedFunction,
isHoistedVariableStatement: () => isHoistedVariableStatement,
@@ -179009,6 +179911,7 @@ ${e.message}`;
isString: () => isString,
isStringAKeyword: () => isStringAKeyword,
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted: () => isStringDoubleQuoted,
isStringLiteral: () => isStringLiteral,
isStringLiteralLike: () => isStringLiteralLike,
@@ -179173,6 +180076,7 @@ ${e.message}`;
mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
needsParentheses: () => needsParentheses,
needsScopeMarker: () => needsScopeMarker,
+ newCaseClauseTracker: () => newCaseClauseTracker,
newPrivateEnvironment: () => newPrivateEnvironment,
noEmitNotification: () => noEmitNotification,
noEmitSubstitution: () => noEmitSubstitution,
@@ -179546,7 +180450,6 @@ ${e.message}`;
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
typeAliasNamePart: () => typeAliasNamePart,
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
typeKeywords: () => typeKeywords,
typeParameterNamePart: () => typeParameterNamePart,
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
@@ -180004,6 +180907,7 @@ ${e.message}`;
consumesNodeCoreModules: () => consumesNodeCoreModules,
contains: () => contains,
containsIgnoredPath: () => containsIgnoredPath,
+ containsObjectRestOrSpread: () => containsObjectRestOrSpread,
containsParseError: () => containsParseError,
containsPath: () => containsPath,
convertCompilerOptionsForTelemetry: () => convertCompilerOptionsForTelemetry,
@@ -180342,6 +181246,7 @@ ${e.message}`;
getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig,
getCompilerOptionValue: () => getCompilerOptionValue,
getCompilerOptionsDiffValue: () => getCompilerOptionsDiffValue,
+ getConditions: () => getConditions,
getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics,
getConstantValue: () => getConstantValue,
getContainerNode: () => getContainerNode,
@@ -181023,6 +181928,7 @@ ${e.message}`;
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
isGlobalDeclaration: () => isGlobalDeclaration,
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
+ isGrammarError: () => isGrammarError,
isHeritageClause: () => isHeritageClause,
isHoistedFunction: () => isHoistedFunction,
isHoistedVariableStatement: () => isHoistedVariableStatement,
@@ -181365,6 +182271,7 @@ ${e.message}`;
isString: () => isString,
isStringAKeyword: () => isStringAKeyword,
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted: () => isStringDoubleQuoted,
isStringLiteral: () => isStringLiteral,
isStringLiteralLike: () => isStringLiteralLike,
@@ -181529,6 +182436,7 @@ ${e.message}`;
mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
needsParentheses: () => needsParentheses,
needsScopeMarker: () => needsScopeMarker,
+ newCaseClauseTracker: () => newCaseClauseTracker,
newPrivateEnvironment: () => newPrivateEnvironment,
noEmitNotification: () => noEmitNotification,
noEmitSubstitution: () => noEmitSubstitution,
@@ -181902,7 +182810,6 @@ ${e.message}`;
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
typeAliasNamePart: () => typeAliasNamePart,
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
typeKeywords: () => typeKeywords,
typeParameterNamePart: () => typeParameterNamePart,
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
index e973a18179380..2201712f7c4eb 100644
--- a/lib/typescript.d.ts
+++ b/lib/typescript.d.ts
@@ -2335,6 +2335,7 @@ declare namespace ts {
}
interface TypeChecker {
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
+ getTypeOfSymbol(symbol: Symbol): Type;
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getPropertiesOfType(type: Type): Symbol[];
getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
@@ -2425,6 +2426,21 @@ declare namespace ts {
getApparentType(type: Type): Type;
getBaseConstraintOfType(type: Type): Type | undefined;
getDefaultFromTypeParameter(type: Type): Type | undefined;
+ /**
+ * True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
+ * This function will _not_ return true if passed a type which
+ * extends `Array` (for example, the TypeScript AST's `NodeArray` type).
+ */
+ isArrayType(type: Type): boolean;
+ /**
+ * True if this type is a tuple type. This function will _not_ return true if
+ * passed a type which extends from a tuple.
+ */
+ isTupleType(type: Type): boolean;
+ /**
+ * True if this type is assignable to `ReadonlyArray`.
+ */
+ isArrayLikeType(type: Type): boolean;
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
/**
* Depending on the operation performed, it may be appropriate to throw away the checker
@@ -2684,7 +2700,8 @@ declare namespace ts {
TemplateLiteral = 134217728,
StringMapping = 268435456,
Literal = 2944,
- Unit = 109440,
+ Unit = 109472,
+ Freshable = 2976,
StringOrNumberLiteral = 384,
PossiblyFalsy = 117724,
StringLike = 402653316,
@@ -2736,10 +2753,12 @@ declare namespace ts {
isClass(): this is InterfaceType;
isIndexType(): this is IndexType;
}
- interface LiteralType extends Type {
+ interface FreshableType extends Type {
+ freshType: FreshableType;
+ regularType: FreshableType;
+ }
+ interface LiteralType extends FreshableType {
value: string | number | PseudoBigInt;
- freshType: LiteralType;
- regularType: LiteralType;
}
interface UniqueESSymbolType extends Type {
symbol: Symbol;
@@ -2754,7 +2773,7 @@ declare namespace ts {
interface BigIntLiteralType extends LiteralType {
value: PseudoBigInt;
}
- interface EnumType extends Type {
+ interface EnumType extends FreshableType {
}
enum ObjectFlags {
None = 0,
@@ -4698,7 +4717,6 @@ declare namespace ts {
parent: ConstructorDeclaration;
name: Identifier;
};
- function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind): boolean;
/** @deprecated */
function createUnparsedSourceFile(text: string): UnparsedSource;
/** @deprecated */
@@ -5153,7 +5171,6 @@ declare namespace ts {
function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
- function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string): boolean | "" | undefined;
interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache, NonRelativeNameResolutionCache, PackageJsonInfoCache {
}
interface ModeAwareCache {
@@ -6154,6 +6171,13 @@ declare namespace ts {
*/
triggerCharacter?: CompletionsTriggerCharacter;
triggerKind?: CompletionTriggerKind;
+ /**
+ * Include a `symbol` property on each completion entry object.
+ * Symbols reference cyclic data structures and sometimes an entire TypeChecker instance,
+ * so use caution when serializing or retaining completion entries retrieved with this option.
+ * @default false
+ */
+ includeSymbol?: boolean;
/** @deprecated Use includeCompletionsForModuleExports */
includeExternalModuleExports?: boolean;
/** @deprecated Use includeCompletionsWithInsertText */
@@ -6674,6 +6698,7 @@ declare namespace ts {
* in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.
*/
exportName: string;
+ exportMapKey?: string;
moduleSpecifier?: string;
/** The file name declaring the export's module symbol, if it was an external module */
fileName?: string;
@@ -6683,7 +6708,6 @@ declare namespace ts {
isPackageJsonImport?: true;
}
interface CompletionEntryDataUnresolved extends CompletionEntryDataAutoImport {
- /** The key in the `ExportMapCache` where the completion entry's `SymbolExportInfo[]` is found */
exportMapKey: string;
}
interface CompletionEntryDataResolved extends CompletionEntryDataAutoImport {
@@ -6711,6 +6735,12 @@ declare namespace ts {
isFromUncheckedFile?: true;
isPackageJsonImport?: true;
isImportStatementCompletion?: true;
+ /**
+ * For API purposes.
+ * Included for non-string completions only when `includeSymbol: true` option is passed to `getCompletionsAtPosition`.
+ * @example Get declaration of completion: `symbol.valueDeclaration`
+ */
+ symbol?: Symbol;
/**
* A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`,
* that allows TS Server to look up the symbol represented by the completion item, disambiguating
diff --git a/lib/typescript.js b/lib/typescript.js
index cdd6065a75b05..4b53c156ee249 100644
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -18,17 +18,10 @@ and limitations under the License.
var ts = (() => {
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
- }) : x)(function(x) {
- if (typeof require !== "undefined")
- return require.apply(this, arguments);
- throw new Error('Dynamic require of "' + x + '" is not supported');
- });
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
- var __commonJS = (cb, mod) => function __require2() {
+ var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
@@ -42,7 +35,7 @@ var ts = (() => {
"src/compiler/corePublic.ts"() {
"use strict";
versionMajorMinor = "5.0";
- version = `${versionMajorMinor}.0-beta`;
+ version = `${versionMajorMinor}.1-rc`;
Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3123,7 +3116,7 @@ ${lanes.join("\n")}
init_ts2();
nativePerformanceHooks = tryGetWebPerformanceHooks() || tryGetNodePerformanceHooks();
nativePerformance = nativePerformanceHooks == null ? void 0 : nativePerformanceHooks.performance;
- timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +new Date();
+ timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +/* @__PURE__ */ new Date();
}
});
@@ -3196,6 +3189,9 @@ ${lanes.join("\n")}
counts.set(markName, count + 1);
marks.set(markName, timestamp());
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
+ if (typeof onProfilerEvent === "function") {
+ onProfilerEvent(markName);
+ }
}
}
function measure(measureName, startMarkName, endMarkName) {
@@ -4481,13 +4477,14 @@ ${lanes.join("\n")}
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -5496,7 +5493,7 @@ ${lanes.join("\n")}
function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
const watcher = fsWatch(
dirName,
- FileSystemEntryKind.Directory,
+ 1 /* Directory */,
(_eventName, relativeFileName, modifiedTime) => {
if (!isString(relativeFileName))
return;
@@ -5694,7 +5691,7 @@ ${lanes.join("\n")}
}
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
const parentWatcher = cache.get(dirPath);
- if (parentWatcher && fileSystemEntryExists(dirName, FileSystemEntryKind.Directory)) {
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
return;
}
@@ -5759,7 +5756,7 @@ ${lanes.join("\n")}
return false;
let newChildWatches;
const hasChanges = enumerateInsertsAndDeletes(
- fileSystemEntryExists(parentDir, FileSystemEntryKind.Directory) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
+ fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
const childFullName = getNormalizedAbsolutePath(child, parentDir);
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
}) : emptyArray,
@@ -6179,7 +6176,7 @@ ${lanes.join("\n")}
PollingInterval3[PollingInterval3["Low"] = 250] = "Low";
return PollingInterval3;
})(PollingInterval || {});
- missingFileModifiedTime = new Date(0);
+ missingFileModifiedTime = /* @__PURE__ */ new Date(0);
defaultChunkLevels = { Low: 32, Medium: 64, High: 256 };
pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
@@ -6390,7 +6387,7 @@ ${lanes.join("\n")}
if (!err) {
try {
if ((_a2 = statSync(profilePath)) == null ? void 0 : _a2.isDirectory()) {
- profilePath = _path.join(profilePath, `${new Date().toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
+ profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
}
} catch (e) {
}
@@ -7342,7 +7339,6 @@ ${lanes.join("\n")}
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* 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."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* 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}')'?"),
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* 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'."),
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -7471,6 +7467,7 @@ ${lanes.join("\n")}
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, 3 /* Message */, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),
_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
+ Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -7864,7 +7861,6 @@ ${lanes.join("\n")}
Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -7988,7 +7984,7 @@ ${lanes.join("\n")}
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -8180,13 +8176,11 @@ ${lanes.join("\n")}
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
- Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
+ Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
- Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
- Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
- Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify 'ignoreDeprecations: "{2}"' to silence this error.`),
+ Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
@@ -8274,7 +8268,7 @@ ${lanes.join("\n")}
Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
- File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
+ File_0_exists_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exists_use_it_as_a_name_resolution_result_6097", "File '{0}' exists - use it as a name resolution result."),
Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
@@ -8564,6 +8558,11 @@ ${lanes.join("\n")}
Use_the_package_json_imports_field_when_resolving_imports: diag(6409, 3 /* Message */, "Use_the_package_json_imports_field_when_resolving_imports_6409", "Use the package.json 'imports' field when resolving imports."),
Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -8725,6 +8724,7 @@ ${lanes.join("\n")}
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
+ This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
@@ -8822,7 +8822,7 @@ ${lanes.join("\n")}
You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
- Decorators_must_come_after_export_or_export_default_in_JavaScript_files: diag(8038, 1 /* Error */, "Decorators_must_come_after_export_or_export_default_in_JavaScript_files_8038", "Decorators must come after 'export' or 'export default' in JavaScript files."),
+ Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -9614,18 +9614,18 @@ ${lanes.join("\n")}
return true;
}
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start, length2) {
- let text = textInitial;
- let pos;
- let end;
- let startPos;
- let tokenPos;
- let token;
- let tokenValue;
- let tokenFlags;
- let commentDirectives;
- let inJSDocType = 0;
+ var text = textInitial;
+ var pos;
+ var end;
+ var startPos;
+ var tokenPos;
+ var token;
+ var tokenValue;
+ var tokenFlags;
+ var commentDirectives;
+ var inJSDocType = 0;
setText(text, start, length2);
- const scanner2 = {
+ var scanner2 = {
getStartPos: () => startPos,
getTextPos: () => pos,
getToken: () => token,
@@ -12804,7 +12804,7 @@ ${lanes.join("\n")}
return (symbol.flags & 33554432 /* Transient */) !== 0;
}
function createSingleLineStringWriter() {
- let str = "";
+ var str = "";
const writeText = (text) => str += text;
return {
getText: () => str,
@@ -13025,6 +13025,36 @@ ${lanes.join("\n")}
function nodeIsPresent(node) {
return !nodeIsMissing(node);
}
+ function isGrammarError(parent2, child) {
+ if (isTypeParameterDeclaration(parent2))
+ return child === parent2.expression;
+ if (isClassStaticBlockDeclaration(parent2))
+ return child === parent2.modifiers;
+ if (isPropertySignature(parent2))
+ return child === parent2.initializer;
+ if (isPropertyDeclaration(parent2))
+ return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
+ if (isPropertyAssignment(parent2))
+ return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ if (isShorthandPropertyAssignment(parent2))
+ return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ if (isMethodDeclaration(parent2))
+ return child === parent2.exclamationToken;
+ if (isConstructorDeclaration(parent2))
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isGetAccessorDeclaration(parent2))
+ return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isSetAccessorDeclaration(parent2))
+ return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
+ if (isNamespaceExportDeclaration(parent2))
+ return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
+ return false;
+ }
+ function isGrammarErrorElement(nodeArray, child, isElement) {
+ if (!nodeArray || isArray(child) || !isElement(child))
+ return false;
+ return contains(nodeArray, child);
+ }
function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
if (from === void 0 || from.length === 0)
return to;
@@ -13168,101 +13198,400 @@ ${lanes.join("\n")}
return emitNode && emitNode.internalFlags || 0;
}
function getScriptTargetFeatures() {
- return {
- es2015: {
- Array: ["find", "findIndex", "fill", "copyWithin", "entries", "keys", "values"],
- RegExp: ["flags", "sticky", "unicode"],
- Reflect: ["apply", "construct", "defineProperty", "deleteProperty", "get", " getOwnPropertyDescriptor", "getPrototypeOf", "has", "isExtensible", "ownKeys", "preventExtensions", "set", "setPrototypeOf"],
- ArrayConstructor: ["from", "of"],
- ObjectConstructor: ["assign", "getOwnPropertySymbols", "keys", "is", "setPrototypeOf"],
- NumberConstructor: ["isFinite", "isInteger", "isNaN", "isSafeInteger", "parseFloat", "parseInt"],
- Math: ["clz32", "imul", "sign", "log10", "log2", "log1p", "expm1", "cosh", "sinh", "tanh", "acosh", "asinh", "atanh", "hypot", "trunc", "fround", "cbrt"],
- Map: ["entries", "keys", "values"],
- Set: ["entries", "keys", "values"],
- Promise: emptyArray,
- PromiseConstructor: ["all", "race", "reject", "resolve"],
- Symbol: ["for", "keyFor"],
- WeakMap: ["entries", "keys", "values"],
- WeakSet: ["entries", "keys", "values"],
- Iterator: emptyArray,
- AsyncIterator: emptyArray,
- String: ["codePointAt", "includes", "endsWith", "normalize", "repeat", "startsWith", "anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"],
- StringConstructor: ["fromCodePoint", "raw"]
- },
- es2016: {
- Array: ["includes"]
- },
- es2017: {
- Atomics: emptyArray,
- SharedArrayBuffer: emptyArray,
- String: ["padStart", "padEnd"],
- ObjectConstructor: ["values", "entries", "getOwnPropertyDescriptors"],
- DateTimeFormat: ["formatToParts"]
- },
- es2018: {
- Promise: ["finally"],
- RegExpMatchArray: ["groups"],
- RegExpExecArray: ["groups"],
- RegExp: ["dotAll"],
- Intl: ["PluralRules"],
- AsyncIterable: emptyArray,
- AsyncIterableIterator: emptyArray,
- AsyncGenerator: emptyArray,
- AsyncGeneratorFunction: emptyArray,
- NumberFormat: ["formatToParts"]
- },
- es2019: {
- Array: ["flat", "flatMap"],
- ObjectConstructor: ["fromEntries"],
- String: ["trimStart", "trimEnd", "trimLeft", "trimRight"],
- Symbol: ["description"]
- },
- es2020: {
- BigInt: emptyArray,
- BigInt64Array: emptyArray,
- BigUint64Array: emptyArray,
- PromiseConstructor: ["allSettled"],
- SymbolConstructor: ["matchAll"],
- String: ["matchAll"],
- DataView: ["setBigInt64", "setBigUint64", "getBigInt64", "getBigUint64"],
- RelativeTimeFormat: ["format", "formatToParts", "resolvedOptions"]
- },
- es2021: {
- PromiseConstructor: ["any"],
- String: ["replaceAll"]
- },
- es2022: {
- Array: ["at"],
- String: ["at"],
- Int8Array: ["at"],
- Uint8Array: ["at"],
- Uint8ClampedArray: ["at"],
- Int16Array: ["at"],
- Uint16Array: ["at"],
- Int32Array: ["at"],
- Uint32Array: ["at"],
- Float32Array: ["at"],
- Float64Array: ["at"],
- BigInt64Array: ["at"],
- BigUint64Array: ["at"],
- ObjectConstructor: ["hasOwn"],
- Error: ["cause"]
- },
- es2023: {
- Array: ["findLastIndex", "findLast"],
- Int8Array: ["findLastIndex", "findLast"],
- Uint8Array: ["findLastIndex", "findLast"],
- Uint8ClampedArray: ["findLastIndex", "findLast"],
- Int16Array: ["findLastIndex", "findLast"],
- Uint16Array: ["findLastIndex", "findLast"],
- Int32Array: ["findLastIndex", "findLast"],
- Uint32Array: ["findLastIndex", "findLast"],
- Float32Array: ["findLastIndex", "findLast"],
- Float64Array: ["findLastIndex", "findLast"],
- BigInt64Array: ["findLastIndex", "findLast"],
- BigUint64Array: ["findLastIndex", "findLast"]
- }
- };
+ return new Map(Object.entries({
+ Array: new Map(Object.entries({
+ es2015: [
+ "find",
+ "findIndex",
+ "fill",
+ "copyWithin",
+ "entries",
+ "keys",
+ "values"
+ ],
+ es2016: [
+ "includes"
+ ],
+ es2019: [
+ "flat",
+ "flatMap"
+ ],
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Iterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ AsyncIterator: new Map(Object.entries({
+ es2015: emptyArray
+ })),
+ Atomics: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ SharedArrayBuffer: new Map(Object.entries({
+ es2017: emptyArray
+ })),
+ AsyncIterable: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncIterableIterator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGenerator: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ AsyncGeneratorFunction: new Map(Object.entries({
+ es2018: emptyArray
+ })),
+ RegExp: new Map(Object.entries({
+ es2015: [
+ "flags",
+ "sticky",
+ "unicode"
+ ],
+ es2018: [
+ "dotAll"
+ ]
+ })),
+ Reflect: new Map(Object.entries({
+ es2015: [
+ "apply",
+ "construct",
+ "defineProperty",
+ "deleteProperty",
+ "get",
+ " getOwnPropertyDescriptor",
+ "getPrototypeOf",
+ "has",
+ "isExtensible",
+ "ownKeys",
+ "preventExtensions",
+ "set",
+ "setPrototypeOf"
+ ]
+ })),
+ ArrayConstructor: new Map(Object.entries({
+ es2015: [
+ "from",
+ "of"
+ ]
+ })),
+ ObjectConstructor: new Map(Object.entries({
+ es2015: [
+ "assign",
+ "getOwnPropertySymbols",
+ "keys",
+ "is",
+ "setPrototypeOf"
+ ],
+ es2017: [
+ "values",
+ "entries",
+ "getOwnPropertyDescriptors"
+ ],
+ es2019: [
+ "fromEntries"
+ ],
+ es2022: [
+ "hasOwn"
+ ]
+ })),
+ NumberConstructor: new Map(Object.entries({
+ es2015: [
+ "isFinite",
+ "isInteger",
+ "isNaN",
+ "isSafeInteger",
+ "parseFloat",
+ "parseInt"
+ ]
+ })),
+ Math: new Map(Object.entries({
+ es2015: [
+ "clz32",
+ "imul",
+ "sign",
+ "log10",
+ "log2",
+ "log1p",
+ "expm1",
+ "cosh",
+ "sinh",
+ "tanh",
+ "acosh",
+ "asinh",
+ "atanh",
+ "hypot",
+ "trunc",
+ "fround",
+ "cbrt"
+ ]
+ })),
+ Map: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ Set: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ PromiseConstructor: new Map(Object.entries({
+ es2015: [
+ "all",
+ "race",
+ "reject",
+ "resolve"
+ ],
+ es2020: [
+ "allSettled"
+ ],
+ es2021: [
+ "any"
+ ]
+ })),
+ Symbol: new Map(Object.entries({
+ es2015: [
+ "for",
+ "keyFor"
+ ],
+ es2019: [
+ "description"
+ ]
+ })),
+ WeakMap: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ WeakSet: new Map(Object.entries({
+ es2015: [
+ "entries",
+ "keys",
+ "values"
+ ]
+ })),
+ String: new Map(Object.entries({
+ es2015: [
+ "codePointAt",
+ "includes",
+ "endsWith",
+ "normalize",
+ "repeat",
+ "startsWith",
+ "anchor",
+ "big",
+ "blink",
+ "bold",
+ "fixed",
+ "fontcolor",
+ "fontsize",
+ "italics",
+ "link",
+ "small",
+ "strike",
+ "sub",
+ "sup"
+ ],
+ es2017: [
+ "padStart",
+ "padEnd"
+ ],
+ es2019: [
+ "trimStart",
+ "trimEnd",
+ "trimLeft",
+ "trimRight"
+ ],
+ es2020: [
+ "matchAll"
+ ],
+ es2021: [
+ "replaceAll"
+ ],
+ es2022: [
+ "at"
+ ]
+ })),
+ StringConstructor: new Map(Object.entries({
+ es2015: [
+ "fromCodePoint",
+ "raw"
+ ]
+ })),
+ DateTimeFormat: new Map(Object.entries({
+ es2017: [
+ "formatToParts"
+ ]
+ })),
+ Promise: new Map(Object.entries({
+ es2015: emptyArray,
+ es2018: [
+ "finally"
+ ]
+ })),
+ RegExpMatchArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ RegExpExecArray: new Map(Object.entries({
+ es2018: [
+ "groups"
+ ]
+ })),
+ Intl: new Map(Object.entries({
+ es2018: [
+ "PluralRules"
+ ]
+ })),
+ NumberFormat: new Map(Object.entries({
+ es2018: [
+ "formatToParts"
+ ]
+ })),
+ SymbolConstructor: new Map(Object.entries({
+ es2020: [
+ "matchAll"
+ ]
+ })),
+ DataView: new Map(Object.entries({
+ es2020: [
+ "setBigInt64",
+ "setBigUint64",
+ "getBigInt64",
+ "getBigUint64"
+ ]
+ })),
+ BigInt: new Map(Object.entries({
+ es2020: emptyArray
+ })),
+ RelativeTimeFormat: new Map(Object.entries({
+ es2020: [
+ "format",
+ "formatToParts",
+ "resolvedOptions"
+ ]
+ })),
+ Int8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint8ClampedArray: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint16Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Int32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Uint32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float32Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Float64Array: new Map(Object.entries({
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigInt64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ BigUint64Array: new Map(Object.entries({
+ es2020: emptyArray,
+ es2022: [
+ "at"
+ ],
+ es2023: [
+ "findLastIndex",
+ "findLast"
+ ]
+ })),
+ Error: new Map(Object.entries({
+ es2022: [
+ "cause"
+ ]
+ }))
+ }));
}
function getLiteralText(node, sourceFile, flags) {
var _a2;
@@ -13373,7 +13702,7 @@ ${lanes.join("\n")}
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
}
function isEffectiveExternalModule(node, compilerOptions) {
- return isExternalModule(node) || compilerOptions.isolatedModules || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
+ return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
}
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
switch (node.scriptKind) {
@@ -13394,7 +13723,7 @@ ${lanes.join("\n")}
if (startsWithUseStrict(node.statements)) {
return true;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
return true;
}
@@ -15927,12 +16256,12 @@ ${lanes.join("\n")}
return stringContains(version, "-dev") || stringContains(version, "-insiders");
}
function createTextWriter(newLine) {
- let output;
- let indent2;
- let lineStart;
- let lineCount;
- let linePos;
- let hasTrailingComment = false;
+ var output;
+ var indent2;
+ var lineStart;
+ var lineCount;
+ var linePos;
+ var hasTrailingComment = false;
function updateLineCountAndPosFor(s) {
const lineStartsOfS = computeLineStarts(s);
if (lineStartsOfS.length > 1) {
@@ -17055,10 +17384,10 @@ ${lanes.join("\n")}
return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
}
function isWriteOnlyAccess(node) {
- return accessKind(node) === AccessKind.Write;
+ return accessKind(node) === 1 /* Write */;
}
function isWriteAccess(node) {
- return accessKind(node) !== AccessKind.Read;
+ return accessKind(node) !== 0 /* Read */;
}
function accessKind(node) {
const { parent: parent2 } = node;
@@ -17159,9 +17488,6 @@ ${lanes.join("\n")}
function getObjectFlags(type) {
return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
}
- function typeHasCallOrConstructSignatures(type, checker) {
- return checker.getSignaturesOfType(type, 0 /* Call */).length !== 0 || checker.getSignaturesOfType(type, 1 /* Construct */).length !== 0;
- }
function forSomeAncestorDirectory(directory, callback) {
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
}
@@ -17726,7 +18052,7 @@ ${lanes.join("\n")}
return !!(compilerOptions.declaration || compilerOptions.composite);
}
function shouldPreserveConstEnums(compilerOptions) {
- return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
+ return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
}
function isIncrementalCompilation(options) {
return !!(options.incremental || options.composite);
@@ -18254,7 +18580,7 @@ ${lanes.join("\n")}
}
function rangeOfTypeParameters(sourceFile, typeParameters) {
const pos = typeParameters.pos - 1;
- const end = skipTrivia(sourceFile.text, typeParameters.end) + 1;
+ const end = Math.min(sourceFile.text.length, skipTrivia(sourceFile.text, typeParameters.end) + 1);
return { pos, end };
}
function skipTypeChecking(sourceFile, options, host) {
@@ -18725,7 +19051,7 @@ ${lanes.join("\n")}
const tag = getJSDocSatisfiesTag(node);
return tag && tag.typeExpression && tag.typeExpression.type;
}
- var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
+ var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
var init_utilities = __esm({
"src/compiler/utilities.ts"() {
"use strict";
@@ -18829,12 +19155,6 @@ ${lanes.join("\n")}
base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
carriageReturnLineFeed = "\r\n";
lineFeed = "\n";
- AccessKind = /* @__PURE__ */ ((AccessKind2) => {
- AccessKind2[AccessKind2["Read"] = 0] = "Read";
- AccessKind2[AccessKind2["Write"] = 1] = "Write";
- AccessKind2[AccessKind2["ReadWrite"] = 2] = "ReadWrite";
- return AccessKind2;
- })(AccessKind || {});
objectAllocator = {
getNodeConstructor: () => Node4,
getTokenConstructor: () => Token,
@@ -21518,24 +21838,7 @@ ${lanes.join("\n")}
return node;
}
function propagateAssignmentPatternFlags(node) {
- if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
- return 65536 /* ContainsObjectRestOrSpread */;
- if (node.transformFlags & 128 /* ContainsES2018 */) {
- for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
- const target = getTargetOfBindingOrAssignmentElement(element);
- if (target && isAssignmentPattern(target)) {
- if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
- return 65536 /* ContainsObjectRestOrSpread */;
- }
- if (target.transformFlags & 128 /* ContainsES2018 */) {
- const flags2 = propagateAssignmentPatternFlags(target);
- if (flags2)
- return flags2;
- }
- }
- }
- }
- return 0 /* None */;
+ return containsObjectRestOrSpread(node) ? 65536 /* ContainsObjectRestOrSpread */ : 0 /* None */;
}
function updateBinaryExpression(node, left, operator, right) {
return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node;
@@ -24558,14 +24861,114 @@ ${lanes.join("\n")}
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name)
]);
}
+ function createESDecorateClassElementAccessGetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "get",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ accessor
+ )
+ );
+ }
+ function createESDecorateClassElementAccessSetMethod(elementName) {
+ const accessor = elementName.computed ? factory2.createElementAccessExpression(factory2.createIdentifier("obj"), elementName.name) : factory2.createPropertyAccessExpression(factory2.createIdentifier("obj"), elementName.name);
+ return factory2.createPropertyAssignment(
+ "set",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ ),
+ factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("value")
+ )
+ ],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBlock([
+ factory2.createExpressionStatement(
+ factory2.createAssignment(
+ accessor,
+ factory2.createIdentifier("value")
+ )
+ )
+ ])
+ )
+ );
+ }
+ function createESDecorateClassElementAccessHasMethod(elementName) {
+ const propertyName = elementName.computed ? elementName.name : isIdentifier(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name;
+ return factory2.createPropertyAssignment(
+ "has",
+ factory2.createArrowFunction(
+ /*modifiers*/
+ void 0,
+ /*typeParameters*/
+ void 0,
+ [factory2.createParameterDeclaration(
+ /*modifiers*/
+ void 0,
+ /*dotDotDotToken*/
+ void 0,
+ factory2.createIdentifier("obj")
+ )],
+ /*type*/
+ void 0,
+ /*equalsGreaterThanToken*/
+ void 0,
+ factory2.createBinaryExpression(
+ propertyName,
+ 101 /* InKeyword */,
+ factory2.createIdentifier("obj")
+ )
+ )
+ );
+ }
+ function createESDecorateClassElementAccessObject(name, access) {
+ const properties = [];
+ properties.push(createESDecorateClassElementAccessHasMethod(name));
+ if (access.get)
+ properties.push(createESDecorateClassElementAccessGetMethod(name));
+ if (access.set)
+ properties.push(createESDecorateClassElementAccessSetMethod(name));
+ return factory2.createObjectLiteralExpression(properties);
+ }
function createESDecorateClassElementContextObject(contextIn) {
return factory2.createObjectLiteralExpression([
factory2.createPropertyAssignment(factory2.createIdentifier("kind"), factory2.createStringLiteral(contextIn.kind)),
factory2.createPropertyAssignment(factory2.createIdentifier("name"), contextIn.name.computed ? contextIn.name.name : factory2.createStringLiteralFromNode(contextIn.name.name)),
factory2.createPropertyAssignment(factory2.createIdentifier("static"), contextIn.static ? factory2.createTrue() : factory2.createFalse()),
- factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse())
- // Disabled, pending resolution of https://github.com/tc39/proposal-decorators/issues/494
- // factory.createPropertyAssignment(factory.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
+ factory2.createPropertyAssignment(factory2.createIdentifier("private"), contextIn.private ? factory2.createTrue() : factory2.createFalse()),
+ factory2.createPropertyAssignment(factory2.createIdentifier("access"), createESDecorateClassElementAccessObject(contextIn.name, contextIn.access))
]);
}
function createESDecorateContextObject(contextIn) {
@@ -26773,7 +27176,7 @@ ${lanes.join("\n")}
}
function canHaveIllegalModifiers(node) {
const kind = node.kind;
- return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 181 /* FunctionType */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
+ return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
}
function isQuestionOrExclamationToken(node) {
return isQuestionToken(node) || isExclamationToken(node);
@@ -27035,6 +27438,25 @@ ${lanes.join("\n")}
flattenCommaListWorker(node, expressions);
return expressions;
}
+ function containsObjectRestOrSpread(node) {
+ if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
+ return true;
+ if (node.transformFlags & 128 /* ContainsES2018 */) {
+ for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
+ const target = getTargetOfBindingOrAssignmentElement(element);
+ if (target && isAssignmentPattern(target)) {
+ if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ return true;
+ }
+ if (target.transformFlags & 128 /* ContainsES2018 */) {
+ if (containsObjectRestOrSpread(target))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
var BinaryExpressionState, BinaryExpressionStateMachine;
var init_utilities2 = __esm({
"src/compiler/factory/utilities.ts"() {
@@ -28039,22 +28461,22 @@ ${lanes.join("\n")}
[356 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
};
((Parser2) => {
- const scanner2 = createScanner(
+ var scanner2 = createScanner(
99 /* Latest */,
/*skipTrivia*/
true
);
- const disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
- let NodeConstructor2;
- let TokenConstructor2;
- let IdentifierConstructor2;
- let PrivateIdentifierConstructor2;
- let SourceFileConstructor2;
+ var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
+ var NodeConstructor2;
+ var TokenConstructor2;
+ var IdentifierConstructor2;
+ var PrivateIdentifierConstructor2;
+ var SourceFileConstructor2;
function countNode(node) {
nodeCount++;
return node;
}
- const baseNodeFactory = {
+ var baseNodeFactory = {
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
kind,
/*pos*/
@@ -28091,25 +28513,53 @@ ${lanes.join("\n")}
0
))
};
- const factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
- let fileName;
- let sourceFlags;
- let sourceText;
- let languageVersion;
- let scriptKind;
- let languageVariant;
- let parseDiagnostics;
- let jsDocDiagnostics;
- let syntaxCursor;
- let currentToken;
- let nodeCount;
- let identifiers;
- let identifierCount;
- let parsingContext;
- let notParenthesizedArrow;
- let contextFlags;
- let topLevel = true;
- let parseErrorBeforeNextFinishedNode = false;
+ var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
+ var {
+ createNodeArray: factoryCreateNodeArray,
+ createNumericLiteral: factoryCreateNumericLiteral,
+ createStringLiteral: factoryCreateStringLiteral,
+ createLiteralLikeNode: factoryCreateLiteralLikeNode,
+ createIdentifier: factoryCreateIdentifier,
+ createPrivateIdentifier: factoryCreatePrivateIdentifier,
+ createToken: factoryCreateToken,
+ createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
+ createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
+ createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
+ createPropertyAccessChain: factoryCreatePropertyAccessChain,
+ createElementAccessExpression: factoryCreateElementAccessExpression,
+ createElementAccessChain: factoryCreateElementAccessChain,
+ createCallExpression: factoryCreateCallExpression,
+ createCallChain: factoryCreateCallChain,
+ createNewExpression: factoryCreateNewExpression,
+ createParenthesizedExpression: factoryCreateParenthesizedExpression,
+ createBlock: factoryCreateBlock,
+ createVariableStatement: factoryCreateVariableStatement,
+ createExpressionStatement: factoryCreateExpressionStatement,
+ createIfStatement: factoryCreateIfStatement,
+ createWhileStatement: factoryCreateWhileStatement,
+ createForStatement: factoryCreateForStatement,
+ createForOfStatement: factoryCreateForOfStatement,
+ createVariableDeclaration: factoryCreateVariableDeclaration,
+ createVariableDeclarationList: factoryCreateVariableDeclarationList
+ } = factory2;
+ var fileName;
+ var sourceFlags;
+ var sourceText;
+ var languageVersion;
+ var scriptKind;
+ var languageVariant;
+ var parseDiagnostics;
+ var jsDocDiagnostics;
+ var syntaxCursor;
+ var currentToken;
+ var nodeCount;
+ var identifiers;
+ var identifierCount;
+ var parsingContext;
+ var notParenthesizedArrow;
+ var contextFlags;
+ var topLevel = true;
+ var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
var _a2;
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
@@ -28209,8 +28659,8 @@ ${lanes.join("\n")}
}
}
}
- const expression = isArray(expressions) ? finishNode(factory2.createArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
- const statement = factory2.createExpressionStatement(expression);
+ const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
+ const statement = factoryCreateExpressionStatement(expression);
finishNode(statement, pos);
statements = createNodeArray([statement], pos);
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
@@ -28302,7 +28752,7 @@ ${lanes.join("\n")}
}
sourceFlags = contextFlags;
nextToken();
- const statements = parseList(ParsingContext.SourceElements, parseStatement);
+ const statements = parseList(0 /* SourceElements */, parseStatement);
Debug.assert(token() === 1 /* EndOfFileToken */);
const endOfFileToken = addJSDocComment(parseTokenNode());
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
@@ -28365,7 +28815,7 @@ ${lanes.join("\n")}
nextToken();
while (token() !== 1 /* EndOfFileToken */) {
const startPos = scanner2.getStartPos();
- const statement = parseListElement(ParsingContext.SourceElements, parseStatement);
+ const statement = parseListElement(0 /* SourceElements */, parseStatement);
statements.push(statement);
if (startPos === scanner2.getStartPos()) {
nextToken();
@@ -28393,7 +28843,7 @@ ${lanes.join("\n")}
}
}
syntaxCursor = savedSyntaxCursor;
- return factory2.updateSourceFile(sourceFile, setTextRange(factory2.createNodeArray(statements), sourceFile.statements));
+ return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
function containsPossibleTopLevelAwait(node) {
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
}
@@ -28834,13 +29284,13 @@ ${lanes.join("\n")}
const pos = getNodePos();
const kind = token();
nextToken();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseTokenNodeJSDoc() {
const pos = getNodePos();
const kind = token();
nextTokenJSDoc();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function canParseSemicolon() {
if (token() === 26 /* SemicolonToken */) {
@@ -28861,7 +29311,7 @@ ${lanes.join("\n")}
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
}
function createNodeArray(elements, pos, end, hasTrailingComma) {
- const array = factory2.createNodeArray(elements, hasTrailingComma);
+ const array = factoryCreateNodeArray(elements, hasTrailingComma);
setTextRangePosEnd(array, pos, end != null ? end : scanner2.getStartPos());
return array;
}
@@ -28883,7 +29333,7 @@ ${lanes.join("\n")}
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
const pos = getNodePos();
- const result = kind === 79 /* Identifier */ ? factory2.createIdentifier(
+ const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
"",
/*originalKeywordKind*/
void 0
@@ -28893,15 +29343,15 @@ ${lanes.join("\n")}
"",
/*templateFlags*/
void 0
- ) : kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(
+ ) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
"",
/*numericLiteralFlags*/
void 0
- ) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ ) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
"",
/*isSingleQuote*/
void 0
- ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factory2.createToken(kind);
+ ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
return finishNode(result, pos);
}
function internIdentifier(text) {
@@ -28919,7 +29369,7 @@ ${lanes.join("\n")}
const text = internIdentifier(scanner2.getTokenValue());
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
nextTokenWithoutCheck();
- return finishNode(factory2.createIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
+ return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
}
if (token() === 80 /* PrivateIdentifier */) {
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -28990,7 +29440,7 @@ ${lanes.join("\n")}
}
function parsePrivateIdentifier() {
const pos = getNodePos();
- const node = factory2.createPrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
+ const node = factoryCreatePrivateIdentifier(internIdentifier(scanner2.getTokenValue()));
nextToken();
return finishNode(node, pos);
}
@@ -29019,7 +29469,6 @@ ${lanes.join("\n")}
return canFollowExportModifier();
case 88 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 127 /* AccessorKeyword */:
case 124 /* StaticKeyword */:
case 137 /* GetKeyword */:
case 151 /* SetKeyword */:
@@ -29052,19 +29501,19 @@ ${lanes.join("\n")}
return true;
}
switch (parsingContext2) {
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return lookAhead(isClassMemberStart) || token() === 26 /* SemicolonToken */ && !inErrorRecovery;
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return token() === 22 /* OpenBracketToken */ || isLiteralPropertyName();
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
switch (token()) {
case 22 /* OpenBracketToken */:
case 41 /* AsteriskToken */:
@@ -29074,13 +29523,13 @@ ${lanes.join("\n")}
default:
return isLiteralPropertyName();
}
- case ParsingContext.RestProperties:
+ case 18 /* RestProperties */:
return isLiteralPropertyName();
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return token() === 22 /* OpenBracketToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName();
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return isAssertionKey2();
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
if (token() === 18 /* OpenBraceToken */) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
@@ -29089,40 +29538,40 @@ ${lanes.join("\n")}
} else {
return isIdentifier2() && !isHeritageClauseExtendsOrImplementsKeyword();
}
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
switch (token()) {
case 27 /* CommaToken */:
case 24 /* DotToken */:
return true;
}
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 25 /* DotDotDotToken */ || isStartOfExpression();
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isStartOfParameter(
/*isJSDocParameter*/
false
);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return isStartOfParameter(
/*isJSDocParameter*/
true
);
- case ParsingContext.TypeArguments:
- case ParsingContext.TupleElementTypes:
+ case 20 /* TypeArguments */:
+ case 21 /* TupleElementTypes */:
return token() === 27 /* CommaToken */ || isStartOfType();
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return isHeritageClause2();
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return tokenIsIdentifierOrKeyword(token());
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return true;
}
return Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -29166,41 +29615,41 @@ ${lanes.join("\n")}
return true;
}
switch (kind) {
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauses:
- case ParsingContext.TypeMembers:
- case ParsingContext.ClassMembers:
- case ParsingContext.EnumMembers:
- case ParsingContext.ObjectLiteralMembers:
- case ParsingContext.ObjectBindingElements:
- case ParsingContext.ImportOrExportSpecifiers:
- case ParsingContext.AssertEntries:
+ case 1 /* BlockStatements */:
+ case 2 /* SwitchClauses */:
+ case 4 /* TypeMembers */:
+ case 5 /* ClassMembers */:
+ case 6 /* EnumMembers */:
+ case 12 /* ObjectLiteralMembers */:
+ case 9 /* ObjectBindingElements */:
+ case 23 /* ImportOrExportSpecifiers */:
+ case 24 /* AssertEntries */:
return token() === 19 /* CloseBraceToken */;
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return token() === 19 /* CloseBraceToken */ || token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 31 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
- case ParsingContext.ArrayLiteralMembers:
- case ParsingContext.TupleElementTypes:
- case ParsingContext.ArrayBindingElements:
+ case 15 /* ArrayLiteralMembers */:
+ case 21 /* TupleElementTypes */:
+ case 10 /* ArrayBindingElements */:
return token() === 23 /* CloseBracketToken */;
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
- case ParsingContext.RestProperties:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
+ case 18 /* RestProperties */:
return token() === 21 /* CloseParenToken */ || token() === 23 /* CloseBracketToken */;
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return token() !== 27 /* CommaToken */;
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return token() === 18 /* OpenBraceToken */ || token() === 19 /* CloseBraceToken */;
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return token() === 31 /* GreaterThanToken */ || token() === 43 /* SlashToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
default:
return false;
@@ -29219,7 +29668,7 @@ ${lanes.join("\n")}
return false;
}
function isInSomeParsingContext() {
- for (let kind = 0; kind < ParsingContext.Count; kind++) {
+ for (let kind = 0; kind < 25 /* Count */; kind++) {
if (parsingContext & 1 << kind) {
if (isListElement2(
kind,
@@ -29288,38 +29737,38 @@ ${lanes.join("\n")}
}
function isReusableParsingContext(parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
- case ParsingContext.SwitchClauses:
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
- case ParsingContext.EnumMembers:
- case ParsingContext.TypeMembers:
- case ParsingContext.VariableDeclarations:
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 5 /* ClassMembers */:
+ case 2 /* SwitchClauses */:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
+ case 6 /* EnumMembers */:
+ case 4 /* TypeMembers */:
+ case 8 /* VariableDeclarations */:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return true;
}
return false;
}
function canReuseNode(node, parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return isReusableClassMember(node);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return isReusableSwitchClause(node);
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return isReusableStatement(node);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return isReusableEnumMember(node);
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return isReusableTypeMember(node);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isReusableVariableDeclaration(node);
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return isReusableParameter(node);
}
return false;
@@ -29429,56 +29878,56 @@ ${lanes.join("\n")}
}
function parsingContextErrors(context) {
switch (context) {
- case ParsingContext.SourceElements:
+ case 0 /* SourceElements */:
return token() === 88 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(93 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.BlockStatements:
+ case 1 /* BlockStatements */:
return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return parseErrorAtCurrentToken(Diagnostics.case_or_default_expected);
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
- case ParsingContext.RestProperties:
- case ParsingContext.TypeMembers:
+ case 18 /* RestProperties */:
+ case 4 /* TypeMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return parseErrorAtCurrentToken(Diagnostics.Enum_member_expected);
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return parseErrorAtCurrentToken(Diagnostics.Expression_expected);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Variable_declaration_expected);
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Property_destructuring_pattern_expected);
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Array_element_destructuring_pattern_expected);
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return parseErrorAtCurrentToken(Diagnostics.Argument_expression_expected);
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
- case ParsingContext.TupleElementTypes:
+ case 21 /* TupleElementTypes */:
return parseErrorAtCurrentToken(Diagnostics.Type_expected);
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_expected);
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
- case ParsingContext.Count:
+ case 25 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(context);
@@ -29537,7 +29986,7 @@ ${lanes.join("\n")}
);
}
function getExpectedCommaDiagnostic(kind) {
- return kind === ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
+ return kind === 6 /* EnumMembers */ ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
}
function createMissingList() {
const list = createNodeArray([], getNodePos());
@@ -29706,12 +30155,12 @@ ${lanes.join("\n")}
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
// We also do not need to check for negatives because any prefix operator would be part of a
// parent unary expression.
- kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
scanner2.getTokenValue(),
/*isSingleQuote*/
void 0,
scanner2.hasExtendedUnicodeEscape()
- ) : isLiteralKind(kind) ? factory2.createLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
+ ) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner2.getTokenValue()) : Debug.fail()
);
if (scanner2.hasExtendedUnicodeEscape()) {
node.hasExtendedUnicodeEscape = true;
@@ -29731,7 +30180,7 @@ ${lanes.join("\n")}
}
function parseTypeArgumentsOfTypeReference() {
if (!scanner2.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function parseTypeReference() {
@@ -29913,7 +30362,7 @@ ${lanes.join("\n")}
}
function parseTypeParameters() {
if (token() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeParameters, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function isStartOfParameter(isJSDocParameter) {
@@ -30019,7 +30468,7 @@ ${lanes.join("\n")}
const savedAwaitContext = inAwaitContext();
setYieldContext(!!(flags & 1 /* Yield */));
setAwaitContext(!!(flags & 2 /* Await */));
- const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
+ const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) : parseDelimitedList(16 /* Parameters */, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
return parameters;
@@ -30087,7 +30536,7 @@ ${lanes.join("\n")}
return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers) {
- const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(
+ const parameters = parseBracketedList(16 /* Parameters */, () => parseParameter(
/*inOuterAwaitContext*/
false
), 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
@@ -30186,7 +30635,7 @@ ${lanes.join("\n")}
function parseObjectTypeMembers() {
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -30240,7 +30689,7 @@ ${lanes.join("\n")}
}
const type = parseTypeAnnotation();
parseSemicolon();
- const members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ const members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
}
@@ -30285,7 +30734,7 @@ ${lanes.join("\n")}
const pos = getNodePos();
return finishNode(
factory2.createTupleTypeNode(
- parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
+ parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
),
pos
);
@@ -30302,7 +30751,7 @@ ${lanes.join("\n")}
if (token() === 126 /* AbstractKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(126 /* AbstractKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -30312,6 +30761,7 @@ ${lanes.join("\n")}
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiersForConstructorType();
const isConstructorType = parseOptional(103 /* NewKeyword */);
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
const typeParameters = parseTypeParameters();
const parameters = parseParameters(4 /* Type */);
const type = parseReturnType(
@@ -30320,8 +30770,6 @@ ${lanes.join("\n")}
false
);
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
- if (!isConstructorType)
- node.modifiers = modifiers;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseKeywordAndNoDot() {
@@ -30913,10 +31361,10 @@ ${lanes.join("\n")}
}
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
const triState = isParenthesizedArrowFunctionExpression();
- if (triState === Tristate.False) {
+ if (triState === 0 /* False */) {
return void 0;
}
- return triState === Tristate.True ? parseParenthesizedArrowFunctionExpression(
+ return triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpression(
/*allowAmbiguity*/
true,
/*allowReturnTypeInArrowFunction*/
@@ -30928,18 +31376,18 @@ ${lanes.join("\n")}
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner2.hasPrecedingLineBreak()) {
- return Tristate.False;
+ return 0 /* False */;
}
if (token() !== 20 /* OpenParenToken */ && token() !== 29 /* LessThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
}
const first2 = token();
@@ -30951,45 +31399,45 @@ ${lanes.join("\n")}
case 38 /* EqualsGreaterThanToken */:
case 58 /* ColonToken */:
case 18 /* OpenBraceToken */:
- return Tristate.True;
+ return 1 /* True */;
default:
- return Tristate.False;
+ return 0 /* False */;
}
}
if (second === 22 /* OpenBracketToken */ || second === 18 /* OpenBraceToken */) {
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
if (second === 25 /* DotDotDotToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
if (isModifierKind(second) && second !== 132 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
if (nextToken() === 128 /* AsKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.True;
+ return 1 /* True */;
}
if (!isIdentifier2() && second !== 108 /* ThisKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
switch (nextToken()) {
case 58 /* ColonToken */:
- return Tristate.True;
+ return 1 /* True */;
case 57 /* QuestionToken */:
nextToken();
if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 63 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
case 27 /* CommaToken */:
case 63 /* EqualsToken */:
case 21 /* CloseParenToken */:
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
- return Tristate.False;
+ return 0 /* False */;
} else {
Debug.assert(first2 === 29 /* LessThanToken */);
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
if (languageVariant === 1 /* JSX */) {
const isArrowFunctionInJsx = lookAhead(() => {
@@ -31000,6 +31448,7 @@ ${lanes.join("\n")}
switch (fourth) {
case 63 /* EqualsToken */:
case 31 /* GreaterThanToken */:
+ case 43 /* SlashToken */:
return false;
default:
return true;
@@ -31010,11 +31459,11 @@ ${lanes.join("\n")}
return false;
});
if (isArrowFunctionInJsx) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
}
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
@@ -31034,7 +31483,7 @@ ${lanes.join("\n")}
}
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) {
if (token() === 132 /* AsyncKeyword */) {
- if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === Tristate.True) {
+ if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
const pos = getNodePos();
const asyncModifier = parseModifiersForArrowFunction();
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
@@ -31047,14 +31496,14 @@ ${lanes.join("\n")}
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner2.hasPrecedingLineBreak() || token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
if (!scanner2.hasPrecedingLineBreak() && expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
}
- return Tristate.False;
+ return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) {
const pos = getNodePos();
@@ -31259,6 +31708,12 @@ ${lanes.join("\n")}
case 114 /* VoidKeyword */:
return parseVoidExpression();
case 29 /* LessThanToken */:
+ if (languageVariant === 1 /* JSX */) {
+ return parseJsxElementOrSelfClosingElementOrFragment(
+ /*inExpressionContext*/
+ true
+ );
+ }
return parseTypeAssertion();
case 133 /* AwaitKeyword */:
if (isAwaitExpression2()) {
@@ -31353,7 +31808,7 @@ ${lanes.join("\n")}
return expression;
}
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
- return finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -31374,7 +31829,7 @@ ${lanes.join("\n")}
factory2.createJsxElement(
lastChild.openingElement,
lastChild.children,
- finishNode(factory2.createJsxClosingElement(finishNode(factory2.createIdentifier(""), end, end)), end, end)
+ finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
),
lastChild.openingElement.pos,
end
@@ -31462,7 +31917,7 @@ ${lanes.join("\n")}
const list = [];
const listPos = getNodePos();
const saveParsingContext = parsingContext;
- parsingContext |= 1 << ParsingContext.JsxChildren;
+ parsingContext |= 1 << 14 /* JsxChildren */;
while (true) {
const child = parseJsxChild(openingTag, currentToken = scanner2.reScanJsxToken());
if (!child)
@@ -31477,7 +31932,7 @@ ${lanes.join("\n")}
}
function parseJsxAttributes() {
const pos = getNodePos();
- return finishNode(factory2.createJsxAttributes(parseList(ParsingContext.JsxAttributes, parseJsxAttribute)), pos);
+ return finishNode(factory2.createJsxAttributes(parseList(13 /* JsxAttributes */, parseJsxAttribute)), pos);
}
function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
const pos = getNodePos();
@@ -31517,7 +31972,7 @@ ${lanes.join("\n")}
scanJsxIdentifier();
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- expression = finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -31611,13 +32066,9 @@ ${lanes.join("\n")}
function parseJsxClosingFragment(inExpressionContext) {
const pos = getNodePos();
parseExpected(30 /* LessThanSlashToken */);
- if (tokenIsIdentifierOrKeyword(token())) {
- parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
- }
if (parseExpected(
31 /* GreaterThanToken */,
- /*diagnostic*/
- void 0,
+ Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
/*shouldAdvance*/
false
)) {
@@ -31630,6 +32081,7 @@ ${lanes.join("\n")}
return finishNode(factory2.createJsxJsxClosingFragment(), pos);
}
function parseTypeAssertion() {
+ Debug.assert(languageVariant !== 1 /* JSX */, "Type assertions should never be parsed in JSX; they should be parsed as comparisons or JSX elements/fragments.");
const pos = getNodePos();
parseExpected(29 /* LessThanToken */);
const type = parseType();
@@ -31671,7 +32123,7 @@ ${lanes.join("\n")}
true
);
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
- const propertyAccess = isOptionalChain2 ? factory2.createPropertyAccessChain(expression, questionDotToken, name) : factory2.createPropertyAccessExpression(expression, name);
+ const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
}
@@ -31699,7 +32151,7 @@ ${lanes.join("\n")}
argumentExpression = argument;
}
parseExpected(23 /* CloseBracketToken */);
- const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createElementAccessChain(expression, questionDotToken, argumentExpression) : factory2.createElementAccessExpression(expression, argumentExpression);
+ const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
return finishNode(indexedAccess, pos);
}
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
@@ -31786,7 +32238,7 @@ ${lanes.join("\n")}
expression = expression.expression;
}
const argumentList = parseArgumentList();
- const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createCallChain(expression, questionDotToken, typeArguments, argumentList) : factory2.createCallExpression(expression, typeArguments, argumentList);
+ const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
}
@@ -31797,7 +32249,7 @@ ${lanes.join("\n")}
false,
Diagnostics.Identifier_expected
);
- expression = finishNode(factory2.createPropertyAccessChain(expression, questionDotToken, name), pos);
+ expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
}
@@ -31805,7 +32257,7 @@ ${lanes.join("\n")}
}
function parseArgumentList() {
parseExpected(20 /* OpenParenToken */);
- const result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression);
+ const result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);
parseExpected(21 /* CloseParenToken */);
return result;
}
@@ -31817,7 +32269,7 @@ ${lanes.join("\n")}
return void 0;
}
nextToken();
- const typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType);
+ const typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
return void 0;
}
@@ -31892,7 +32344,7 @@ ${lanes.join("\n")}
parseExpected(20 /* OpenParenToken */);
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- return withJSDoc(finishNode(factory2.createParenthesizedExpression(expression), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
}
function parseSpreadElement() {
const pos = getNodePos();
@@ -31917,9 +32369,9 @@ ${lanes.join("\n")}
const openBracketPosition = scanner2.getTokenPos();
const openBracketParsed = parseExpected(22 /* OpenBracketToken */);
const multiLine = scanner2.hasPrecedingLineBreak();
- const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
+ const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
- return finishNode(factory2.createArrayLiteralExpression(elements, multiLine), pos);
+ return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
}
function parseObjectLiteralElement() {
const pos = getNodePos();
@@ -31978,13 +32430,13 @@ ${lanes.join("\n")}
const openBraceParsed = parseExpected(18 /* OpenBraceToken */);
const multiLine = scanner2.hasPrecedingLineBreak();
const properties = parseDelimitedList(
- ParsingContext.ObjectLiteralMembers,
+ 12 /* ObjectLiteralMembers */,
parseObjectLiteralElement,
/*considerSemicolonAsDelimiter*/
true
);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- return finishNode(factory2.createObjectLiteralExpression(properties, multiLine), pos);
+ return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
}
function parseFunctionExpression() {
const savedDecoratorContext = inDecoratorContext();
@@ -32041,7 +32493,7 @@ ${lanes.join("\n")}
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
}
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
- return finishNode(factory2.createNewExpression(expression, typeArguments, argumentList), pos);
+ return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
const pos = getNodePos();
@@ -32050,17 +32502,17 @@ ${lanes.join("\n")}
const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
if (openBraceParsed || ignoreMissingOpenBrace) {
const multiLine = scanner2.hasPrecedingLineBreak();
- const statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ const statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
+ const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
if (token() === 63 /* EqualsToken */) {
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
nextToken();
}
return result;
} else {
const statements = createMissingList();
- return withJSDoc(finishNode(factory2.createBlock(
+ return withJSDoc(finishNode(factoryCreateBlock(
statements,
/*multiLine*/
void 0
@@ -32109,7 +32561,7 @@ ${lanes.join("\n")}
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const thenStatement = parseStatement();
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
- return withJSDoc(finishNode(factory2.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
}
function parseDoStatement() {
const pos = getNodePos();
@@ -32133,7 +32585,7 @@ ${lanes.join("\n")}
const expression = allowInAnd(parseExpression);
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const statement = parseStatement();
- return withJSDoc(finishNode(factory2.createWhileStatement(expression, statement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
}
function parseForOrForInOrForOfStatement() {
const pos = getNodePos();
@@ -32159,7 +32611,7 @@ ${lanes.join("\n")}
true
));
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForOfStatement(awaitToken, initializer, expression, parseStatement());
+ node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
} else if (parseOptional(101 /* InKeyword */)) {
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -32170,7 +32622,7 @@ ${lanes.join("\n")}
parseExpected(26 /* SemicolonToken */);
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForStatement(initializer, condition, incrementor, parseStatement());
+ node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
}
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -32208,14 +32660,14 @@ ${lanes.join("\n")}
parseExpected(82 /* CaseKeyword */);
const expression = allowInAnd(parseExpression);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return withJSDoc(finishNode(factory2.createCaseClause(expression, statements), pos), hasJSDoc);
}
function parseDefaultClause() {
const pos = getNodePos();
parseExpected(88 /* DefaultKeyword */);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(factory2.createDefaultClause(statements), pos);
}
function parseCaseOrDefaultClause() {
@@ -32224,7 +32676,7 @@ ${lanes.join("\n")}
function parseCaseBlock() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const clauses = parseList(ParsingContext.SwitchClauses, parseCaseOrDefaultClause);
+ const clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createCaseBlock(clauses), pos);
}
@@ -32245,7 +32697,7 @@ ${lanes.join("\n")}
let expression = scanner2.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
if (expression === void 0) {
identifierCount++;
- expression = finishNode(factory2.createIdentifier(""), getNodePos());
+ expression = finishNode(factoryCreateIdentifier(""), getNodePos());
}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
@@ -32306,7 +32758,7 @@ ${lanes.join("\n")}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
}
- node = factory2.createExpressionStatement(expression);
+ node = factoryCreateExpressionStatement(expression);
if (hasParen) {
hasJSDoc = false;
}
@@ -32665,14 +33117,14 @@ ${lanes.join("\n")}
function parseObjectBindingPattern() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement);
+ const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createObjectBindingPattern(elements), pos);
}
function parseArrayBindingPattern() {
const pos = getNodePos();
parseExpected(22 /* OpenBracketToken */);
- const elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement);
+ const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
return finishNode(factory2.createArrayBindingPattern(elements), pos);
}
@@ -32704,7 +33156,7 @@ ${lanes.join("\n")}
}
const type = parseTypeAnnotation();
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
- const node = factory2.createVariableDeclaration(name, exclamationToken, type, initializer);
+ const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseVariableDeclarationList(inForStatementInitializer) {
@@ -32730,12 +33182,12 @@ ${lanes.join("\n")}
const savedDisallowIn = inDisallowInContext();
setDisallowInContext(inForStatementInitializer);
declarations = parseDelimitedList(
- ParsingContext.VariableDeclarations,
+ 8 /* VariableDeclarations */,
inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation
);
setDisallowInContext(savedDisallowIn);
}
- return finishNode(factory2.createVariableDeclarationList(declarations, flags), pos);
+ return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
}
function canFollowContextualOfKeyword() {
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
@@ -32746,7 +33198,7 @@ ${lanes.join("\n")}
false
);
parseSemicolon();
- const node = factory2.createVariableStatement(modifiers, declarationList);
+ const node = factoryCreateVariableStatement(modifiers, declarationList);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
@@ -32975,22 +33427,30 @@ ${lanes.join("\n")}
return void 0;
}
}
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
const pos = getNodePos();
let list;
- let modifier, hasSeenStaticModifier = false;
+ let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false;
+ if (allowDecorators && token() === 59 /* AtToken */) {
+ while (decorator = tryParseDecorator()) {
+ list = append(list, decorator);
+ }
+ }
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
list = append(list, modifier);
+ hasLeadingModifier = true;
}
- if (allowDecorators && token() === 59 /* AtToken */) {
- let decorator;
+ if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) {
while (decorator = tryParseDecorator()) {
list = append(list, decorator);
+ hasTrailingDecorator = true;
}
+ }
+ if (hasTrailingDecorator) {
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
@@ -33004,7 +33464,7 @@ ${lanes.join("\n")}
if (token() === 132 /* AsyncKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(132 /* AsyncKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -33133,7 +33593,7 @@ ${lanes.join("\n")}
}
function parseHeritageClauses() {
if (isHeritageClause2()) {
- return parseList(ParsingContext.HeritageClauses, parseHeritageClause);
+ return parseList(22 /* HeritageClauses */, parseHeritageClause);
}
return void 0;
}
@@ -33142,7 +33602,7 @@ ${lanes.join("\n")}
const tok = token();
Debug.assert(tok === 94 /* ExtendsKeyword */ || tok === 117 /* ImplementsKeyword */);
nextToken();
- const types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
+ const types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(factory2.createHeritageClause(tok, types), pos);
}
function parseExpressionWithTypeArguments() {
@@ -33155,13 +33615,13 @@ ${lanes.join("\n")}
return finishNode(factory2.createExpressionWithTypeArguments(expression, typeArguments), pos);
}
function tryParseTypeArguments() {
- return token() === 29 /* LessThanToken */ ? parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
+ return token() === 29 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
}
function isHeritageClause2() {
return token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
}
function parseClassMembers() {
- return parseList(ParsingContext.ClassMembers, parseClassElement);
+ return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(pos, hasJSDoc, modifiers) {
parseExpected(118 /* InterfaceKeyword */);
@@ -33194,7 +33654,7 @@ ${lanes.join("\n")}
const name = parseIdentifier();
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember));
+ members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(6 /* EnumMembers */, parseEnumMember));
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -33206,7 +33666,7 @@ ${lanes.join("\n")}
const pos = getNodePos();
let statements;
if (parseExpected(18 /* OpenBraceToken */)) {
- statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
} else {
statements = createMissingList();
@@ -33331,7 +33791,7 @@ ${lanes.join("\n")}
if (parseExpected(18 /* OpenBraceToken */)) {
const multiLine = scanner2.hasPrecedingLineBreak();
const elements = parseDelimitedList(
- ParsingContext.AssertEntries,
+ 24 /* AssertEntries */,
parseAssertEntry,
/*considerSemicolonAsDelimiter*/
true
@@ -33415,7 +33875,7 @@ ${lanes.join("\n")}
}
function parseNamedImportsOrExports(kind) {
const pos = getNodePos();
- const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
+ const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
return finishNode(node, pos);
}
function parseExportSpecifier() {
@@ -33591,7 +34051,7 @@ ${lanes.join("\n")}
/*isDeclarationFile*/
false,
[],
- factory2.createToken(1 /* EndOfFileToken */),
+ factoryCreateToken(1 /* EndOfFileToken */),
0 /* None */,
noop
);
@@ -34252,7 +34712,7 @@ ${lanes.join("\n")}
let node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
const name = parseJSDocIdentifierName();
- node = finishNode(factory2.createPropertyAccessExpression(node, name), pos);
+ node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
}
return node;
}
@@ -34543,7 +35003,7 @@ ${lanes.join("\n")}
const end2 = scanner2.getTextPos();
const originalKeywordKind = token();
const text = internIdentifier(scanner2.getTokenValue());
- const result = finishNode(factory2.createIdentifier(text, originalKeywordKind), pos, end2);
+ const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
nextTokenJSDoc();
return result;
}
@@ -34864,7 +35324,7 @@ ${lanes.join("\n")}
let currentArrayIndex = 0;
Debug.assert(currentArrayIndex < currentArray.length);
let current = currentArray[currentArrayIndex];
- let lastQueriedPosition = InvalidPosition.Value;
+ let lastQueriedPosition = -1 /* Value */;
return {
currentNode(position) {
if (position !== lastQueriedPosition) {
@@ -34883,7 +35343,7 @@ ${lanes.join("\n")}
};
function findHighestListElementThatStartsAtPosition(position) {
currentArray = void 0;
- currentArrayIndex = InvalidPosition.Value;
+ currentArrayIndex = -1 /* Value */;
current = void 0;
forEachChild(sourceFile, visitNode3, visitArray2);
return;
@@ -37740,7 +38200,7 @@ ${lanes.join("\n")}
{
name: "allowArbitraryExtensions",
type: "boolean",
- affectsModuleResolution: true,
+ affectsProgramStructure: true,
category: Diagnostics.Modules,
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
defaultValueDescription: false
@@ -38243,6 +38703,22 @@ ${lanes.join("\n")}
Debug.assert(extensionIsTS(resolved.extension));
return { fileName: resolved.path, packageId: resolved.packageId };
}
+ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
+ if (originalPath)
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
+ }
+ return createResolvedModuleWithFailedLookupLocations(
+ resolved,
+ isExternalLibraryImport,
+ failedLookupLocations,
+ affectingLocations,
+ diagnostics,
+ state.resultFromCache,
+ legacyResult
+ );
+ }
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
if (resultFromCache) {
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -38401,6 +38877,15 @@ ${lanes.join("\n")}
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
}
+ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ return {
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
+ originalPath: pathsAreEqual ? void 0 : fileName
+ };
+ }
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
const traceEnabled = isTraceEnabled(options, host);
@@ -38445,9 +38930,9 @@ ${lanes.join("\n")}
const affectingLocations = [];
let features = getNodeResolutionFeatures(options);
if (resolutionMode === 99 /* ESNext */ && (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */)) {
- features |= NodeResolutionFeatures.EsmMode;
+ features |= 32 /* EsmMode */;
}
- const conditions = features & NodeResolutionFeatures.Exports ? getConditions(options, !!(features & NodeResolutionFeatures.EsmMode)) : [];
+ const conditions = features & 8 /* Exports */ ? getConditions(options, !!(features & 32 /* EsmMode */)) : [];
const diagnostics = [];
const moduleResolutionState = {
compilerOptions: options,
@@ -38472,13 +38957,13 @@ ${lanes.join("\n")}
let resolvedTypeReferenceDirective;
if (resolved) {
const { fileName, packageId } = resolved;
- const resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ let resolvedFileName = fileName, originalPath;
+ if (!options.preserveSymlinks)
+ ({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
resolvedTypeReferenceDirective = {
primary,
- // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
- resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
- originalPath: pathsAreEqual ? void 0 : fileName,
+ resolvedFileName,
+ originalPath,
packageId,
isExternalLibraryImport: pathContainsNodeModules(fileName)
};
@@ -38580,35 +39065,38 @@ ${lanes.join("\n")}
}
}
function getNodeResolutionFeatures(options) {
- let features = NodeResolutionFeatures.None;
+ let features = 0 /* None */;
switch (getEmitModuleResolutionKind(options)) {
case 3 /* Node16 */:
- features = NodeResolutionFeatures.Node16Default;
+ features = 30 /* Node16Default */;
break;
case 99 /* NodeNext */:
- features = NodeResolutionFeatures.NodeNextDefault;
+ features = 30 /* NodeNextDefault */;
break;
case 100 /* Bundler */:
- features = NodeResolutionFeatures.BundlerDefault;
+ features = 30 /* BundlerDefault */;
break;
}
if (options.resolvePackageJsonExports) {
- features |= NodeResolutionFeatures.Exports;
+ features |= 8 /* Exports */;
} else if (options.resolvePackageJsonExports === false) {
- features &= ~NodeResolutionFeatures.Exports;
+ features &= ~8 /* Exports */;
}
if (options.resolvePackageJsonImports) {
- features |= NodeResolutionFeatures.Imports;
+ features |= 2 /* Imports */;
} else if (options.resolvePackageJsonImports === false) {
- features &= ~NodeResolutionFeatures.Imports;
+ features &= ~2 /* Imports */;
}
return features;
}
function getConditions(options, esmMode) {
- const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["node", "import"] : ["node", "require"];
+ const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
if (!options.noDtsResolution) {
conditions.push("types");
}
+ if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
+ conditions.push("node");
+ }
return concatenate(conditions, options.customConditions);
}
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
@@ -39322,7 +39810,7 @@ ${lanes.join("\n")}
isConfigLookup,
candidateIsFromPackageJsonField: false
};
- if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
+ if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
}
let result;
@@ -39348,13 +39836,14 @@ ${lanes.join("\n")}
legacyResult = diagnosticResult.value.resolved.path;
}
}
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache,
+ state,
legacyResult
);
function tryResolve(extensions2, state2) {
@@ -39384,16 +39873,7 @@ ${lanes.join("\n")}
}
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
}
- if (!resolved2)
- return void 0;
- let resolvedValue = resolved2.value;
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
- const path = realPath(resolvedValue.path, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
- }
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
} else {
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
const resolved2 = nodeLoadModuleByRelativeName(
@@ -39575,7 +40055,7 @@ ${lanes.join("\n")}
if (!onlyRecordFailures) {
if (state.host.fileExists(fileName)) {
if (state.traceEnabled) {
- trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
+ trace(state.host, Diagnostics.File_0_exists_use_it_as_a_name_resolution_result, fileName);
}
return fileName;
} else {
@@ -40170,18 +40650,24 @@ ${lanes.join("\n")}
)));
} else if (typeof target === "object" && target !== null) {
if (!Array.isArray(target)) {
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
for (const condition of getOwnKeys(target)) {
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
const subTarget = target[condition];
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
if (result) {
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return result;
+ } else {
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
}
} else {
traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
}
}
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return void 0;
} else {
if (!length(target)) {
@@ -40547,13 +41033,14 @@ ${lanes.join("\n")}
candidateIsFromPackageJsonField: false
};
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
resolved && resolved.value,
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache
+ state
);
function tryResolve(extensions) {
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -40809,35 +41296,36 @@ ${lanes.join("\n")}
measure("Bind", "beforeBind", "afterBind");
}
function createBinder() {
- let file;
- let options;
- let languageVersion;
- let parent2;
- let container;
- let thisParentContainer;
- let blockScopeContainer;
- let lastContainer;
- let delayedTypeAliases;
- let seenThisKeyword;
- let currentFlow;
- let currentBreakTarget;
- let currentContinueTarget;
- let currentReturnTarget;
- let currentTrueTarget;
- let currentFalseTarget;
- let currentExceptionTarget;
- let preSwitchCaseFlow;
- let activeLabelList;
- let hasExplicitReturn;
- let emitFlags;
- let inStrictMode;
- let inAssignmentPattern = false;
- let symbolCount = 0;
- let Symbol46;
- let classifiableNames;
- const unreachableFlow = { flags: 1 /* Unreachable */ };
- const reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
- const bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ var file;
+ var options;
+ var languageVersion;
+ var parent2;
+ var container;
+ var thisParentContainer;
+ var blockScopeContainer;
+ var lastContainer;
+ var delayedTypeAliases;
+ var seenThisKeyword;
+ var currentFlow;
+ var currentBreakTarget;
+ var currentContinueTarget;
+ var currentReturnTarget;
+ var currentTrueTarget;
+ var currentFalseTarget;
+ var currentExceptionTarget;
+ var preSwitchCaseFlow;
+ var activeLabelList;
+ var hasExplicitReturn;
+ var emitFlags;
+ var inStrictMode;
+ var inAssignmentPattern = false;
+ var symbolCount = 0;
+ var Symbol46;
+ var classifiableNames;
+ var unreachableFlow = { flags: 1 /* Unreachable */ };
+ var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
+ var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ return bindSourceFile2;
function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
}
@@ -40888,7 +41376,6 @@ ${lanes.join("\n")}
inAssignmentPattern = false;
emitFlags = 0 /* None */;
}
- return bindSourceFile2;
function bindInStrictMode(file2, opts) {
if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) {
return true;
@@ -43885,7 +44372,7 @@ ${lanes.join("\n")}
let redirectPathsSpecifiers;
let relativeSpecifiers;
for (const modulePath of modulePaths) {
- const specifier = tryGetModuleNameAsNodeModule(
+ const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
modulePath,
info,
importingSourceFile,
@@ -43895,7 +44382,7 @@ ${lanes.join("\n")}
/*packageNameOnly*/
void 0,
options.overrideImportMode
- );
+ ) : void 0;
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
if (specifier && modulePath.isRedirect) {
return nodeModulesSpecifiers;
@@ -44307,9 +44794,11 @@ ${lanes.join("\n")}
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
- if (getEmitModuleResolutionKind(options) === 3 /* Node16 */ || getEmitModuleResolutionKind(options) === 99 /* NodeNext */) {
- const conditions = ["node", importMode === 99 /* ESNext */ ? "import" : "require", "types"];
- const fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions) : void 0;
+ if (getResolvePackageJsonExports(options)) {
+ const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
+ const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
+ const conditions = getConditions(options, importMode === 99 /* ESNext */);
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
if (fromExports) {
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
return { ...withJsExtension, verbatimFromExports: true };
@@ -44503,8 +44992,8 @@ ${lanes.join("\n")}
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
}
function createTypeChecker(host) {
- const getPackagesMap = memoize(() => {
- const map2 = /* @__PURE__ */ new Map();
+ var getPackagesMap = memoize(() => {
+ var map2 = /* @__PURE__ */ new Map();
host.getSourceFiles().forEach((sf) => {
if (!sf.resolvedModules)
return;
@@ -44515,57 +45004,58 @@ ${lanes.join("\n")}
});
return map2;
});
- let deferredDiagnosticsCallbacks = [];
- let addLazyDiagnostic = (arg) => {
+ var deferredDiagnosticsCallbacks = [];
+ var addLazyDiagnostic = (arg) => {
deferredDiagnosticsCallbacks.push(arg);
};
- let cancellationToken;
- const requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
- let requestedExternalEmitHelpers;
- let externalHelpersModule;
- const Symbol46 = objectAllocator.getSymbolConstructor();
- const Type27 = objectAllocator.getTypeConstructor();
- const Signature15 = objectAllocator.getSignatureConstructor();
- let typeCount = 0;
- let symbolCount = 0;
- let totalInstantiationCount = 0;
- let instantiationCount = 0;
- let instantiationDepth = 0;
- let inlineLevel = 0;
- let currentNode;
- let varianceTypeParameter;
- const emptySymbols = createSymbolTable();
- const arrayVariances = [1 /* Covariant */];
- const compilerOptions = host.getCompilerOptions();
- const languageVersion = getEmitScriptTarget(compilerOptions);
- const moduleKind = getEmitModuleKind(compilerOptions);
- const legacyDecorators = !!compilerOptions.experimentalDecorators;
- const useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
- const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
- const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
- const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
- const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
- const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
- const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
- const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
- const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
- const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
- const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
- const exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
- const checkBinaryExpression = createCheckBinaryExpression();
- const emitResolver = createResolver();
- const nodeBuilder = createNodeBuilder();
- const globals = createSymbolTable();
- const undefinedSymbol = createSymbol(4 /* Property */, "undefined");
+ var cancellationToken;
+ var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set();
+ var requestedExternalEmitHelpers;
+ var externalHelpersModule;
+ var Symbol46 = objectAllocator.getSymbolConstructor();
+ var Type27 = objectAllocator.getTypeConstructor();
+ var Signature15 = objectAllocator.getSignatureConstructor();
+ var typeCount = 0;
+ var symbolCount = 0;
+ var totalInstantiationCount = 0;
+ var instantiationCount = 0;
+ var instantiationDepth = 0;
+ var inlineLevel = 0;
+ var currentNode;
+ var varianceTypeParameter;
+ var isInferencePartiallyBlocked = false;
+ var emptySymbols = createSymbolTable();
+ var arrayVariances = [1 /* Covariant */];
+ var compilerOptions = host.getCompilerOptions();
+ var languageVersion = getEmitScriptTarget(compilerOptions);
+ var moduleKind = getEmitModuleKind(compilerOptions);
+ var legacyDecorators = !!compilerOptions.experimentalDecorators;
+ var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
+ var allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
+ var strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
+ var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
+ var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
+ var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
+ var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
+ var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
+ var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
+ var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
+ var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
+ var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
+ var checkBinaryExpression = createCheckBinaryExpression();
+ var emitResolver = createResolver();
+ var nodeBuilder = createNodeBuilder();
+ var globals = createSymbolTable();
+ var undefinedSymbol = createSymbol(4 /* Property */, "undefined");
undefinedSymbol.declarations = [];
- const globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
+ var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
globalThisSymbol.declarations = [];
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
- const argumentsSymbol = createSymbol(4 /* Property */, "arguments");
- const requireSymbol = createSymbol(4 /* Property */, "require");
- const isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
- let apparentArgumentCount;
+ var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
+ var requireSymbol = createSymbol(4 /* Property */, "require");
+ var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
+ var apparentArgumentCount;
const checker = {
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -44743,15 +45233,14 @@ ${lanes.join("\n")}
getTypeOfPropertyOfContextualType,
getFullyQualifiedName,
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
- getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
+ getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
call,
candidatesOutArray,
/*argumentCount*/
void 0,
- 32 /* IsForStringLiteralArgumentCompletions */,
- editingArgument
- ),
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
+ 32 /* IsForStringLiteralArgumentCompletions */
+ )),
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
getExpandedParameters,
hasEffectiveRestParameter,
containsArgumentsReference,
@@ -44856,6 +45345,7 @@ ${lanes.join("\n")}
isArrayType,
isTupleType,
isArrayLikeType,
+ isEmptyAnonymousObjectType,
isTypeInvalidDueToUnionDiscriminant,
getExactOptionalProperties,
getAllPossiblePropertiesOfTypes,
@@ -44942,81 +45432,93 @@ ${lanes.join("\n")}
isPropertyAccessible,
getTypeOnlyAliasDeclaration,
getMemberOverrideModifierStatus,
- isTypeParameterPossiblyReferenced
+ isTypeParameterPossiblyReferenced,
+ typeHasCallOrConstructSignatures
};
- function runWithInferenceBlockedFromSourceNode(node, fn) {
+ function runWithoutResolvedSignatureCaching(node, fn) {
const containingCall = findAncestor(node, isCallLikeExpression);
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = void 0;
+ }
+ const result = fn();
+ if (containingCall) {
+ getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
+ }
+ return result;
+ }
+ function runWithInferenceBlockedFromSourceNode(node, fn) {
+ const containingCall = findAncestor(node, isCallLikeExpression);
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = true;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = void 0;
}
- const result = fn();
+ isInferencePartiallyBlocked = true;
+ const result = runWithoutResolvedSignatureCaching(node, fn);
+ isInferencePartiallyBlocked = false;
if (containingCall) {
let toMarkSkip = node;
do {
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
toMarkSkip = toMarkSkip.parent;
} while (toMarkSkip && toMarkSkip !== containingCall);
- getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
}
return result;
}
- function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
+ function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
apparentArgumentCount = argumentCount;
- const res = !node ? void 0 : editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignature(node, candidatesOutArray, checkMode)) : getResolvedSignature(node, candidatesOutArray, checkMode);
+ const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
apparentArgumentCount = void 0;
return res;
}
- const tupleTypes = /* @__PURE__ */ new Map();
- const unionTypes = /* @__PURE__ */ new Map();
- const intersectionTypes = /* @__PURE__ */ new Map();
- const stringLiteralTypes = /* @__PURE__ */ new Map();
- const numberLiteralTypes = /* @__PURE__ */ new Map();
- const bigIntLiteralTypes = /* @__PURE__ */ new Map();
- const enumLiteralTypes = /* @__PURE__ */ new Map();
- const indexedAccessTypes = /* @__PURE__ */ new Map();
- const templateLiteralTypes = /* @__PURE__ */ new Map();
- const stringMappingTypes = /* @__PURE__ */ new Map();
- const substitutionTypes = /* @__PURE__ */ new Map();
- const subtypeReductionCache = /* @__PURE__ */ new Map();
- const decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
- const cachedTypes = /* @__PURE__ */ new Map();
- const evolvingArrayTypes = [];
- const undefinedProperties = /* @__PURE__ */ new Map();
- const markerTypes = /* @__PURE__ */ new Set();
- const unknownSymbol = createSymbol(4 /* Property */, "unknown");
- const resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
- const unresolvedSymbols = /* @__PURE__ */ new Map();
- const errorTypes = /* @__PURE__ */ new Map();
- const anyType = createIntrinsicType(1 /* Any */, "any");
- const autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
- const wildcardType = createIntrinsicType(1 /* Any */, "any");
- const errorType = createIntrinsicType(1 /* Any */, "error");
- const unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
- const nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
- const intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
- const unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
- const undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
- const missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
- const optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
- const nullType = createIntrinsicType(65536 /* Null */, "null");
- const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
- const stringType = createIntrinsicType(4 /* String */, "string");
- const numberType = createIntrinsicType(8 /* Number */, "number");
- const bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
- const falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
- const trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
- const regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var tupleTypes = /* @__PURE__ */ new Map();
+ var unionTypes = /* @__PURE__ */ new Map();
+ var intersectionTypes = /* @__PURE__ */ new Map();
+ var stringLiteralTypes = /* @__PURE__ */ new Map();
+ var numberLiteralTypes = /* @__PURE__ */ new Map();
+ var bigIntLiteralTypes = /* @__PURE__ */ new Map();
+ var enumLiteralTypes = /* @__PURE__ */ new Map();
+ var indexedAccessTypes = /* @__PURE__ */ new Map();
+ var templateLiteralTypes = /* @__PURE__ */ new Map();
+ var stringMappingTypes = /* @__PURE__ */ new Map();
+ var substitutionTypes = /* @__PURE__ */ new Map();
+ var subtypeReductionCache = /* @__PURE__ */ new Map();
+ var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
+ var cachedTypes = /* @__PURE__ */ new Map();
+ var evolvingArrayTypes = [];
+ var undefinedProperties = /* @__PURE__ */ new Map();
+ var markerTypes = /* @__PURE__ */ new Set();
+ var unknownSymbol = createSymbol(4 /* Property */, "unknown");
+ var resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
+ var unresolvedSymbols = /* @__PURE__ */ new Map();
+ var errorTypes = /* @__PURE__ */ new Map();
+ var anyType = createIntrinsicType(1 /* Any */, "any");
+ var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
+ var wildcardType = createIntrinsicType(1 /* Any */, "any");
+ var errorType = createIntrinsicType(1 /* Any */, "error");
+ var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
+ var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
+ var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
+ var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
+ var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
+ var missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
+ var optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
+ var nullType = createIntrinsicType(65536 /* Null */, "null");
+ var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
+ var stringType = createIntrinsicType(4 /* String */, "string");
+ var numberType = createIntrinsicType(8 /* Number */, "number");
+ var bigintType = createIntrinsicType(64 /* BigInt */, "bigint");
+ var falseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false");
+ var trueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
+ var regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true");
trueType.regularType = regularTrueType;
trueType.freshType = trueType;
regularTrueType.regularType = regularTrueType;
@@ -45025,26 +45527,26 @@ ${lanes.join("\n")}
falseType.freshType = falseType;
regularFalseType.regularType = regularFalseType;
regularFalseType.freshType = falseType;
- const booleanType = getUnionType([regularFalseType, regularTrueType]);
- const esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
- const voidType = createIntrinsicType(16384 /* Void */, "void");
- const neverType = createIntrinsicType(131072 /* Never */, "never");
- const silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
- const implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
- const unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
- const nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
- const stringOrNumberType = getUnionType([stringType, numberType]);
- const stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
- const keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
- const numberOrBigIntType = getUnionType([numberType, bigintType]);
- const templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
- const numericStringType = getTemplateLiteralType(["", ""], [numberType]);
- const restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
- const permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
- const uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
- const uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
- let outofbandVarianceMarkerHandler;
- const reportUnreliableMapper = makeFunctionTypeMapper((t) => {
+ var booleanType = getUnionType([regularFalseType, regularTrueType]);
+ var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
+ var voidType = createIntrinsicType(16384 /* Void */, "void");
+ var neverType = createIntrinsicType(131072 /* Never */, "never");
+ var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
+ var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
+ var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
+ var stringOrNumberType = getUnionType([stringType, numberType]);
+ var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]);
+ var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
+ var numberOrBigIntType = getUnionType([numberType, bigintType]);
+ var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
+ var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
+ var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
+ var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never");
+ var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)");
+ var outofbandVarianceMarkerHandler;
+ var reportUnreliableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -45053,7 +45555,7 @@ ${lanes.join("\n")}
}
return t;
}, () => "(unmeasurable reporter)");
- const reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
+ var reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
outofbandVarianceMarkerHandler(
/*onlyUnreliable*/
@@ -45062,30 +45564,30 @@ ${lanes.join("\n")}
}
return t;
}, () => "(unreliable reporter)");
- const emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
- const emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
+ var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
emptyTypeLiteralSymbol.members = createSymbolTable();
- const emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
- const emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
+ var emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
emptyGenericType.instantiations = /* @__PURE__ */ new Map();
- const anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
anyFunctionType.objectFlags |= 262144 /* NonInferrableType */;
- const noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
- const markerSuperType = createTypeParameter();
- const markerSubType = createTypeParameter();
+ var noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray);
+ var markerSuperType = createTypeParameter();
+ var markerSubType = createTypeParameter();
markerSubType.constraint = markerSuperType;
- const markerOtherType = createTypeParameter();
- const markerSuperTypeForCheck = createTypeParameter();
- const markerSubTypeForCheck = createTypeParameter();
+ var markerOtherType = createTypeParameter();
+ var markerSuperTypeForCheck = createTypeParameter();
+ var markerSubTypeForCheck = createTypeParameter();
markerSubTypeForCheck.constraint = markerSuperTypeForCheck;
- const noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
- const anySignature = createSignature(
+ var noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType);
+ var anySignature = createSignature(
void 0,
void 0,
void 0,
@@ -45096,7 +45598,7 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const unknownSignature = createSignature(
+ var unknownSignature = createSignature(
void 0,
void 0,
void 0,
@@ -45107,7 +45609,7 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const resolvingSignature = createSignature(
+ var resolvingSignature = createSignature(
void 0,
void 0,
void 0,
@@ -45118,7 +45620,7 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const silentNeverSignature = createSignature(
+ var silentNeverSignature = createSignature(
void 0,
void 0,
void 0,
@@ -45129,14 +45631,14 @@ ${lanes.join("\n")}
0,
0 /* None */
);
- const enumNumberIndexInfo = createIndexInfo(
+ var enumNumberIndexInfo = createIndexInfo(
numberType,
stringType,
/*isReadonly*/
true
);
- const iterationTypesCache = /* @__PURE__ */ new Map();
- const noIterationTypes = {
+ var iterationTypesCache = /* @__PURE__ */ new Map();
+ var noIterationTypes = {
get yieldType() {
return Debug.fail("Not supported");
},
@@ -45147,10 +45649,10 @@ ${lanes.join("\n")}
return Debug.fail("Not supported");
}
};
- const anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
- const anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
- const defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
- const asyncIterationTypesResolver = {
+ var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
+ var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
+ var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
+ var asyncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfAsyncIterable",
iteratorCacheKey: "iterationTypesOfAsyncIterator",
iteratorSymbolName: "asyncIterator",
@@ -45163,7 +45665,7 @@ ${lanes.join("\n")}
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property
};
- const syncIterationTypesResolver = {
+ var syncIterationTypesResolver = {
iterableCacheKey: "iterationTypesOfIterable",
iteratorCacheKey: "iterationTypesOfIterator",
iteratorSymbolName: "iterator",
@@ -45176,117 +45678,118 @@ ${lanes.join("\n")}
mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_iterator_must_be_a_method,
mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property
};
- let amalgamatedDuplicates;
- const reverseMappedCache = /* @__PURE__ */ new Map();
- let inInferTypeForHomomorphicMappedType = false;
- let ambientModulesCache;
- let patternAmbientModules;
- let patternAmbientModuleAugmentations;
- let globalObjectType;
- let globalFunctionType;
- let globalCallableFunctionType;
- let globalNewableFunctionType;
- let globalArrayType;
- let globalReadonlyArrayType;
- let globalStringType;
- let globalNumberType;
- let globalBooleanType;
- let globalRegExpType;
- let globalThisType;
- let anyArrayType;
- let autoArrayType;
- let anyReadonlyArrayType;
- let deferredGlobalNonNullableTypeAlias;
- let deferredGlobalESSymbolConstructorSymbol;
- let deferredGlobalESSymbolConstructorTypeSymbol;
- let deferredGlobalESSymbolType;
- let deferredGlobalTypedPropertyDescriptorType;
- let deferredGlobalPromiseType;
- let deferredGlobalPromiseLikeType;
- let deferredGlobalPromiseConstructorSymbol;
- let deferredGlobalPromiseConstructorLikeType;
- let deferredGlobalIterableType;
- let deferredGlobalIteratorType;
- let deferredGlobalIterableIteratorType;
- let deferredGlobalGeneratorType;
- let deferredGlobalIteratorYieldResultType;
- let deferredGlobalIteratorReturnResultType;
- let deferredGlobalAsyncIterableType;
- let deferredGlobalAsyncIteratorType;
- let deferredGlobalAsyncIterableIteratorType;
- let deferredGlobalAsyncGeneratorType;
- let deferredGlobalTemplateStringsArrayType;
- let deferredGlobalImportMetaType;
- let deferredGlobalImportMetaExpressionType;
- let deferredGlobalImportCallOptionsType;
- let deferredGlobalExtractSymbol;
- let deferredGlobalOmitSymbol;
- let deferredGlobalAwaitedSymbol;
- let deferredGlobalBigIntType;
- let deferredGlobalNaNSymbol;
- let deferredGlobalRecordSymbol;
- let deferredGlobalClassDecoratorContextType;
- let deferredGlobalClassMethodDecoratorContextType;
- let deferredGlobalClassGetterDecoratorContextType;
- let deferredGlobalClassSetterDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorContextType;
- let deferredGlobalClassAccessorDecoratorTargetType;
- let deferredGlobalClassAccessorDecoratorResultType;
- let deferredGlobalClassFieldDecoratorContextType;
- const allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
- let flowLoopStart = 0;
- let flowLoopCount = 0;
- let sharedFlowCount = 0;
- let flowAnalysisDisabled = false;
- let flowInvocationCount = 0;
- let lastFlowNode;
- let lastFlowNodeReachable;
- let flowTypeCache;
- const contextualTypeNodes = [];
- const contextualTypes = [];
- let contextualTypeCount = 0;
- const inferenceContextNodes = [];
- const inferenceContexts = [];
- let inferenceContextCount = 0;
- const emptyStringType = getStringLiteralType("");
- const zeroType = getNumberLiteralType(0);
- const zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
- const resolutionTargets = [];
- const resolutionResults = [];
- const resolutionPropertyNames = [];
- let suggestionCount = 0;
- const maximumSuggestionCount = 10;
- const mergedSymbols = [];
- const symbolLinks = [];
- const nodeLinks = [];
- const flowLoopCaches = [];
- const flowLoopNodes = [];
- const flowLoopKeys = [];
- const flowLoopTypes = [];
- const sharedFlowNodes = [];
- const sharedFlowTypes = [];
- const flowNodeReachable = [];
- const flowNodePostSuper = [];
- const potentialThisCollisions = [];
- const potentialNewTargetCollisions = [];
- const potentialWeakMapSetCollisions = [];
- const potentialReflectCollisions = [];
- const potentialUnusedRenamedBindingElementsInTypes = [];
- const awaitedTypeStack = [];
- const diagnostics = createDiagnosticCollection();
- const suggestionDiagnostics = createDiagnosticCollection();
- const typeofType = createTypeofType();
- let _jsxNamespace;
- let _jsxFactoryEntity;
- const subtypeRelation = /* @__PURE__ */ new Map();
- const strictSubtypeRelation = /* @__PURE__ */ new Map();
- const assignableRelation = /* @__PURE__ */ new Map();
- const comparableRelation = /* @__PURE__ */ new Map();
- const identityRelation = /* @__PURE__ */ new Map();
- const enumRelation = /* @__PURE__ */ new Map();
- const builtinGlobals = createSymbolTable();
+ var amalgamatedDuplicates;
+ var reverseMappedCache = /* @__PURE__ */ new Map();
+ var inInferTypeForHomomorphicMappedType = false;
+ var ambientModulesCache;
+ var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
+ var globalObjectType;
+ var globalFunctionType;
+ var globalCallableFunctionType;
+ var globalNewableFunctionType;
+ var globalArrayType;
+ var globalReadonlyArrayType;
+ var globalStringType;
+ var globalNumberType;
+ var globalBooleanType;
+ var globalRegExpType;
+ var globalThisType;
+ var anyArrayType;
+ var autoArrayType;
+ var anyReadonlyArrayType;
+ var deferredGlobalNonNullableTypeAlias;
+ var deferredGlobalESSymbolConstructorSymbol;
+ var deferredGlobalESSymbolConstructorTypeSymbol;
+ var deferredGlobalESSymbolType;
+ var deferredGlobalTypedPropertyDescriptorType;
+ var deferredGlobalPromiseType;
+ var deferredGlobalPromiseLikeType;
+ var deferredGlobalPromiseConstructorSymbol;
+ var deferredGlobalPromiseConstructorLikeType;
+ var deferredGlobalIterableType;
+ var deferredGlobalIteratorType;
+ var deferredGlobalIterableIteratorType;
+ var deferredGlobalGeneratorType;
+ var deferredGlobalIteratorYieldResultType;
+ var deferredGlobalIteratorReturnResultType;
+ var deferredGlobalAsyncIterableType;
+ var deferredGlobalAsyncIteratorType;
+ var deferredGlobalAsyncIterableIteratorType;
+ var deferredGlobalAsyncGeneratorType;
+ var deferredGlobalTemplateStringsArrayType;
+ var deferredGlobalImportMetaType;
+ var deferredGlobalImportMetaExpressionType;
+ var deferredGlobalImportCallOptionsType;
+ var deferredGlobalExtractSymbol;
+ var deferredGlobalOmitSymbol;
+ var deferredGlobalAwaitedSymbol;
+ var deferredGlobalBigIntType;
+ var deferredGlobalNaNSymbol;
+ var deferredGlobalRecordSymbol;
+ var deferredGlobalClassDecoratorContextType;
+ var deferredGlobalClassMethodDecoratorContextType;
+ var deferredGlobalClassGetterDecoratorContextType;
+ var deferredGlobalClassSetterDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorContextType;
+ var deferredGlobalClassAccessorDecoratorTargetType;
+ var deferredGlobalClassAccessorDecoratorResultType;
+ var deferredGlobalClassFieldDecoratorContextType;
+ var allPotentiallyUnusedIdentifiers = /* @__PURE__ */ new Map();
+ var flowLoopStart = 0;
+ var flowLoopCount = 0;
+ var sharedFlowCount = 0;
+ var flowAnalysisDisabled = false;
+ var flowInvocationCount = 0;
+ var lastFlowNode;
+ var lastFlowNodeReachable;
+ var flowTypeCache;
+ var contextualTypeNodes = [];
+ var contextualTypes = [];
+ var contextualIsCache = [];
+ var contextualTypeCount = 0;
+ var inferenceContextNodes = [];
+ var inferenceContexts = [];
+ var inferenceContextCount = 0;
+ var emptyStringType = getStringLiteralType("");
+ var zeroType = getNumberLiteralType(0);
+ var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
+ var resolutionTargets = [];
+ var resolutionResults = [];
+ var resolutionPropertyNames = [];
+ var suggestionCount = 0;
+ var maximumSuggestionCount = 10;
+ var mergedSymbols = [];
+ var symbolLinks = [];
+ var nodeLinks = [];
+ var flowLoopCaches = [];
+ var flowLoopNodes = [];
+ var flowLoopKeys = [];
+ var flowLoopTypes = [];
+ var sharedFlowNodes = [];
+ var sharedFlowTypes = [];
+ var flowNodeReachable = [];
+ var flowNodePostSuper = [];
+ var potentialThisCollisions = [];
+ var potentialNewTargetCollisions = [];
+ var potentialWeakMapSetCollisions = [];
+ var potentialReflectCollisions = [];
+ var potentialUnusedRenamedBindingElementsInTypes = [];
+ var awaitedTypeStack = [];
+ var diagnostics = createDiagnosticCollection();
+ var suggestionDiagnostics = createDiagnosticCollection();
+ var typeofType = createTypeofType();
+ var _jsxNamespace;
+ var _jsxFactoryEntity;
+ var subtypeRelation = /* @__PURE__ */ new Map();
+ var strictSubtypeRelation = /* @__PURE__ */ new Map();
+ var assignableRelation = /* @__PURE__ */ new Map();
+ var comparableRelation = /* @__PURE__ */ new Map();
+ var identityRelation = /* @__PURE__ */ new Map();
+ var enumRelation = /* @__PURE__ */ new Map();
+ var builtinGlobals = createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
- const suggestedExtensions = [
+ var suggestedExtensions = [
[".mts", ".mjs"],
[".ts", ".js"],
[".cts", ".cjs"],
@@ -46678,7 +47181,12 @@ ${lanes.join("\n")}
}
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
- const exportSymbol = exportValue ? getPropertyOfType(getTypeOfSymbol(exportValue), name) : moduleSymbol.exports.get(name);
+ const exportSymbol = exportValue ? getPropertyOfType(
+ getTypeOfSymbol(exportValue),
+ name,
+ /*skipObjectFunctionPropertyAugment*/
+ true
+ ) : moduleSymbol.exports.get(name);
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
markSymbolOfAliasDeclarationIfTypeOnly(
sourceNode,
@@ -47713,12 +48221,9 @@ ${lanes.join("\n")}
if (resolutionDiagnostic) {
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
} else {
- const tsExtension = tryExtractTSExtension(moduleReference);
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
- if (tsExtension) {
- errorOnTSExtensionImport(tsExtension);
- } else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
+ if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
@@ -47738,14 +48243,12 @@ ${lanes.join("\n")}
}
}
return void 0;
- function errorOnTSExtensionImport(tsExtension) {
- const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
- error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
- }
function getSuggestedImportSource(tsExtension) {
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
- return importSourceWithoutExtension + (tsExtension === ".mts" /* Mts */ ? ".mjs" : tsExtension === ".cts" /* Cts */ ? ".cjs" : ".js");
+ const preferTs = isDeclarationFileName(moduleReference) && shouldAllowImportingTsExtension(compilerOptions);
+ const ext = tsExtension === ".mts" /* Mts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".mts" : ".mjs" : tsExtension === ".cts" /* Cts */ || tsExtension === ".d.mts" /* Dmts */ ? preferTs ? ".cts" : ".cjs" : preferTs ? ".ts" : ".js";
+ return importSourceWithoutExtension + ext;
}
return importSourceWithoutExtension;
}
@@ -47932,7 +48435,7 @@ ${lanes.join("\n")}
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
}
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
- return !(resolvedExternalModuleType.flags & 131068 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
+ return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
}
function getExportsOfSymbol(symbol) {
@@ -49231,7 +49734,7 @@ ${lanes.join("\n")}
return result;
}
function createAnonymousTypeNode(type2) {
- var _a3;
+ var _a3, _b2;
const typeId = type2.id;
const symbol = type2.symbol;
if (symbol) {
@@ -49257,6 +49760,20 @@ ${lanes.join("\n")}
return visitAndTransformType(type2, createTypeNodeFromObjectType);
}
} else {
+ const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
+ if (isInstantiationExpressionType) {
+ const instantiationExpressionType = type2;
+ if (isTypeQueryNode(instantiationExpressionType.node)) {
+ const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
+ if (typeNode) {
+ return typeNode;
+ }
+ }
+ if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
+ return createElidedInformationPlaceholder(context);
+ }
+ return visitAndTransformType(type2, createTypeNodeFromObjectType);
+ }
return createTypeNodeFromObjectType(type2);
}
function shouldWriteTypeOfFunctionSymbol() {
@@ -49765,7 +50282,7 @@ ${lanes.join("\n")}
);
}
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
- var _a2, _b, _c, _d;
+ var _a2, _b, _c, _d, _e;
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
if (suppressAny)
context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -49782,6 +50299,39 @@ ${lanes.join("\n")}
/*skipUnionExpanding*/
true
)[0];
+ let cleanup;
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
+ const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
+ const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
+ let newLocals;
+ for (const param of expandedParams) {
+ if (!locals.has(param.escapedName)) {
+ newLocals = append(newLocals, param.escapedName);
+ locals.set(param.escapedName, param);
+ }
+ }
+ if (newLocals) {
+ let removeNewLocals2 = function() {
+ forEach(newLocals, (s) => locals.delete(s));
+ };
+ var removeNewLocals = removeNewLocals2;
+ if (existingFakeScope) {
+ cleanup = removeNewLocals2;
+ } else {
+ const fakeScope = parseNodeFactory.createBlock(emptyArray);
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
+ fakeScope.locals = locals;
+ const saveEnclosingDeclaration = context.enclosingDeclaration;
+ setParent(fakeScope, saveEnclosingDeclaration);
+ context.enclosingDeclaration = fakeScope;
+ cleanup = () => {
+ context.enclosingDeclaration = saveEnclosingDeclaration;
+ removeNewLocals2();
+ };
+ }
+ }
+ }
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
if (thisParameter) {
@@ -49807,11 +50357,11 @@ ${lanes.join("\n")}
const flags = modifiersToFlags(modifiers);
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
}
- const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_a2 = options == null ? void 0 : options.name) != null ? _a2 : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
+ const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
modifiers,
/*asteriskToken*/
void 0,
- (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""),
+ (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
/*questionToken*/
void 0,
typeParameters,
@@ -49826,14 +50376,14 @@ ${lanes.join("\n")}
void 0
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
modifiers,
- (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
+ (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
parameters,
returnTypeNode,
/*body*/
void 0
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
modifiers,
- (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
+ (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
parameters,
/*body*/
void 0
@@ -49868,13 +50418,14 @@ ${lanes.join("\n")}
if (typeArguments) {
node.typeArguments = factory.createNodeArray(typeArguments);
}
+ cleanup == null ? void 0 : cleanup();
return node;
}
function tryGetThisParameterDeclaration(signature, context) {
if (signature.thisParameter) {
return symbolToParameterDeclaration(signature.thisParameter, context);
}
- if (signature.declaration) {
+ if (signature.declaration && isInJSFile(signature.declaration)) {
const thisTag = getJSDocThisTag(signature.declaration);
if (thisTag && thisTag.typeExpression) {
return factory.createParameterDeclaration(
@@ -50482,9 +51033,12 @@ ${lanes.join("\n")}
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
}
+ function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
+ return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
+ }
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
if (!isErrorType(type) && enclosingDeclaration) {
- const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
+ const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
@@ -50516,7 +51070,8 @@ ${lanes.join("\n")}
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
if (!isErrorType(type) && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
- if (!!findAncestor(annotation, (n) => n === context.enclosingDeclaration) && annotation) {
+ const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
+ if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
const annotated = getTypeFromTypeNode(annotation);
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
@@ -52131,8 +52686,8 @@ ${lanes.join("\n")}
const t = types[i];
flags |= t.flags;
if (!(t.flags & 98304 /* Nullable */)) {
- if (t.flags & (512 /* BooleanLiteral */ | 1024 /* EnumLiteral */)) {
- const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLiteralType(t);
+ if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
+ const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
if (baseType.flags & 1048576 /* Union */) {
const count = baseType.types.length;
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
@@ -52387,7 +52942,7 @@ ${lanes.join("\n")}
}
function findResolutionCycleStartIndex(target, propertyName) {
for (let i = resolutionTargets.length - 1; i >= 0; i--) {
- if (hasType2(resolutionTargets[i], resolutionPropertyNames[i])) {
+ if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) {
return -1;
}
if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) {
@@ -52396,7 +52951,7 @@ ${lanes.join("\n")}
}
return -1;
}
- function hasType2(target, propertyName) {
+ function resolutionTargetHasProperty(target, propertyName) {
switch (propertyName) {
case 0 /* Type */:
return !!getSymbolLinks(target).type;
@@ -52416,6 +52971,8 @@ ${lanes.join("\n")}
return !!target.baseTypesResolved;
case 8 /* WriteType */:
return !!getSymbolLinks(target).writeType;
+ case 9 /* ParameterInitializerContainsUndefined */:
+ return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
}
return Debug.assertNever(propertyName);
}
@@ -52855,7 +53412,7 @@ ${lanes.join("\n")}
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
if (container) {
- const tag = getJSDocTypeTag(container);
+ const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
if (tag && tag.typeExpression) {
return getTypeFromTypeNode(tag.typeExpression);
}
@@ -54007,8 +54564,8 @@ ${lanes.join("\n")}
}
return links.declaredType;
}
- function getBaseTypeOfEnumLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */) ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
+ function getBaseTypeOfEnumLikeType(type) {
+ return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
}
function getDeclaredTypeOfEnum(symbol) {
const links = getSymbolLinks(symbol);
@@ -54021,7 +54578,7 @@ ${lanes.join("\n")}
if (hasBindableName(member)) {
const memberSymbol = getSymbolOfDeclaration(member);
const value = getEnumMemberValue(member);
- const memberType = value !== void 0 ? getFreshTypeOfLiteralType(getEnumLiteralType(value, getSymbolId(symbol), memberSymbol)) : createTypeWithSymbol(32 /* Enum */, memberSymbol);
+ const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
getSymbolLinks(memberSymbol).declaredType = memberType;
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
}
@@ -54035,7 +54592,7 @@ ${lanes.join("\n")}
symbol,
/*aliasTypeArguments*/
void 0
- ) : createTypeWithSymbol(32 /* Enum */, symbol);
+ ) : createComputedEnumType(symbol);
if (enumType.flags & 1048576 /* Union */) {
enumType.flags |= 1024 /* EnumLiteral */;
enumType.symbol = symbol;
@@ -54044,6 +54601,15 @@ ${lanes.join("\n")}
}
return links.declaredType;
}
+ function createComputedEnumType(symbol) {
+ const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
+ const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
+ regularType.regularType = regularType;
+ regularType.freshType = freshType;
+ freshType.regularType = regularType;
+ freshType.freshType = freshType;
+ return regularType;
+ }
function getDeclaredTypeOfEnumMember(symbol) {
const links = getSymbolLinks(symbol);
if (!links.declaredType) {
@@ -54992,6 +55558,7 @@ ${lanes.join("\n")}
const typeParameter = getTypeParameterFromMappedType(type);
const constraintType = getConstraintTypeFromMappedType(type);
const nameType = getNameTypeFromMappedType(type.target || type);
+ const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
const templateType = getTemplateTypeFromMappedType(type.target || type);
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
const templateModifiers = getMappedTypeModifiers(type);
@@ -55029,7 +55596,7 @@ ${lanes.join("\n")}
prop.links.keyType = keyType;
if (modifiersProp) {
prop.links.syntheticOrigin = modifiersProp;
- prop.declarations = nameType ? void 0 : modifiersProp.declarations;
+ prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
}
members.set(propName, prop);
}
@@ -55973,6 +56540,12 @@ ${lanes.join("\n")}
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
+ if (isInJSFile(declaration)) {
+ const thisTag = getJSDocThisTag(declaration);
+ if (thisTag && thisTag.typeExpression) {
+ thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
+ }
+ }
const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0;
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
@@ -56086,7 +56659,11 @@ ${lanes.join("\n")}
if (node.tags) {
for (const tag of node.tags) {
if (isJSDocOverloadTag(tag)) {
- result.push(getSignatureFromDeclaration(tag.typeExpression));
+ const jsDocSignature = tag.typeExpression;
+ if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
+ reportImplicitAny(jsDocSignature, anyType);
+ }
+ result.push(getSignatureFromDeclaration(jsDocSignature));
hasJSDocOverloads = true;
}
}
@@ -56195,6 +56772,12 @@ ${lanes.join("\n")}
if (declaration.kind === 173 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
+ if (isJSDocSignature(declaration)) {
+ const root = getJSDocRoot(declaration);
+ if (root && isConstructorDeclaration(root.parent)) {
+ return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
+ }
+ }
if (isJSDocConstructSignature(declaration)) {
return getTypeFromTypeNode(declaration.parameters[0].type);
}
@@ -56373,7 +56956,7 @@ ${lanes.join("\n")}
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
if (grandParent.kind === 180 /* TypeReference */ && !omitTypeReferences) {
const typeReference = grandParent;
- const typeParameters = getTypeParametersForTypeReference(typeReference);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReference);
if (typeParameters) {
const index = typeReference.typeArguments.indexOf(childTypeParameter);
if (index < typeParameters.length) {
@@ -56723,7 +57306,7 @@ ${lanes.join("\n")}
return links.resolvedJSDocType;
}
function getSubstitutionType(baseType, constraint) {
- if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
return baseType;
}
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
@@ -57666,7 +58249,7 @@ ${lanes.join("\n")}
}
}
function removeStringLiteralsMatchedByTemplateLiterals(types) {
- const templates = filter(types, isPatternLiteralType);
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
if (templates.length) {
let i = types.length;
while (i > 0) {
@@ -57716,7 +58299,7 @@ ${lanes.join("\n")}
orderedRemoveItemAt(typeSet, 1);
}
}
- if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
+ if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
}
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
@@ -57785,7 +58368,7 @@ ${lanes.join("\n")}
function typePredicateKindsMatch(a, b) {
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
}
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
+ function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
if (types.length === 0) {
return neverType;
}
@@ -57797,7 +58380,7 @@ ${lanes.join("\n")}
let type = unionTypes.get(id);
if (!type) {
type = createType(1048576 /* Union */);
- type.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
+ type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
types,
/*excludeKinds*/
98304 /* Nullable */
@@ -57847,7 +58430,7 @@ ${lanes.join("\n")}
type = undefinedType;
}
if (!typeSet.has(type.id.toString())) {
- if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
+ if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
includes |= 67108864 /* NonPrimitive */;
}
typeSet.set(type.id.toString(), type);
@@ -58123,7 +58706,7 @@ ${lanes.join("\n")}
const typeVariable = getTypeParameterFromMappedType(mappedType);
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
function isDistributive(type) {
- return type.flags & (3 /* AnyOrUnknown */ | 131068 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
+ return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
}
}
function getLiteralTypeFromPropertyName(name) {
@@ -58410,7 +58993,7 @@ ${lanes.join("\n")}
}
}
const propType = getTypeOfSymbol(prop);
- return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
+ return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
}
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
const index = +propName;
@@ -58776,7 +59359,7 @@ ${lanes.join("\n")}
}
function getActualTypeVariable(type) {
if (type.flags & 33554432 /* Substitution */) {
- return type.baseType;
+ return getActualTypeVariable(type.baseType);
}
if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) {
return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
@@ -58974,11 +59557,6 @@ ${lanes.join("\n")}
var _a2;
const links = getNodeLinks(node);
if (!links.resolvedType) {
- if (node.isTypeOf && node.typeArguments) {
- error(node, Diagnostics.Type_arguments_cannot_be_used_here);
- links.resolvedSymbol = unknownSymbol;
- return links.resolvedType = errorType;
- }
if (!isLiteralImportTypeNode(node)) {
error(node.argument, Diagnostics.String_literal_expected);
links.resolvedSymbol = unknownSymbol;
@@ -59039,15 +59617,8 @@ ${lanes.join("\n")}
const resolvedSymbol = resolveSymbol(symbol);
links.resolvedSymbol = resolvedSymbol;
if (meaning === 111551 /* Value */) {
- return getTypeOfSymbol(symbol);
+ return getInstantiationExpressionType(getTypeOfSymbol(symbol), node);
} else {
- const type = tryGetDeclaredTypeOfSymbol(resolvedSymbol);
- const typeParameters = type && getTypeParametersForTypeAndSymbol(type, resolvedSymbol);
- if (node.typeArguments && typeParameters) {
- addLazyDiagnostic(() => {
- checkTypeArgumentConstraints(node, typeParameters);
- });
- }
return getTypeReferenceType(node, resolvedSymbol);
}
}
@@ -59225,7 +59796,7 @@ ${lanes.join("\n")}
return type;
}
function getFreshTypeOfLiteralType(type) {
- if (type.flags & 2944 /* Literal */) {
+ if (type.flags & 2976 /* Freshable */) {
if (!type.freshType) {
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
freshType.freshType = freshType;
@@ -59236,10 +59807,10 @@ ${lanes.join("\n")}
return type;
}
function getRegularTypeOfLiteralType(type) {
- return type.flags & 2944 /* Literal */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
+ return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
}
function isFreshLiteralType(type) {
- return !!(type.flags & 2944 /* Literal */) && type.freshType === type;
+ return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
}
function getStringLiteralType(value) {
let type;
@@ -59918,13 +60489,13 @@ ${lanes.join("\n")}
return type;
}
function getUniqueLiteralFilledInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
}
function getPermissiveInstantiation(type) {
- return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
+ return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
}
function getRestrictiveInstantiation(type) {
- if (type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
+ if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
return type;
}
if (type.restrictiveInstantiation) {
@@ -60196,7 +60767,12 @@ ${lanes.join("\n")}
}
}
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
- pushContextualType(next, sourcePropType);
+ pushContextualType(
+ next,
+ sourcePropType,
+ /*isCache*/
+ false
+ );
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
popContextualType();
return result;
@@ -60499,12 +61075,17 @@ ${lanes.join("\n")}
}
}
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
}
- pushContextualType(node, target);
+ pushContextualType(
+ node,
+ target,
+ /*isCache*/
+ false
+ );
const tupleizedType = checkArrayLiteral(
node,
1 /* Contextual */,
@@ -60543,7 +61124,7 @@ ${lanes.join("\n")}
}
}
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
- if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
+ if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
}
@@ -60566,16 +61147,24 @@ ${lanes.join("\n")}
void 0
) !== 0 /* False */;
}
- function isAnySignature(s) {
- return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s) && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) && isTypeAny(getReturnTypeOfSignature(s));
+ function isTopSignature(s) {
+ if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
+ const paramType = getTypeOfParameter(s.parameters[0]);
+ const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
+ return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
+ }
+ return false;
}
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
if (source === target) {
return -1 /* True */;
}
- if (isAnySignature(target)) {
+ if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
return -1 /* True */;
}
+ if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
+ return 0 /* False */;
+ }
const targetCount = getParameterCount(target);
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
if (sourceHasMoreParameters) {
@@ -60793,7 +61382,9 @@ ${lanes.join("\n")}
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
const s = source.flags;
const t = target.flags;
- if (t & 3 /* AnyOrUnknown */ || s & 131072 /* Never */ || source === wildcardType)
+ if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
+ return true;
+ if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
return true;
if (t & 131072 /* Never */)
return false;
@@ -60920,7 +61511,6 @@ ${lanes.join("\n")}
let overrideNextErrorInfo = 0;
let lastSkippedInfo;
let incompatibleStack;
- let inPropertyCheck = false;
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
const result = isRelatedTo(
source,
@@ -61117,7 +61707,8 @@ ${lanes.join("\n")}
Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable");
generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource);
}
- if (target2.flags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
+ const targetFlags = target2.flags & 8388608 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags;
+ if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) {
const constraint = getBaseConstraintOfType(target2);
let needsOriginalSource;
if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) {
@@ -61190,7 +61781,7 @@ ${lanes.join("\n")}
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
}
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
- if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) {
+ if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
return -1 /* True */;
}
@@ -61254,7 +61845,7 @@ ${lanes.join("\n")}
return 0 /* False */;
}
}
- const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
+ const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2));
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
if (reportErrors2) {
@@ -61316,7 +61907,7 @@ ${lanes.join("\n")}
maybeSuppress = !!errorInfo;
}
}
- if (source2.flags & 524288 /* Object */ && target2.flags & 131068 /* Primitive */) {
+ if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
@@ -61462,15 +62053,15 @@ ${lanes.join("\n")}
}
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
if (source2.flags & 1048576 /* Union */) {
- return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */), intersectionState);
+ return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
}
if (target2.flags & 1048576 /* Union */) {
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 131068 /* Primitive */) && !(target2.flags & 131068 /* Primitive */));
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
}
if (target2.flags & 2097152 /* Intersection */) {
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
}
- if (relation === comparableRelation && target2.flags & 131068 /* Primitive */) {
+ if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
if (constraints !== source2.types) {
source2 = getIntersectionType(constraints);
@@ -61878,14 +62469,15 @@ ${lanes.join("\n")}
);
}
}
- if (result2 && !inPropertyCheck && (target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */) || isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */)))) {
- inPropertyCheck = true;
+ if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
result2 &= propertiesRelatedTo(
source2,
target2,
reportErrors2,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
@@ -61898,7 +62490,17 @@ ${lanes.join("\n")}
0 /* None */
);
}
- inPropertyCheck = false;
+ } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
+ result2 &= propertiesRelatedTo(
+ source2,
+ target2,
+ reportErrors2,
+ /*excludedProperties*/
+ void 0,
+ /*optionalsOnly*/
+ true,
+ intersectionState
+ );
}
}
if (result2) {
@@ -62352,7 +62954,7 @@ ${lanes.join("\n")}
}
return 0 /* False */;
}
- const sourceIsPrimitive = !!(sourceFlags & 131068 /* Primitive */);
+ const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
if (relation !== identityRelation) {
source2 = getApparentType(source2);
sourceFlags = source2.flags;
@@ -62388,12 +62990,14 @@ ${lanes.join("\n")}
reportStructuralErrors,
/*excludedProperties*/
void 0,
+ /*optionalsOnly*/
+ false,
intersectionState
);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
if (result2) {
- result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
+ result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
if (result2) {
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
}
@@ -62522,6 +63126,8 @@ ${lanes.join("\n")}
/*reportErrors*/
false,
excludedProperties,
+ /*optionalsOnly*/
+ false,
0 /* None */
);
if (result2) {
@@ -62530,7 +63136,8 @@ ${lanes.join("\n")}
type,
0 /* Call */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2) {
result2 &= signaturesRelatedTo(
@@ -62538,7 +63145,8 @@ ${lanes.join("\n")}
type,
1 /* Construct */,
/*reportStructuralErrors*/
- false
+ false,
+ 0 /* None */
);
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
result2 &= indexSignaturesRelatedTo(
@@ -62716,7 +63324,7 @@ ${lanes.join("\n")}
}
}
}
- function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
+ function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
if (relation === identityRelation) {
return propertiesIdenticalTo(source2, target2, excludedProperties);
}
@@ -62852,7 +63460,7 @@ ${lanes.join("\n")}
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
for (const targetProp of excludeProperties(properties, excludedProperties)) {
const name = targetProp.escapedName;
- if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
+ if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
const sourceProp = getPropertyOfType(source2, name);
if (sourceProp && sourceProp !== targetProp) {
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
@@ -62888,7 +63496,7 @@ ${lanes.join("\n")}
}
return result2;
}
- function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
+ function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
var _a3, _b;
if (relation === identityRelation) {
return signaturesIdenticalTo(source2, target2, kind);
@@ -62925,6 +63533,7 @@ ${lanes.join("\n")}
/*erase*/
true,
reportErrors2,
+ intersectionState,
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
);
if (!related) {
@@ -62936,7 +63545,7 @@ ${lanes.join("\n")}
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
const sourceSignature = first(sourceSignatures);
const targetSignature = first(targetSignatures);
- result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
+ result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
const constructSignatureToString = (signature) => signatureToString(
signature,
@@ -62961,6 +63570,7 @@ ${lanes.join("\n")}
/*erase*/
true,
shouldElaborateErrors,
+ intersectionState,
incompatibleReporter(s, t)
);
if (related) {
@@ -63013,17 +63623,29 @@ ${lanes.join("\n")}
}
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
}
- function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
+ function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
+ const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
return compareSignaturesRelated(
erase ? getErasedSignature(source2) : source2,
erase ? getErasedSignature(target2) : target2,
- relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0,
+ checkMode,
reportErrors2,
reportError,
incompatibleReporter,
- isRelatedToWorker,
+ isRelatedToWorker2,
reportUnreliableMapper
);
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
+ return isRelatedTo(
+ source3,
+ target3,
+ 3 /* Both */,
+ reportErrors3,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
+ }
}
function signaturesIdenticalTo(source2, target2, kind) {
const sourceSignatures = getSignaturesOfType(source2, kind);
@@ -63082,7 +63704,7 @@ ${lanes.join("\n")}
}
for (const info of getIndexInfosOfType(source2)) {
if (isApplicableIndexType(info.keyType, keyType)) {
- const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
+ const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
if (!related) {
return 0 /* False */;
}
@@ -63091,8 +63713,16 @@ ${lanes.join("\n")}
}
return result2;
}
- function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
- const related = isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */, reportErrors2);
+ function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
+ const related = isRelatedTo(
+ sourceInfo.type,
+ targetInfo.type,
+ 3 /* Both */,
+ reportErrors2,
+ /*headMessage*/
+ void 0,
+ intersectionState
+ );
if (!related && reportErrors2) {
if (sourceInfo.keyType === targetInfo.keyType) {
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -63121,9 +63751,9 @@ ${lanes.join("\n")}
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
if (sourceInfo) {
- return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
+ return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
}
- if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
+ if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
}
if (reportErrors2) {
@@ -63412,12 +64042,15 @@ ${lanes.join("\n")}
}
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
if (depth >= maxDepth) {
+ if (type.flags & 2097152 /* Intersection */) {
+ return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
+ }
const identity2 = getRecursionIdentity(type);
let count = 0;
let lastTypeId = 0;
for (let i = 0; i < depth; i++) {
const t = stack[i];
- if (getRecursionIdentity(t) === identity2) {
+ if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
if (t.id >= lastTypeId) {
count++;
if (count >= maxDepth) {
@@ -63650,15 +64283,25 @@ ${lanes.join("\n")}
return propType;
}
if (everyType(type, isTupleType)) {
- return mapType(type, (t) => getRestTypeOfTupleType(t) || undefinedType);
+ return mapType(type, (t) => {
+ const tupleType = t;
+ const restType = getRestTypeOfTupleType(tupleType);
+ if (!restType) {
+ return undefinedType;
+ }
+ if (compilerOptions.noUncheckedIndexedAccess && index >= tupleType.target.fixedLength + getEndElementCount(tupleType.target, 3 /* Fixed */)) {
+ return getUnionType([restType, undefinedType]);
+ }
+ return restType;
+ });
}
return void 0;
}
function isNeitherUnitTypeNorNever(type) {
- return !(type.flags & (109440 /* Unit */ | 131072 /* Never */));
+ return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
}
function isUnitType(type) {
- return !!(type.flags & 109440 /* Unit */);
+ return !!(type.flags & 109472 /* Unit */);
}
function isUnitLikeType(type) {
const t = getBaseConstraintOrType(type);
@@ -63671,15 +64314,18 @@ ${lanes.join("\n")}
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
}
function getBaseTypeOfLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ ? getBaseTypeOfEnumLiteralType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
+ return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
}
function getBaseTypeOfLiteralTypeUnion(type) {
var _a2;
const key = `B${getTypeId(type)}`;
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
}
+ function getBaseTypeOfLiteralTypeForComparison(type) {
+ return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
+ }
function getWidenedLiteralType(type) {
- return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
+ return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
}
function getWidenedUniqueESSymbolType(type) {
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
@@ -63720,7 +64366,7 @@ ${lanes.join("\n")}
const restType = getRestTypeOfTupleType(type);
return restType && createArrayType(restType);
}
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
const length2 = getTypeReferenceArity(type) - endSkipCount;
if (index < length2) {
const typeArguments = getTypeArguments(type);
@@ -63729,7 +64375,7 @@ ${lanes.join("\n")}
const t = typeArguments[i];
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
}
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
return void 0;
}
@@ -63797,7 +64443,7 @@ ${lanes.join("\n")}
}
function isObjectTypeWithInferableIndex(type) {
const objectFlags = getObjectFlags(type);
- return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures2(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
+ return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
}
function createSymbolWithType(source, type) {
const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */);
@@ -64035,6 +64681,11 @@ ${lanes.join("\n")}
case 320 /* JSDocFunctionType */:
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
+ case 326 /* JSDocSignature */:
+ if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
+ error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
+ }
+ return;
case 259 /* FunctionDeclaration */:
case 171 /* MethodDeclaration */:
case 170 /* MethodSignature */:
@@ -64207,8 +64858,8 @@ ${lanes.join("\n")}
}
return false;
}
- function isTypeParameterAtTopLevel(type, typeParameter) {
- return !!(type === typeParameter || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, typeParameter)) || type.flags & 16777216 /* Conditional */ && (getTrueTypeFromConditionalType(type) === typeParameter || getFalseTypeFromConditionalType(type) === typeParameter));
+ function isTypeParameterAtTopLevel(type, tp, depth = 0) {
+ return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
}
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
const typePredicate = getTypePredicateOfSignature(signature);
@@ -64302,7 +64953,7 @@ ${lanes.join("\n")}
yield targetProp;
} else if (matchDiscriminantProperties) {
const targetType = getTypeOfSymbol(targetProp);
- if (targetType.flags & 109440 /* Unit */) {
+ if (targetType.flags & 109472 /* Unit */) {
const sourceType = getTypeOfSymbol(sourceProp);
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
yield targetProp;
@@ -64363,10 +65014,10 @@ ${lanes.join("\n")}
return getBigIntLiteralType(parseValidBigInt(text));
}
function isMemberOfStringMapping(source, target) {
- if (target.flags & (4 /* String */ | 1 /* Any */)) {
+ if (target.flags & 1 /* Any */) {
return true;
}
- if (target.flags & 134217728 /* TemplateLiteral */) {
+ if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
return isTypeAssignableTo(source, target);
}
if (target.flags & 268435456 /* StringMapping */) {
@@ -65061,7 +65712,7 @@ ${lanes.join("\n")}
}
function hasPrimitiveConstraint(type) {
const constraint = getConstraintOfTypeParameter(type);
- return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
}
function isObjectLiteralType2(type) {
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
@@ -65543,7 +66194,7 @@ ${lanes.join("\n")}
return 83886079 /* UnknownFacts */;
}
function getIntersectionTypeFacts(type) {
- const ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
+ const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
let oredFacts = 0 /* None */;
let andedFacts = 134217727 /* All */;
for (const t of type.types) {
@@ -65742,7 +66393,7 @@ ${lanes.join("\n")}
}
return true;
}
- if (source.flags & 1024 /* EnumLiteral */ && getBaseTypeOfEnumLiteralType(source) === target) {
+ if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
return true;
}
return containsType(target.types, source);
@@ -65780,7 +66431,7 @@ ${lanes.join("\n")}
}
return getUnionTypeFromSortedList(
filtered,
- type.objectFlags,
+ type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
/*aliasSymbol*/
void 0,
/*aliasTypeArguments*/
@@ -66138,10 +66789,12 @@ ${lanes.join("\n")}
}
function isConstantReference(node) {
switch (node.kind) {
- case 79 /* Identifier */: {
- const symbol = getResolvedSymbol(node);
- return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
- }
+ case 79 /* Identifier */:
+ if (!isThisInTypeQuery(node)) {
+ const symbol = getResolvedSymbol(node);
+ return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol);
+ }
+ break;
case 208 /* PropertyAccessExpression */:
case 209 /* ElementAccessExpression */:
return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol);
@@ -66287,7 +66940,7 @@ ${lanes.join("\n")}
}
return declaredType;
}
- if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) {
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
}
return void 0;
@@ -66804,7 +67457,7 @@ ${lanes.join("\n")}
}
if (assumeTrue) {
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
- if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
+ if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
return valueType;
}
if (valueType.flags & 524288 /* Object */) {
@@ -66837,7 +67490,7 @@ ${lanes.join("\n")}
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
}
function narrowTypeByLiteralExpression(type, literal, assumeTrue) {
- return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
+ return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getAdjustedTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */);
}
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
const everyClauseChecks = clauseStart !== clauseEnd && every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -66854,7 +67507,7 @@ ${lanes.join("\n")}
let groundClauseTypes;
for (let i = 0; i < clauseTypes.length; i += 1) {
const t = clauseTypes[i];
- if (t.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
+ if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
if (groundClauseTypes !== void 0) {
groundClauseTypes.push(t);
}
@@ -66973,52 +67626,58 @@ ${lanes.join("\n")}
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
return type;
}
- let targetType;
- const prototypeProperty = getPropertyOfType(rightType, "prototype");
- if (prototypeProperty) {
- const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
- if (!isTypeAny(prototypePropertyType)) {
- targetType = prototypePropertyType;
- }
- }
- if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
+ const instanceType = mapType(rightType, getInstanceType);
+ if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
return type;
}
- if (!targetType) {
- const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
- targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
- }
- if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
- const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
- if (!nonConstructorTypeInUnion)
- return type;
- }
return getNarrowedType(
type,
- targetType,
+ instanceType,
assumeTrue,
/*checkDerived*/
true
);
}
+ function getInstanceType(constructorType) {
+ const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
+ if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
+ return prototypePropertyType;
+ }
+ const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
+ if (constructSignatures.length) {
+ return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
+ }
+ return emptyObjectType;
+ }
function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
var _a3;
const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
}
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
- const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
if (!assumeTrue) {
- return filterType(type, (t) => !isRelated(t, candidate));
+ if (checkDerived) {
+ return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
+ }
+ const trueType2 = getNarrowedType(
+ type,
+ candidate,
+ /*assumeTrue*/
+ true,
+ /*checkDerived*/
+ false
+ );
+ return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
}
if (type.flags & 3 /* AnyOrUnknown */) {
return candidate;
}
+ const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
const narrowedType = mapType(candidate, (c) => {
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
- const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
+ const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
});
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
@@ -67122,7 +67781,7 @@ ${lanes.join("\n")}
}
}
function getTypeOfSymbolAtLocation(symbol, location) {
- symbol = symbol.exportSymbol || symbol;
+ symbol = getExportSymbolOfValueSymbolIfExported(symbol);
if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) {
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
@@ -67174,15 +67833,25 @@ ${lanes.join("\n")}
function isConstVariable(symbol) {
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
}
- function removeOptionalityFromDeclaredType(declaredType, declaration) {
- if (pushTypeResolution(declaration.symbol, 2 /* DeclaredType */)) {
- const annotationIncludesUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
- popTypeResolution();
- return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
- } else {
- reportCircularityError(declaration.symbol);
- return declaredType;
+ function parameterInitializerContainsUndefined(declaration) {
+ const links = getNodeLinks(declaration);
+ if (links.parameterInitializerContainsUndefined === void 0) {
+ if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
+ if (!popTypeResolution()) {
+ reportCircularityError(declaration.symbol);
+ return true;
+ }
+ links.parameterInitializerContainsUndefined = containsUndefined;
}
+ return links.parameterInitializerContainsUndefined;
+ }
+ function removeOptionalityFromDeclaredType(declaredType, declaration) {
+ const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
+ return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
}
function isConstraintPosition(type, node) {
const parent2 = node.parent;
@@ -68293,9 +68962,18 @@ ${lanes.join("\n")}
if (prop) {
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
}
- if (isTupleType(t)) {
- const restType = getRestTypeOfTupleType(t);
- if (restType && isNumericLiteralName(name) && +name >= 0) {
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
+ const restType = getElementTypeOfSliceOfTupleType(
+ t,
+ t.target.fixedLength,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ );
+ if (restType) {
return restType;
}
}
@@ -68342,9 +69020,18 @@ ${lanes.join("\n")}
return void 0;
}
function getContextualTypeForElementExpression(arrayContextualType, index) {
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
arrayContextualType,
- (t) => getIteratedTypeOrElementType(
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
+ t,
+ 0,
+ /*endSkipCount*/
+ 0,
+ /*writing*/
+ false,
+ /*noReductions*/
+ true
+ ) : getIteratedTypeOrElementType(
1 /* Element */,
t,
undefinedType,
@@ -68497,14 +69184,17 @@ ${lanes.join("\n")}
return type;
}
function getContextualType2(node, contextFlags) {
+ var _a2, _b;
if (node.flags & 33554432 /* InWithStatement */) {
return void 0;
}
- const index = findContextualNode(node);
+ const index = findContextualNode(
+ node,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
- const cached = contextualTypes[index];
- if (cached || !contextFlags)
- return cached;
+ return contextualTypes[index];
}
const { parent: parent2 } = node;
switch (parent2.kind) {
@@ -68539,7 +69229,9 @@ ${lanes.join("\n")}
case 206 /* ArrayLiteralExpression */: {
const arrayLiteral = parent2;
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
}
case 224 /* ConditionalExpression */:
return getContextualTypeForConditionalOperand(node, contextFlags);
@@ -68575,17 +69267,30 @@ ${lanes.join("\n")}
}
return void 0;
}
- function pushContextualType(node, type) {
+ function pushCachedContextualType(node) {
+ pushContextualType(
+ node,
+ getContextualType2(
+ node,
+ /*contextFlags*/
+ void 0
+ ),
+ /*isCache*/
+ true
+ );
+ }
+ function pushContextualType(node, type, isCache) {
contextualTypeNodes[contextualTypeCount] = node;
contextualTypes[contextualTypeCount] = type;
+ contextualIsCache[contextualTypeCount] = isCache;
contextualTypeCount++;
}
function popContextualType() {
contextualTypeCount--;
}
- function findContextualNode(node) {
+ function findContextualNode(node, includeCaches) {
for (let i = contextualTypeCount - 1; i >= 0; i--) {
- if (node === contextualTypeNodes[i]) {
+ if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
return i;
}
}
@@ -68608,7 +69313,11 @@ ${lanes.join("\n")}
}
function getContextualJsxElementAttributesType(node, contextFlags) {
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
- const index = findContextualNode(node.parent);
+ const index = findContextualNode(
+ node.parent,
+ /*includeCaches*/
+ !contextFlags
+ );
if (index >= 0) {
return contextualTypes[index];
}
@@ -68879,11 +69588,7 @@ ${lanes.join("\n")}
const elementCount = elements.length;
const elementTypes = [];
const elementFlags = [];
- pushContextualType(node, getContextualType2(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const inDestructuringPattern = isAssignmentTarget(node);
const inConstContext = isConstContext(node);
const contextualType = getApparentTypeOfContextualType(
@@ -69046,11 +69751,7 @@ ${lanes.join("\n")}
let propertiesTable = createSymbolTable();
let propertiesArray = [];
let spread = emptyObjectType;
- pushContextualType(node, getContextualType2(
- node,
- /*contextFlags*/
- void 0
- ));
+ pushCachedContextualType(node);
const contextualType = getApparentTypeOfContextualType(
node,
/*contextFlags*/
@@ -70337,7 +71038,7 @@ ${lanes.join("\n")}
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
let errorInfo;
let relatedInfo;
- if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 131068 /* Primitive */)) {
+ if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
for (const subtype of containingType.types) {
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
@@ -70390,26 +71091,22 @@ ${lanes.join("\n")}
function getSuggestedLibForNonExistentName(name) {
const missingName = diagnosticName(name);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const containingTypes = getOwnKeys(allFeatures[libTarget]);
- if (containingTypes !== void 0 && contains(containingTypes, missingName)) {
- return libTarget;
- }
- }
+ const typeFeatures = allFeatures.get(missingName);
+ return typeFeatures && firstIterator(typeFeatures.keys());
}
function getSuggestedLibForNonExistentProperty(missingProperty, containingType) {
const container = getApparentType(containingType).symbol;
if (!container) {
return void 0;
}
+ const containingTypeName = symbolName(container);
const allFeatures = getScriptTargetFeatures();
- const libTargets = getOwnKeys(allFeatures);
- for (const libTarget of libTargets) {
- const featuresOfLib = allFeatures[libTarget];
- const featuresOfContainingType = featuresOfLib[symbolName(container)];
- if (featuresOfContainingType !== void 0 && contains(featuresOfContainingType, missingProperty)) {
- return libTarget;
+ const typeFeatures = allFeatures.get(containingTypeName);
+ if (typeFeatures) {
+ for (const [libTarget, featuresOfType] of typeFeatures) {
+ if (contains(featuresOfType, missingProperty)) {
+ return libTarget;
+ }
}
}
}
@@ -70938,7 +71635,7 @@ ${lanes.join("\n")}
} else {
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
- const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
+ const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
flags.push(1 /* Required */);
}
@@ -71472,7 +72169,7 @@ ${lanes.join("\n")}
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
const isDecorator2 = node.kind === 167 /* Decorator */;
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
- const reportErrors2 = !candidatesOutArray;
+ const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
let typeArguments;
if (!isDecorator2 && !isSuperCall(node)) {
typeArguments = node.typeArguments;
@@ -72431,7 +73128,7 @@ ${lanes.join("\n")}
}
}
function checkCallExpression(node, checkMode) {
- var _a2;
+ var _a2, _b, _c;
checkGrammarTypeArguments(node, node.typeArguments);
const signature = getResolvedSignature(
node,
@@ -72448,7 +73145,7 @@ ${lanes.join("\n")}
}
if (node.kind === 211 /* NewExpression */) {
const declaration = signature.declaration;
- if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
+ if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
if (noImplicitAny) {
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
}
@@ -72476,7 +73173,7 @@ ${lanes.join("\n")}
/*allowDeclaration*/
false
);
- if ((_a2 = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _a2.size) {
+ if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
return getIntersectionType([returnType, jsAssignmentType]);
@@ -72762,6 +73459,9 @@ ${lanes.join("\n")}
checkGrammarExpressionWithTypeArguments(node);
forEach(node.typeArguments, checkSourceElement);
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
+ return getInstantiationExpressionType(exprType, node);
+ }
+ function getInstantiationExpressionType(exprType, node) {
const typeArguments = node.typeArguments;
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
return exprType;
@@ -74185,10 +74885,10 @@ ${lanes.join("\n")}
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
- if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 131068 /* Primitive */)) {
+ if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
- if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
+ if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
}
return booleanType;
@@ -74710,8 +75410,8 @@ ${lanes.join("\n")}
case 32 /* LessThanEqualsToken */:
case 33 /* GreaterThanEqualsToken */:
if (checkForDisallowedESSymbolOperand(operator)) {
- leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left));
- rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right));
+ leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
+ rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
reportOperatorErrorUnless((left2, right2) => {
if (isTypeAny(left2) || isTypeAny(right2)) {
return true;
@@ -74771,7 +75471,7 @@ ${lanes.join("\n")}
return leftType;
} else {
checkAssignmentOperator(rightType);
- return getRegularTypeOfObjectLiteral(rightType);
+ return rightType;
}
case 27 /* CommaToken */:
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
@@ -75062,14 +75762,19 @@ ${lanes.join("\n")}
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
}
function getContextNode2(node) {
- if (node.kind === 289 /* JsxAttributes */ && !isJsxSelfClosingElement(node.parent)) {
+ if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
return node.parent.parent;
}
return node;
}
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
const contextNode = getContextNode2(node);
- pushContextualType(contextNode, contextualType);
+ pushContextualType(
+ contextNode,
+ contextualType,
+ /*isCache*/
+ false
+ );
pushInferenceContext(contextNode, inferenceContext);
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
@@ -75400,7 +76105,7 @@ ${lanes.join("\n")}
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
return getTypeFromTypeNode(expr.type);
- } else if (node.kind === 8 /* NumericLiteral */ || node.kind === 10 /* StringLiteral */ || node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */) {
+ } else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
return checkExpression(node);
}
return void 0;
@@ -75410,7 +76115,12 @@ ${lanes.join("\n")}
if (links.contextFreeType) {
return links.contextFreeType;
}
- pushContextualType(node, anyType);
+ pushContextualType(
+ node,
+ anyType,
+ /*isCache*/
+ false
+ );
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
popContextualType();
return type;
@@ -75625,7 +76335,7 @@ ${lanes.join("\n")}
error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
}
}
- if ((node.questionToken || isJSDocOptionalParameter(node)) && isBindingPattern(node.name) && func.body) {
+ if (!node.initializer && isOptionalDeclaration(node) && isBindingPattern(node.name) && func.body) {
error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
}
if (node.name && isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
@@ -76147,8 +76857,8 @@ ${lanes.join("\n")}
}
return void 0;
}
- function getTypeParametersForTypeReference(node) {
- const type = getTypeFromTypeReference(node);
+ function getTypeParametersForTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
const symbol = getNodeLinks(node).resolvedSymbol;
if (symbol) {
@@ -76166,11 +76876,14 @@ ${lanes.join("\n")}
}
}
forEach(node.typeArguments, checkSourceElement);
- const type = getTypeFromTypeReference(node);
+ checkTypeReferenceOrImport(node);
+ }
+ function checkTypeReferenceOrImport(node) {
+ const type = getTypeFromTypeNode(node);
if (!isErrorType(type)) {
if (node.typeArguments) {
addLazyDiagnostic(() => {
- const typeParameters = getTypeParametersForTypeReference(node);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(node);
if (typeParameters) {
checkTypeArgumentConstraints(node, typeParameters);
}
@@ -76192,7 +76905,7 @@ ${lanes.join("\n")}
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
if (!typeReferenceNode)
return void 0;
- const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
+ const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReferenceNode);
if (!typeParameters)
return void 0;
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
@@ -76372,7 +77085,7 @@ ${lanes.join("\n")}
}
}
}
- getTypeFromTypeNode(node);
+ checkTypeReferenceOrImport(node);
}
function checkNamedTupleMember(node) {
if (node.dotDotDotToken && node.questionToken) {
@@ -76537,6 +77250,17 @@ ${lanes.join("\n")}
lastSeenNonAmbientDeclaration = node;
}
}
+ if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
+ for (const node2 of current.jsDoc) {
+ if (node2.tags) {
+ for (const tag of node2.tags) {
+ if (isJSDocOverloadTag(tag)) {
+ hasOverloads = true;
+ }
+ }
+ }
+ }
+ }
}
}
if (multipleConstructorImplementation) {
@@ -76574,8 +77298,9 @@ ${lanes.join("\n")}
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
for (const signature of signatures) {
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
+ const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
addRelatedInfo(
- error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
+ error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
);
break;
@@ -76668,6 +77393,9 @@ ${lanes.join("\n")}
case 273 /* ImportSpecifier */:
case 79 /* Identifier */:
return 1 /* ExportValue */;
+ case 170 /* MethodSignature */:
+ case 168 /* PropertySignature */:
+ return 2 /* ExportType */;
default:
return Debug.failBadSyntaxKind(d);
}
@@ -76691,7 +77419,7 @@ ${lanes.join("\n")}
))) {
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
}
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return void 0;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -76743,7 +77471,7 @@ ${lanes.join("\n")}
return awaitedType || errorType;
}
function isThenableType(type) {
- if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* Primitive */ | 131072 /* Never */)) {
+ if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
return false;
}
const thenFunction = getTypeOfPropertyOfType(type, "then");
@@ -76792,7 +77520,7 @@ ${lanes.join("\n")}
return awaitedType;
}
}
- Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
+ Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
return type;
}
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
@@ -79605,20 +80333,19 @@ ${lanes.join("\n")}
}
}
}
- function getMemberOverrideModifierStatus(node, member) {
+ function getMemberOverrideModifierStatus(node, member, memberSymbol) {
if (!member.name) {
return 0 /* Ok */;
}
- const symbol = getSymbolOfDeclaration(node);
- const type = getDeclaredTypeOfSymbol(symbol);
+ const classSymbol = getSymbolOfDeclaration(node);
+ const type = getDeclaredTypeOfSymbol(classSymbol);
const typeWithThis = getTypeWithThisArgument(type);
- const staticType = getTypeOfSymbol(symbol);
+ const staticType = getTypeOfSymbol(classSymbol);
const baseTypeNode = getEffectiveBaseTypeNode(node);
const baseTypes = baseTypeNode && getBaseTypes(type);
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
const baseStaticType = getBaseConstructorTypeOfClass(type);
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
- const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
return checkMemberForOverrideModifier(
node,
staticType,
@@ -79631,7 +80358,7 @@ ${lanes.join("\n")}
isStatic(member),
/* memberIsParameterProperty */
false,
- memberName
+ symbolName(memberSymbol)
);
}
function getTargetSymbol(s) {
@@ -80183,7 +80910,7 @@ ${lanes.join("\n")}
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
}
}
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
if (exportModifier) {
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -80514,8 +81241,6 @@ ${lanes.join("\n")}
} else {
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
- } else if (!(node.flags & 16777216 /* Ambient */) && getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
- grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
}
}
}
@@ -80670,7 +81395,7 @@ ${lanes.join("\n")}
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
- const sym = resolveEntityName(
+ const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
id,
67108863 /* All */,
/*ignoreErrors*/
@@ -80678,7 +81403,7 @@ ${lanes.join("\n")}
/*dontResolveAlias*/
true,
node
- );
+ ));
if (sym) {
markAliasReferenced(sym, id);
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
@@ -80722,8 +81447,6 @@ ${lanes.join("\n")}
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
} else if (moduleKind === 4 /* System */ && !(node.flags & 16777216 /* Ambient */)) {
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
- } else if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */ && !(node.flags & 16777216 /* Ambient */)) {
- grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead);
}
}
}
@@ -81051,6 +81774,8 @@ ${lanes.join("\n")}
if (!(links.flags & 1 /* TypeChecked */)) {
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
links.deferredNodes.add(node);
+ } else {
+ Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
}
}
function checkDeferredNodes(context) {
@@ -81058,6 +81783,7 @@ ${lanes.join("\n")}
if (links.deferredNodes) {
links.deferredNodes.forEach(checkDeferredNode);
}
+ links.deferredNodes = void 0;
}
function checkDeferredNode(node) {
var _a2, _b;
@@ -81313,7 +82039,7 @@ ${lanes.join("\n")}
}
return node.parent.kind === 180 /* TypeReference */;
}
- function isHeritageClauseElementIdentifier(node) {
+ function isInNameOfExpressionWithTypeArguments(node) {
while (node.parent.kind === 208 /* PropertyAccessExpression */) {
node = node.parent;
}
@@ -81423,10 +82149,10 @@ ${lanes.join("\n")}
while (isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(name)) {
name = name.parent;
}
- if (isHeritageClauseElementIdentifier(name)) {
+ if (isInNameOfExpressionWithTypeArguments(name)) {
let meaning = 0 /* None */;
if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) {
- meaning = 788968 /* Type */;
+ meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */;
if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) {
meaning |= 111551 /* Value */;
}
@@ -81832,8 +82558,8 @@ ${lanes.join("\n")}
}
return getNamedMembers(propsByName);
}
- function typeHasCallOrConstructSignatures2(type) {
- return typeHasCallOrConstructSignatures(type, checker);
+ function typeHasCallOrConstructSignatures(type) {
+ return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0;
}
function getRootSymbols(symbol) {
const roots = getImmediateRootSymbols(symbol);
@@ -82138,7 +82864,7 @@ ${lanes.join("\n")}
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
}
function getTypeReferenceSerializationKind(typeNameIn, location) {
- var _a2, _b;
+ var _a2;
const typeName = getParseTreeNode(typeNameIn, isEntityName);
if (!typeName)
return 0 /* Unknown */;
@@ -82170,7 +82896,7 @@ ${lanes.join("\n")}
location
);
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
- isTypeOnly || (isTypeOnly = !!((_b = valueSymbol == null ? void 0 : valueSymbol.declarations) == null ? void 0 : _b.every(isTypeOnlyImportOrExportDeclaration)));
+ isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
const typeSymbol = resolveEntityName(
typeName,
788968 /* Type */,
@@ -82321,7 +83047,7 @@ ${lanes.join("\n")}
return false;
}
function literalTypeToNode(type, enclosing, tracker) {
- const enumResult = type.flags & 1024 /* EnumLiteral */ ? nodeBuilder.symbolToExpression(
+ const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
type.symbol,
111551 /* Value */,
enclosing,
@@ -82864,6 +83590,7 @@ ${lanes.join("\n")}
let lastStatic, lastDeclare, lastAsync, lastOverride, firstDecorator;
let flags = 0 /* None */;
let sawExportBeforeDecorators = false;
+ let hasLeadingDecorators = false;
for (const modifier of node.modifiers) {
if (isDecorator(modifier)) {
if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) {
@@ -82881,8 +83608,22 @@ ${lanes.join("\n")}
if (flags & ~(1025 /* ExportDefault */ | 131072 /* Decorator */)) {
return grammarErrorOnNode(modifier, Diagnostics.Decorators_are_not_valid_here);
}
+ if (hasLeadingDecorators && flags & 126975 /* Modifier */) {
+ Debug.assertIsDefined(firstDecorator);
+ const sourceFile = getSourceFileOfNode(modifier);
+ if (!hasParseDiagnostics(sourceFile)) {
+ addRelatedInfo(
+ error(modifier, Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode(firstDecorator, Diagnostics.Decorator_used_before_export_here)
+ );
+ return true;
+ }
+ return false;
+ }
flags |= 131072 /* Decorator */;
- if (flags & 1 /* Export */) {
+ if (!(flags & 126975 /* Modifier */)) {
+ hasLeadingDecorators = true;
+ } else if (flags & 1 /* Export */) {
sawExportBeforeDecorators = true;
}
firstDecorator != null ? firstDecorator : firstDecorator = modifier;
@@ -83170,7 +83911,6 @@ ${lanes.join("\n")}
case 299 /* PropertyAssignment */:
case 300 /* ShorthandPropertyAssignment */:
case 267 /* NamespaceExportDeclaration */:
- case 181 /* FunctionType */:
case 279 /* MissingDeclaration */:
return find(node.modifiers, isModifier);
default:
@@ -83867,7 +84607,7 @@ ${lanes.join("\n")}
}
function isSimpleLiteralEnumReference(expr) {
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
- return !!(checkExpressionCached(expr).flags & 1024 /* EnumLiteral */);
+ return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
}
}
function checkAmbientInitializer(node) {
@@ -84269,10 +85009,10 @@ ${lanes.join("\n")}
}
function findMostOverlappyType(source, unionTarget) {
let bestMatch;
- if (!(source.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
let matchingCount = 0;
for (const target of unionTarget.types) {
- if (!(target.flags & (131068 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
+ if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
if (overlap.flags & 4194304 /* Index */) {
return target;
@@ -84290,7 +85030,7 @@ ${lanes.join("\n")}
}
function filterPrimitivesIfContainsNonPrimitive(type) {
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
- const result = filterType(type, (t) => !(t.flags & 131068 /* Primitive */));
+ const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
if (!(result.flags & 131072 /* Never */)) {
return result;
}
@@ -84375,9 +85115,8 @@ ${lanes.join("\n")}
"src/compiler/checker.ts"() {
"use strict";
init_ts2();
- init_ts2();
- init_ts_performance();
init_ts_moduleSpecifiers();
+ init_ts_performance();
ambientModuleSymbolRegex = /^".+"$/;
anon = "(anonymous)";
nextSymbolId = 1;
@@ -84490,6 +85229,7 @@ ${lanes.join("\n")}
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
return SignatureCheckMode3;
})(SignatureCheckMode || {});
@@ -85835,7 +86575,7 @@ ${lanes.join("\n")}
[291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
return context.factory.updateJsxExpression(
node,
- Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
+ nodeVisitor(node.expression, visitor, isExpression)
);
},
// Clauses
@@ -85920,31 +86660,31 @@ ${lanes.join("\n")}
// src/compiler/sourcemap.ts
function createSourceMapGenerator(host, file, sourceRoot, sourcesDirectoryPath, generatorOptions) {
- const { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
- const rawSources = [];
- const sources = [];
- const sourceToSourceIndexMap = /* @__PURE__ */ new Map();
- let sourcesContent;
- const names = [];
- let nameToNameIndexMap;
- const mappingCharCodes = [];
- let mappings = "";
- let lastGeneratedLine = 0;
- let lastGeneratedCharacter = 0;
- let lastSourceIndex = 0;
- let lastSourceLine = 0;
- let lastSourceCharacter = 0;
- let lastNameIndex = 0;
- let hasLast = false;
- let pendingGeneratedLine = 0;
- let pendingGeneratedCharacter = 0;
- let pendingSourceIndex = 0;
- let pendingSourceLine = 0;
- let pendingSourceCharacter = 0;
- let pendingNameIndex = 0;
- let hasPending = false;
- let hasPendingSource = false;
- let hasPendingName = false;
+ var { enter, exit } = generatorOptions.extendedDiagnostics ? createTimer("Source Map", "beforeSourcemap", "afterSourcemap") : nullTimer;
+ var rawSources = [];
+ var sources = [];
+ var sourceToSourceIndexMap = /* @__PURE__ */ new Map();
+ var sourcesContent;
+ var names = [];
+ var nameToNameIndexMap;
+ var mappingCharCodes = [];
+ var mappings = "";
+ var lastGeneratedLine = 0;
+ var lastGeneratedCharacter = 0;
+ var lastSourceIndex = 0;
+ var lastSourceLine = 0;
+ var lastSourceCharacter = 0;
+ var lastNameIndex = 0;
+ var hasLast = false;
+ var pendingGeneratedLine = 0;
+ var pendingGeneratedCharacter = 0;
+ var pendingSourceIndex = 0;
+ var pendingSourceLine = 0;
+ var pendingSourceCharacter = 0;
+ var pendingNameIndex = 0;
+ var hasPending = false;
+ var hasPendingSource = false;
+ var hasPendingName = false;
return {
getSources: () => rawSources,
addSource,
@@ -89206,7 +89946,7 @@ ${lanes.join("\n")}
return node;
}
function tryGetConstEnumValue(node) {
- if (compilerOptions.isolatedModules) {
+ if (getIsolatedModules(compilerOptions)) {
return void 0;
}
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
@@ -89763,7 +90503,16 @@ ${lanes.join("\n")}
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
);
}
- return visitEachChild(node, visitor, context);
+ return factory2.updatePropertyDeclaration(
+ node,
+ visitNodes2(node.modifiers, modifierVisitor, isModifier),
+ visitNode(node.name, propertyNameVisitor, isPropertyName),
+ /*questionOrExclamationToken*/
+ void 0,
+ /*type*/
+ void 0,
+ visitNode(node.initializer, visitor, isExpression)
+ );
}
function transformPublicFieldInitializer(node) {
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
@@ -95126,7 +95875,7 @@ ${lanes.join("\n")}
);
}
function visitBinaryExpression(node, expressionResultIsUnused2) {
- if (isDestructuringAssignment(node) && node.left.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (isDestructuringAssignment(node) && containsObjectRestOrSpread(node.left)) {
return flattenDestructuringAssignment(
node,
visitor,
@@ -95258,7 +96007,7 @@ ${lanes.join("\n")}
}
function visitForOfStatement(node, outermostLabeledStatement) {
const ancestorFacts = enterSubtree(0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */);
- if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ if (node.initializer.transformFlags & 65536 /* ContainsObjectRestOrSpread */ || isAssignmentPattern(node.initializer) && containsObjectRestOrSpread(node.initializer)) {
node = transformForOfStatementWithObjectRest(node);
}
const result = node.awaitModifier ? transformForAwaitOfStatement(node, outermostLabeledStatement, ancestorFacts) : factory2.restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
@@ -103156,6 +103905,9 @@ ${lanes.join("\n")}
return visitEachChild(node, visitor, context);
}
function visitImportCallExpression(node) {
+ if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
+ return visitEachChild(node, visitor, context);
+ }
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
@@ -105645,7 +106397,7 @@ ${lanes.join("\n")}
if (node.isDeclarationFile) {
return node;
}
- if (isExternalModule(node) || compilerOptions.isolatedModules) {
+ if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
currentSourceFile = node;
importRequireStatements = void 0;
let result = updateExternalModule(node);
@@ -105852,7 +106604,7 @@ ${lanes.join("\n")}
}
function onEmitNode(hint, node, emitCallback) {
if (isSourceFile(node)) {
- if ((isExternalModule(node) || compilerOptions.isolatedModules) && compilerOptions.importHelpers) {
+ if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
helperNameSubstitutions = /* @__PURE__ */ new Map();
}
previousOnEmitNode(hint, node, emitCallback);
@@ -106721,7 +107473,7 @@ ${lanes.join("\n")}
if (elem.kind === 229 /* OmittedExpression */) {
return elem;
}
- if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
+ if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
return factory2.updateBindingElement(
elem,
elem.dotDotDotToken,
@@ -108610,15 +109362,15 @@ ${lanes.join("\n")}
return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
}
function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
- const compilerOptions = host.getCompilerOptions();
- const sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
- const emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
- const emitterDiagnostics = createDiagnosticCollection();
- const newLine = getNewLineCharacter(compilerOptions);
- const writer = createTextWriter(newLine);
- const { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
- let bundleBuildInfo;
- let emitSkipped = false;
+ var compilerOptions = host.getCompilerOptions();
+ var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
+ var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
+ var emitterDiagnostics = createDiagnosticCollection();
+ var newLine = getNewLineCharacter(compilerOptions);
+ var writer = createTextWriter(newLine);
+ var { enter, exit } = createTimer("printTime", "beforePrint", "afterPrint");
+ var bundleBuildInfo;
+ var emitSkipped = false;
enter();
forEachEmittedFile(
host,
@@ -109138,7 +109890,7 @@ ${lanes.join("\n")}
return outputFiles;
}
function createPrinter(printerOptions = {}, handlers = {}) {
- const {
+ var {
hasGlobalName,
onEmitNode = noEmitNotification,
isEmitNotificationEnabled,
@@ -109150,57 +109902,57 @@ ${lanes.join("\n")}
onBeforeEmitToken,
onAfterEmitToken
} = handlers;
- const extendedDiagnostics = !!printerOptions.extendedDiagnostics;
- const newLine = getNewLineCharacter(printerOptions);
- const moduleKind = getEmitModuleKind(printerOptions);
- const bundledHelpers = /* @__PURE__ */ new Map();
- let currentSourceFile;
- let nodeIdToGeneratedName;
- let nodeIdToGeneratedPrivateName;
- let autoGeneratedIdToGeneratedName;
- let generatedNames;
- let formattedNameTempFlagsStack;
- let formattedNameTempFlags;
- let privateNameTempFlagsStack;
- let privateNameTempFlags;
- let tempFlagsStack;
- let tempFlags;
- let reservedNamesStack;
- let reservedNames;
- let reservedPrivateNamesStack;
- let reservedPrivateNames;
- let preserveSourceNewlines = printerOptions.preserveSourceNewlines;
- let nextListElementPos;
- let writer;
- let ownWriter;
- let write = writeBase;
- let isOwnFileEmit;
- const bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
- const relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
- const recordInternalSection = printerOptions.recordInternalSection;
- let sourceFileTextPos = 0;
- let sourceFileTextKind = "text" /* Text */;
- let sourceMapsDisabled = true;
- let sourceMapGenerator;
- let sourceMapSource;
- let sourceMapSourceIndex = -1;
- let mostRecentlyAddedSourceMapSource;
- let mostRecentlyAddedSourceMapSourceIndex = -1;
- let containerPos = -1;
- let containerEnd = -1;
- let declarationListContainerEnd = -1;
- let currentLineMap;
- let detachedCommentsInfo;
- let hasWrittenComment = false;
- let commentsDisabled = !!printerOptions.removeComments;
- let lastSubstitution;
- let currentParenthesizerRule;
- const { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
- const parenthesizer = factory.parenthesizer;
- const typeArgumentParenthesizerRuleSelector = {
+ var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
+ var newLine = getNewLineCharacter(printerOptions);
+ var moduleKind = getEmitModuleKind(printerOptions);
+ var bundledHelpers = /* @__PURE__ */ new Map();
+ var currentSourceFile;
+ var nodeIdToGeneratedName;
+ var nodeIdToGeneratedPrivateName;
+ var autoGeneratedIdToGeneratedName;
+ var generatedNames;
+ var formattedNameTempFlagsStack;
+ var formattedNameTempFlags;
+ var privateNameTempFlagsStack;
+ var privateNameTempFlags;
+ var tempFlagsStack;
+ var tempFlags;
+ var reservedNamesStack;
+ var reservedNames;
+ var reservedPrivateNamesStack;
+ var reservedPrivateNames;
+ var preserveSourceNewlines = printerOptions.preserveSourceNewlines;
+ var nextListElementPos;
+ var writer;
+ var ownWriter;
+ var write = writeBase;
+ var isOwnFileEmit;
+ var bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
+ var relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
+ var recordInternalSection = printerOptions.recordInternalSection;
+ var sourceFileTextPos = 0;
+ var sourceFileTextKind = "text" /* Text */;
+ var sourceMapsDisabled = true;
+ var sourceMapGenerator;
+ var sourceMapSource;
+ var sourceMapSourceIndex = -1;
+ var mostRecentlyAddedSourceMapSource;
+ var mostRecentlyAddedSourceMapSourceIndex = -1;
+ var containerPos = -1;
+ var containerEnd = -1;
+ var declarationListContainerEnd = -1;
+ var currentLineMap;
+ var detachedCommentsInfo;
+ var hasWrittenComment = false;
+ var commentsDisabled = !!printerOptions.removeComments;
+ var lastSubstitution;
+ var currentParenthesizerRule;
+ var { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
+ var parenthesizer = factory.parenthesizer;
+ var typeArgumentParenthesizerRuleSelector = {
select: (index) => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : void 0
};
- const emitBinaryExpression = createEmitBinaryExpression();
+ var emitBinaryExpression = createEmitBinaryExpression();
reset2();
return {
// public API
@@ -109459,9 +110211,9 @@ ${lanes.join("\n")}
formattedNameTempFlagsStack = [];
formattedNameTempFlags = /* @__PURE__ */ new Map();
privateNameTempFlagsStack = [];
- privateNameTempFlags = TempFlags.Auto;
+ privateNameTempFlags = 0 /* Auto */;
tempFlagsStack = [];
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
reservedNamesStack = [];
reservedNames = void 0;
reservedPrivateNamesStack = [];
@@ -110430,7 +111182,7 @@ ${lanes.join("\n")}
}
function emitTypeLiteral(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -110619,7 +111371,7 @@ ${lanes.join("\n")}
}
function emitObjectLiteralExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -111385,7 +112137,7 @@ ${lanes.join("\n")}
}
function emitClassDeclarationOrExpression(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -111418,7 +112170,7 @@ ${lanes.join("\n")}
}
function emitInterfaceDeclaration(node) {
pushPrivateNameGenerationScope(
- TempFlags.Auto,
+ 0 /* Auto */,
/*newReservedMemberNames*/
void 0
);
@@ -112861,7 +113613,7 @@ ${lanes.join("\n")}
return;
}
tempFlagsStack.push(tempFlags);
- tempFlags = TempFlags.Auto;
+ tempFlags = 0 /* Auto */;
formattedNameTempFlagsStack.push(formattedNameTempFlags);
formattedNameTempFlags = void 0;
reservedNamesStack.push(reservedNames);
@@ -113047,7 +113799,7 @@ ${lanes.join("\n")}
case "#":
return privateNameTempFlags;
default:
- return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : TempFlags.Auto;
+ return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : 0 /* Auto */;
}
}
function setTempFlags(formattedNameKey, flags) {
@@ -113071,7 +113823,7 @@ ${lanes.join("\n")}
const key = formatGeneratedName(privateName, prefix, "", suffix);
let tempFlags2 = getTempFlags(key);
if (flags && !(tempFlags2 & flags)) {
- const name = flags === TempFlags._i ? "_i" : "_n";
+ const name = flags === 268435456 /* _i */ ? "_i" : "_n";
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
if (isUniqueName(fullName, privateName)) {
tempFlags2 |= flags;
@@ -113085,7 +113837,7 @@ ${lanes.join("\n")}
}
}
while (true) {
- const count = tempFlags2 & TempFlags.CountMask;
+ const count = tempFlags2 & 268435455 /* CountMask */;
tempFlags2++;
if (count !== 8 && count !== 13) {
const name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
@@ -113229,7 +113981,7 @@ ${lanes.join("\n")}
return generateNameCached(node.name, privateName);
}
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reservedInNestedScopes*/
false,
privateName,
@@ -113286,7 +114038,7 @@ ${lanes.join("\n")}
return generateNameForMethodOrAccessor(node, privateName, prefix, suffix);
case 164 /* ComputedPropertyName */:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
true,
privateName,
@@ -113295,7 +114047,7 @@ ${lanes.join("\n")}
);
default:
return makeTempVariableName(
- TempFlags.Auto,
+ 0 /* Auto */,
/*reserveInNestedScopes*/
false,
privateName,
@@ -113310,11 +114062,11 @@ ${lanes.join("\n")}
const suffix = formatGeneratedNamePart(autoGenerate.suffix);
switch (autoGenerate.flags & 7 /* KindMask */) {
case 1 /* Auto */:
- return makeTempVariableName(TempFlags.Auto, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
+ return makeTempVariableName(0 /* Auto */, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
case 2 /* Loop */:
Debug.assertNode(name, isIdentifier);
return makeTempVariableName(
- TempFlags._i,
+ 268435456 /* _i */,
!!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
/*privateName*/
false,
@@ -113796,7 +114548,7 @@ ${lanes.join("\n")}
function getEmitListItem(emit, parenthesizerRule) {
return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
}
- var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon, TempFlags;
+ var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon;
var init_emitter = __esm({
"src/compiler/emitter.ts"() {
"use strict";
@@ -113847,16 +114599,10 @@ ${lanes.join("\n")}
getDeclarationStatementsForSourceFile: notImplemented,
isImportRequiredByAugmentation: notImplemented
};
- createPrinterWithDefaults = memoize(() => createPrinter({}));
- createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
- createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
- createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
- TempFlags = /* @__PURE__ */ ((TempFlags2) => {
- TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
- TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
- TempFlags2[TempFlags2["_i"] = 268435456] = "_i";
- return TempFlags2;
- })(TempFlags || {});
+ createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
+ createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
+ createPrinterWithRemoveCommentsNeverAsciiEscape = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
}
});
@@ -114810,14 +115556,14 @@ ${lanes.join("\n")}
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
return {
nameAndMode: moduleResolutionNameAndModeGetter,
- resolve: (moduleName, resoluionMode) => resolveModuleName(
+ resolve: (moduleName, resolutionMode) => resolveModuleName(
moduleName,
containingFile,
options,
host,
cache,
redirectedReference,
- resoluionMode
+ resolutionMode
)
};
}
@@ -116256,11 +117002,19 @@ ${lanes.join("\n")}
diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
} else if (isClassDeclaration(parent2)) {
const exportIndex = findIndex(parent2.modifiers, isExportModifier);
- const defaultIndex = findIndex(parent2.modifiers, isDefaultModifier);
- if (exportIndex >= 0 && decoratorIndex < exportIndex) {
- diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_must_come_after_export_or_export_default_in_JavaScript_files));
- } else if (defaultIndex >= 0 && decoratorIndex < defaultIndex) {
- diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ if (exportIndex >= 0) {
+ const defaultIndex = findIndex(parent2.modifiers, isDefaultModifier);
+ if (decoratorIndex > exportIndex && defaultIndex >= 0 && decoratorIndex < defaultIndex) {
+ diagnostics.push(createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorators_are_not_valid_here));
+ } else if (exportIndex >= 0 && decoratorIndex < exportIndex) {
+ const trailingDecoratorIndex = findIndex(parent2.modifiers, isDecorator, exportIndex);
+ if (trailingDecoratorIndex >= 0) {
+ diagnostics.push(addRelatedInfo(
+ createDiagnosticForNode2(parent2.modifiers[trailingDecoratorIndex], Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export),
+ createDiagnosticForNode2(parent2.modifiers[decoratorIndex], Diagnostics.Decorator_used_before_export_here)
+ ));
+ }
+ }
}
}
}
@@ -116438,7 +117192,7 @@ ${lanes.join("\n")}
let imports;
let moduleAugmentations;
let ambientModules;
- if ((options.isolatedModules || isExternalModuleFile) && !file.isDeclarationFile) {
+ if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
if (options.importHelpers) {
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
}
@@ -117159,12 +117913,12 @@ ${lanes.join("\n")}
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
}
- if (options.isolatedModules) {
+ if (options.isolatedModules || options.verbatimModuleSyntax) {
if (options.out) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
if (options.outFile) {
- createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
+ createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
}
}
if (options.inlineSourceMap) {
@@ -117375,10 +118129,10 @@ ${lanes.join("\n")}
}
}
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
- createDiagnosticForOptionName(Diagnostics.Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
}
+ const moduleKind = getEmitModuleKind(options);
if (options.verbatimModuleSyntax) {
- const moduleKind = getEmitModuleKind(options);
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
}
@@ -117397,13 +118151,16 @@ ${lanes.join("\n")}
}
const moduleResolution = getEmitModuleResolutionKind(options);
if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports");
}
if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports");
}
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
- createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
+ }
+ if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
}
if (!options.noEmit && !options.suppressOutputPathCheck) {
const emitHost = getEmitHost();
@@ -117558,7 +118315,7 @@ ${lanes.join("\n")}
if (version2 === "6.0" /* v6_0 */) {
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
} else {
- createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
+ createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
}
}
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
@@ -118721,7 +119478,7 @@ ${lanes.join("\n")}
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
}
const compilerOptions = programOfThisState.getCompilerOptions();
- if (compilerOptions && (compilerOptions.isolatedModules || outFile(compilerOptions))) {
+ if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
return [sourceFileWithUpdatedShape];
}
const seenFileNamesMap = /* @__PURE__ */ new Map();
@@ -119136,7 +119893,7 @@ ${lanes.join("\n")}
return;
if (!isChangedSignature(state, affectedFile.resolvedPath))
return;
- if (state.compilerOptions.isolatedModules) {
+ if (getIsolatedModules(state.compilerOptions)) {
const seenFileNamesMap = /* @__PURE__ */ new Map();
seenFileNamesMap.set(affectedFile.resolvedPath, true);
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
@@ -119229,14 +119986,17 @@ ${lanes.join("\n")}
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
const fileNames = [];
const fileNameToFileId = /* @__PURE__ */ new Map();
+ const root = [];
if (outFile(state.compilerOptions)) {
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
- toFileId(key);
+ const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
});
const program2 = {
fileNames,
fileInfos: fileInfos2,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
outSignature: state.outSignature,
latestChangedDtsFile,
@@ -119264,6 +120024,7 @@ ${lanes.join("\n")}
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
var _a3, _b2;
const fileId = toFileId(key);
+ tryAddRoot(key, fileId);
Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
const oldSignature = (_a3 = state.oldSignatures) == null ? void 0 : _a3.get(key);
const actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value.signature;
@@ -119363,6 +120124,7 @@ ${lanes.join("\n")}
const program = {
fileNames,
fileInfos,
+ root,
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
fileIdsList,
referencedMap,
@@ -119398,6 +120160,24 @@ ${lanes.join("\n")}
}
return fileIdListId;
}
+ function tryAddRoot(path, fileId) {
+ const file = state.program.getSourceFile(path);
+ if (!state.program.getFileIncludeReasons().get(file.path).some((r) => r.kind === 0 /* RootFile */))
+ return;
+ if (!root.length)
+ return root.push(fileId);
+ const last2 = root[root.length - 1];
+ const isLastStartEnd = isArray(last2);
+ if (isLastStartEnd && last2[1] === fileId - 1)
+ return last2[1] = fileId;
+ if (isLastStartEnd || root.length === 1 || last2 !== fileId - 1)
+ return root.push(fileId);
+ const lastButOne = root[root.length - 2];
+ if (!isNumber(lastButOne) || lastButOne !== last2 - 1)
+ return root.push(fileId);
+ root[root.length - 2] = [lastButOne, fileId];
+ return root.length = root.length - 1;
+ }
function convertToProgramBuildInfoCompilerOptions(options) {
let result;
const { optionsNameMap } = getOptionsNameMap();
@@ -119905,12 +120685,28 @@ ${lanes.join("\n")}
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
const fileInfos = /* @__PURE__ */ new Map();
+ let rootIndex = 0;
+ const roots = [];
program.fileInfos.forEach((fileInfo, index) => {
const path = toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
const version2 = isString(fileInfo) ? fileInfo : fileInfo.version;
fileInfos.set(path, version2);
+ if (rootIndex < program.root.length) {
+ const current = program.root[rootIndex];
+ const fileId = index + 1;
+ if (isArray(current)) {
+ if (current[0] <= fileId && fileId <= current[1]) {
+ roots.push(path);
+ if (current[1] === fileId)
+ rootIndex++;
+ }
+ } else if (current === fileId) {
+ roots.push(path);
+ rootIndex++;
+ }
+ }
});
- return fileInfos;
+ return { fileInfos, roots };
}
function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
return {
@@ -120854,7 +121650,7 @@ ${lanes.join("\n")}
return contains(screenStartingMessageCodes, diagnostic.code) ? newLine + newLine : newLine;
}
function getLocaleTimeString(system) {
- return !system.now ? new Date().toLocaleTimeString() : (
+ return !system.now ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : (
// On some systems / builds of Node, there's a non-breaking space between the time and AM/PM.
// This branch is solely for testing, so just switch it to a normal space for baseline stability.
// See:
@@ -122243,13 +123039,14 @@ ${lanes.join("\n")}
UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 9] = "OutOfDateOptions";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 10] = "UpstreamOutOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 11] = "UpstreamBlocked";
- UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 12] = "ComputingUpstream";
- UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 13] = "TsVersionOutputOfDate";
- UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 14] = "UpToDateWithInputFileText";
- UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 15] = "ContainerOnly";
- UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 16] = "ForceBuild";
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 10] = "OutOfDateRoots";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 11] = "UpstreamOutOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 12] = "UpstreamBlocked";
+ UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 13] = "ComputingUpstream";
+ UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 14] = "TsVersionOutputOfDate";
+ UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 15] = "UpToDateWithInputFileText";
+ UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 16] = "ContainerOnly";
+ UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 17] = "ForceBuild";
return UpToDateStatusType2;
})(UpToDateStatusType || {});
}
@@ -122269,7 +123066,7 @@ ${lanes.join("\n")}
return getOrCreateValueFromConfigFileMap(configFileMap, resolved, () => /* @__PURE__ */ new Map());
}
function getCurrentTime(host) {
- return host.now ? host.now() : new Date();
+ return host.now ? host.now() : /* @__PURE__ */ new Date();
}
function isCircularBuildOrder(buildOrder) {
return !!buildOrder && !!buildOrder.buildOrder;
@@ -123131,7 +123928,7 @@ ${lanes.join("\n")}
}
continue;
}
- if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 14 /* UpToDateWithInputFileText */) {
+ if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
return {
kind: 2 /* UpdateOutputFileStamps */,
@@ -123143,7 +123940,7 @@ ${lanes.join("\n")}
};
}
}
- if (status.type === 11 /* UpstreamBlocked */) {
+ if (status.type === 12 /* UpstreamBlocked */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -123157,7 +123954,7 @@ ${lanes.join("\n")}
}
continue;
}
- if (status.type === 15 /* ContainerOnly */) {
+ if (status.type === 16 /* ContainerOnly */) {
verboseReportProjectStatus(state, project, status);
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
projectPendingBuild.delete(projectPath);
@@ -123344,31 +124141,31 @@ ${lanes.join("\n")}
var _a2, _b;
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
return {
- type: 15 /* ContainerOnly */
+ type: 16 /* ContainerOnly */
};
}
let referenceStatuses;
const force = !!state.options.force;
if (project.projectReferences) {
- state.projectStatus.set(resolvedPath, { type: 12 /* ComputingUpstream */ });
+ state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
for (const ref of project.projectReferences) {
const resolvedRef = resolveProjectReferencePath(ref);
const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
- if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
+ if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
continue;
}
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
+ if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */) {
return {
- type: 11 /* UpstreamBlocked */,
+ type: 12 /* UpstreamBlocked */,
upstreamProjectName: ref.path,
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
+ upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
};
}
if (refStatus.type !== 1 /* UpToDate */) {
return {
- type: 10 /* UpstreamOutOfDate */,
+ type: 11 /* UpstreamOutOfDate */,
upstreamProjectName: ref.path
};
}
@@ -123377,7 +124174,7 @@ ${lanes.join("\n")}
}
}
if (force)
- return { type: 16 /* ForceBuild */ };
+ return { type: 17 /* ForceBuild */ };
const { host } = state;
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
let oldestOutputFileName;
@@ -123410,7 +124207,7 @@ ${lanes.join("\n")}
}
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== version) {
return {
- type: 13 /* TsVersionOutputOfDate */,
+ type: 14 /* TsVersionOutputOfDate */,
version: buildInfo.version
};
}
@@ -123435,6 +124232,7 @@ ${lanes.join("\n")}
let newestInputFileName = void 0;
let newestInputFileTime = minimumDate;
let pseudoInputUpToDate = false;
+ const seenRoots = /* @__PURE__ */ new Set();
for (const inputFile of project.fileNames) {
const inputTime = getModifiedTime2(state, inputFile);
if (inputTime === missingFileModifiedTime) {
@@ -123449,7 +124247,7 @@ ${lanes.join("\n")}
if (buildInfoProgram) {
if (!buildInfoVersionMap)
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
- version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
+ version2 = buildInfoVersionMap.fileInfos.get(toPath2(state, inputFile));
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
if (version2 && version2 === currentVersion)
@@ -123467,6 +124265,21 @@ ${lanes.join("\n")}
newestInputFileName = inputFile;
newestInputFileTime = inputTime;
}
+ if (buildInfoProgram)
+ seenRoots.add(toPath2(state, inputFile));
+ }
+ if (buildInfoProgram) {
+ if (!buildInfoVersionMap)
+ buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
+ for (const existingRoot of buildInfoVersionMap.roots) {
+ if (!seenRoots.has(existingRoot)) {
+ return {
+ type: 10 /* OutOfDateRoots */,
+ buildInfoFile: buildInfoPath,
+ inputFile: existingRoot
+ };
+ }
+ }
}
if (!buildInfoPath) {
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
@@ -123548,7 +124361,7 @@ ${lanes.join("\n")}
};
}
return {
- type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 14 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
+ type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
newestInputFileTime,
newestInputFileName,
oldestOutputFileName
@@ -123667,7 +124480,7 @@ ${lanes.join("\n")}
}
break;
}
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
case 2 /* UpToDateWithUpstreamTypes */:
case 3 /* OutOfDateWithPrepend */:
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
@@ -123678,7 +124491,7 @@ ${lanes.join("\n")}
});
}
break;
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
clearProjectStatus(state, nextProjectPath);
}
@@ -124129,6 +124942,14 @@ ${lanes.join("\n")}
relName(state, configFileName),
relName(state, status.buildInfoFile)
);
+ case 10 /* OutOfDateRoots */:
+ return reportStatus(
+ state,
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
+ relName(state, configFileName),
+ relName(state, status.buildInfoFile),
+ relName(state, status.inputFile)
+ );
case 1 /* UpToDate */:
if (status.newestInputFileTime !== void 0) {
return reportStatus(
@@ -124153,20 +124974,20 @@ ${lanes.join("\n")}
Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
relName(state, configFileName)
);
- case 14 /* UpToDateWithInputFileText */:
+ case 15 /* UpToDateWithInputFileText */:
return reportStatus(
state,
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
relName(state, configFileName)
);
- case 10 /* UpstreamOutOfDate */:
+ case 11 /* UpstreamOutOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);
- case 11 /* UpstreamBlocked */:
+ case 12 /* UpstreamBlocked */:
return reportStatus(
state,
status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
@@ -124180,7 +125001,7 @@ ${lanes.join("\n")}
relName(state, configFileName),
status.reason
);
- case 13 /* TsVersionOutputOfDate */:
+ case 14 /* TsVersionOutputOfDate */:
return reportStatus(
state,
Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
@@ -124188,14 +125009,14 @@ ${lanes.join("\n")}
status.version,
version
);
- case 16 /* ForceBuild */:
+ case 17 /* ForceBuild */:
return reportStatus(
state,
Diagnostics.Project_0_is_being_forcibly_rebuilt,
relName(state, configFileName)
);
- case 15 /* ContainerOnly */:
- case 12 /* ComputingUpstream */:
+ case 16 /* ContainerOnly */:
+ case 13 /* ComputingUpstream */:
break;
default:
assertType(status);
@@ -124213,8 +125034,8 @@ ${lanes.join("\n")}
init_ts2();
init_ts2();
init_ts_performance();
- minimumDate = new Date(-864e13);
- maximumDate = new Date(864e13);
+ minimumDate = /* @__PURE__ */ new Date(-864e13);
+ maximumDate = /* @__PURE__ */ new Date(864e13);
InvalidatedProjectKind = /* @__PURE__ */ ((InvalidatedProjectKind2) => {
InvalidatedProjectKind2[InvalidatedProjectKind2["Build"] = 0] = "Build";
InvalidatedProjectKind2[InvalidatedProjectKind2["UpdateBundle"] = 1] = "UpdateBundle";
@@ -124645,7 +125466,7 @@ ${lanes.join("\n")}
return index >= 0 && index < sys.args.length - 1 ? sys.args[index + 1] : void 0;
}
function nowString() {
- const d = new Date();
+ const d = /* @__PURE__ */ new Date();
return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`;
}
var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, Arguments;
@@ -126291,6 +127112,13 @@ ${lanes.join("\n")}
}
return false;
}
+ function isStringAndEmptyAnonymousObjectIntersection(type) {
+ if (!type.isIntersection()) {
+ return false;
+ }
+ const { types, checker } = type;
+ return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
+ }
function isPunctuation(kind) {
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
}
@@ -126455,7 +127283,7 @@ ${lanes.join("\n")}
};
}
function moduleResolutionUsesNodeModules(moduleResolution) {
- return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */;
+ return moduleResolution === 2 /* Node10 */ || moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
}
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : void 0;
@@ -126471,7 +127299,7 @@ ${lanes.join("\n")}
);
}
function makeStringLiteral(text, quotePreference) {
- return factory.createStringLiteral(text, quotePreference === QuotePreference.Single);
+ return factory.createStringLiteral(text, quotePreference === 0 /* Single */);
}
function quotePreferenceFromString(str, sourceFile) {
return isStringDoubleQuoted(str, sourceFile) ? 1 /* Double */ : 0 /* Single */;
@@ -127102,7 +127930,7 @@ ${lanes.join("\n")}
return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
}
function getContextualTypeFromParent(node, checker, contextFlags) {
- const { parent: parent2 } = node;
+ const parent2 = walkUpParenthesizedExpressions(node.parent);
switch (parent2.kind) {
case 211 /* NewExpression */:
return checker.getContextualType(parent2, contextFlags);
@@ -127111,7 +127939,7 @@ ${lanes.join("\n")}
return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags);
}
case 292 /* CaseClause */:
- return parent2.expression === node ? getSwitchedType(parent2, checker) : void 0;
+ return getSwitchedType(parent2, checker);
default:
return checker.getContextualType(node, contextFlags);
}
@@ -127373,7 +128201,13 @@ ${lanes.join("\n")}
function createPackageJsonImportFilter(fromFile, preferences, host) {
const packageJsons = (host.getPackageJsonsVisibleToFile && host.getPackageJsonsVisibleToFile(fromFile.fileName) || getPackageJsonsVisibleToFile(fromFile.fileName, host)).filter((p) => p.parseable);
let usesNodeCoreModules;
- return { allowsImportingAmbientModule, allowsImportingSourceFile, allowsImportingSpecifier };
+ let ambientModuleCache;
+ let sourceFileCache;
+ return {
+ allowsImportingAmbientModule,
+ allowsImportingSourceFile,
+ allowsImportingSpecifier
+ };
function moduleSpecifierIsCoveredByPackageJson(specifier) {
const packageName = getNodeModuleRootSpecifier(specifier);
for (const packageJson of packageJsons) {
@@ -127387,26 +128221,49 @@ ${lanes.join("\n")}
if (!packageJsons.length || !moduleSymbol.valueDeclaration) {
return true;
}
- const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
- const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
- if (typeof declaringNodeModuleName === "undefined") {
- return true;
+ if (!ambientModuleCache) {
+ ambientModuleCache = /* @__PURE__ */ new Map();
+ } else {
+ const cached = ambientModuleCache.get(moduleSymbol);
+ if (cached !== void 0) {
+ return cached;
+ }
}
const declaredModuleSpecifier = stripQuotes(moduleSymbol.getName());
if (isAllowedCoreNodeModulesImport(declaredModuleSpecifier)) {
+ ambientModuleCache.set(moduleSymbol, true);
return true;
}
- return moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
+ const declaringSourceFile = moduleSymbol.valueDeclaration.getSourceFile();
+ const declaringNodeModuleName = getNodeModulesPackageNameFromFileName(declaringSourceFile.fileName, moduleSpecifierResolutionHost);
+ if (typeof declaringNodeModuleName === "undefined") {
+ ambientModuleCache.set(moduleSymbol, true);
+ return true;
+ }
+ const result = moduleSpecifierIsCoveredByPackageJson(declaringNodeModuleName) || moduleSpecifierIsCoveredByPackageJson(declaredModuleSpecifier);
+ ambientModuleCache.set(moduleSymbol, result);
+ return result;
}
function allowsImportingSourceFile(sourceFile, moduleSpecifierResolutionHost) {
if (!packageJsons.length) {
return true;
}
+ if (!sourceFileCache) {
+ sourceFileCache = /* @__PURE__ */ new Map();
+ } else {
+ const cached = sourceFileCache.get(sourceFile);
+ if (cached !== void 0) {
+ return cached;
+ }
+ }
const moduleSpecifier = getNodeModulesPackageNameFromFileName(sourceFile.fileName, moduleSpecifierResolutionHost);
if (!moduleSpecifier) {
+ sourceFileCache.set(sourceFile, true);
return true;
}
- return moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ const result = moduleSpecifierIsCoveredByPackageJson(moduleSpecifier);
+ sourceFileCache.set(sourceFile, result);
+ return result;
}
function allowsImportingSpecifier(moduleSpecifier) {
if (!packageJsons.length || isAllowedCoreNodeModulesImport(moduleSpecifier)) {
@@ -127554,10 +128411,13 @@ ${lanes.join("\n")}
return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
}
function getDefaultLikeExportNameFromDeclaration(symbol) {
- return firstDefined(symbol.declarations, (d) => {
- var _a2;
- return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : void 0;
- });
+ return firstDefined(
+ symbol.declarations,
+ (d) => {
+ var _a2, _b;
+ return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text;
+ }
+ );
}
function getSymbolParentOrFail(symbol) {
var _a2;
@@ -127626,6 +128486,64 @@ ${lanes.join("\n")}
function isSourceFileFromLibrary(program, node) {
return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
}
+ function newCaseClauseTracker(checker, clauses) {
+ const existingStrings = /* @__PURE__ */ new Set();
+ const existingNumbers = /* @__PURE__ */ new Set();
+ const existingBigInts = /* @__PURE__ */ new Set();
+ for (const clause of clauses) {
+ if (!isDefaultClause(clause)) {
+ const expression = skipParentheses(clause.expression);
+ if (isLiteralExpression(expression)) {
+ switch (expression.kind) {
+ case 14 /* NoSubstitutionTemplateLiteral */:
+ case 10 /* StringLiteral */:
+ existingStrings.add(expression.text);
+ break;
+ case 8 /* NumericLiteral */:
+ existingNumbers.add(parseInt(expression.text));
+ break;
+ case 9 /* BigIntLiteral */:
+ const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
+ if (parsedBigInt) {
+ existingBigInts.add(pseudoBigIntToString(parsedBigInt));
+ }
+ break;
+ }
+ } else {
+ const symbol = checker.getSymbolAtLocation(clause.expression);
+ if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
+ const enumValue = checker.getConstantValue(symbol.valueDeclaration);
+ if (enumValue !== void 0) {
+ addValue(enumValue);
+ }
+ }
+ }
+ }
+ }
+ return {
+ addValue,
+ hasValue
+ };
+ function addValue(value) {
+ switch (typeof value) {
+ case "string":
+ existingStrings.add(value);
+ break;
+ case "number":
+ existingNumbers.add(value);
+ }
+ }
+ function hasValue(value) {
+ switch (typeof value) {
+ case "string":
+ return existingStrings.has(value);
+ case "number":
+ return existingNumbers.has(value);
+ case "object":
+ return existingBigInts.has(pseudoBigIntToString(value));
+ }
+ }
+ }
var scanner, SemanticMeaning, tripleSlashDirectivePrefixRegex, typeKeywords, QuotePreference, displayPartWriter, lineFeed2, ANONYMOUS, syntaxMayBeASICandidate;
var init_utilities4 = __esm({
"src/services/utilities.ts"() {
@@ -127922,13 +128840,25 @@ ${lanes.join("\n")}
const autoImportProvider = useAutoImportProvider && ((_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host));
if (autoImportProvider) {
const start = timestamp();
- forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => cb(
- module2,
- file,
- autoImportProvider,
- /*isFromPackageJson*/
- true
- ));
+ const checker = program.getTypeChecker();
+ forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => {
+ if (file && !program.getSourceFile(file.fileName) || !file && !checker.resolveName(
+ module2.name,
+ /*location*/
+ void 0,
+ 1536 /* Module */,
+ /*excludeGlobals*/
+ false
+ )) {
+ cb(
+ module2,
+ file,
+ autoImportProvider,
+ /*isFromPackageJson*/
+ true
+ );
+ }
+ });
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp() - start}`);
}
}
@@ -132429,7 +133359,8 @@ ${lanes.join("\n")}
options.triggerCharacter,
options.triggerKind,
cancellationToken,
- formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
+ formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
+ options.includeSymbol
);
}
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
@@ -133335,9 +134266,9 @@ ${lanes.join("\n")}
"src/services/services.ts"() {
"use strict";
init_ts4();
+ init_ts4();
init_ts_NavigateTo();
init_ts_NavigationBar();
- init_ts4();
servicesVersion = "0.8";
NodeObject = class {
constructor(kind, pos, end) {
@@ -136343,8 +137274,8 @@ ${lanes.join("\n")}
var init_addEmptyExportDeclaration = __esm({
"src/services/codefixes/addEmptyExportDeclaration.ts"() {
"use strict";
- init_ts_codefix();
init_ts4();
+ init_ts_codefix();
registerCodeFix({
errorCodes: [
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
@@ -138708,8 +139639,8 @@ ${lanes.join("\n")}
var init_convertToEsModule = __esm({
"src/services/codefixes/convertToEsModule.ts"() {
"use strict";
- init_ts_codefix();
init_ts4();
+ init_ts_codefix();
registerCodeFix({
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
getCodeActions(context) {
@@ -139107,6 +140038,7 @@ ${lanes.join("\n")}
sourceFile,
symbol,
symbolName2,
+ moduleSymbol,
/*isJsxTagName*/
false,
program,
@@ -139118,7 +140050,6 @@ ${lanes.join("\n")}
const fix = getImportFixForSymbol(
sourceFile,
Debug.checkDefined(exportInfo),
- moduleSymbol,
program,
/*position*/
void 0,
@@ -139135,13 +140066,13 @@ ${lanes.join("\n")}
var _a2, _b;
const { fix, symbolName: symbolName2 } = info;
switch (fix.kind) {
- case ImportFixKind.UseNamespace:
+ case 0 /* UseNamespace */:
addToNamespace.push(fix);
break;
- case ImportFixKind.JsdocTypeImport:
+ case 1 /* JsdocTypeImport */:
importType.push(fix);
break;
- case ImportFixKind.AddToExisting: {
+ case 2 /* AddToExisting */: {
const { importClauseOrBindingPattern, importKind, addAsTypeOnly } = fix;
const key = String(getNodeId(importClauseOrBindingPattern));
let entry = addToExisting.get(key);
@@ -139160,7 +140091,7 @@ ${lanes.join("\n")}
}
break;
}
- case ImportFixKind.AddNew: {
+ case 3 /* AddNew */: {
const { moduleSpecifier, importKind, useRequire, addAsTypeOnly } = fix;
const entry = getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly);
Debug.assert(entry.useRequire === useRequire, "(Add new) Tried to add an `import` and a `require` for the same module");
@@ -139181,7 +140112,7 @@ ${lanes.join("\n")}
}
break;
}
- case ImportFixKind.PromoteTypeOnly:
+ case 4 /* PromoteTypeOnly */:
break;
default:
Debug.assertNever(fix, `fix wasn't never - got kind ${fix.kind}`);
@@ -139208,13 +140139,13 @@ ${lanes.join("\n")}
namespaceLikeImport: void 0,
useRequire
};
- if (importKind === 1 /* Default */ && addAsTypeOnly === AddAsTypeOnly.Required) {
+ if (importKind === 1 /* Default */ && addAsTypeOnly === 2 /* Required */) {
if (typeOnlyEntry)
return typeOnlyEntry;
newImports.set(typeOnlyKey, newEntry);
return newEntry;
}
- if (addAsTypeOnly === AddAsTypeOnly.Allowed && (typeOnlyEntry || nonTypeOnlyEntry)) {
+ if (addAsTypeOnly === 1 /* Allowed */ && (typeOnlyEntry || nonTypeOnlyEntry)) {
return typeOnlyEntry || nonTypeOnlyEntry;
}
if (nonTypeOnlyEntry) {
@@ -139255,7 +140186,8 @@ ${lanes.join("\n")}
quotePreference,
defaultImport,
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
- namespaceLikeImport
+ namespaceLikeImport,
+ compilerOptions
);
newDeclarations = combine(newDeclarations, declarations);
});
@@ -139296,13 +140228,19 @@ ${lanes.join("\n")}
return result && { ...result, computedWithoutCacheCount };
}
}
- function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
+ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
const compilerOptions = program.getCompilerOptions();
- const exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, isJsxTagName, program, host, preferences, cancellationToken);
- Debug.assertIsDefined(exportInfos);
+ let exportInfos;
+ if (exportMapKey) {
+ exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
+ } else {
+ exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
+ Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
+ }
const useRequire = shouldUseRequire(sourceFile, program);
const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
- const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
+ const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
return {
moduleSpecifier: fix.moduleSpecifier,
codeAction: codeFixActionToCodeAction(codeActionForFix(
@@ -139324,23 +140262,22 @@ ${lanes.join("\n")}
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
}
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
- Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
+ function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
}
function codeFixActionToCodeAction({ description: description2, changes, commands }) {
return { description: description2, changes, commands };
}
- function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
+ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
const getChecker = createGetChecker(program, host);
return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
- if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
+ if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
return info;
}
});
}
- function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
+ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
var _a2, _b;
const compilerOptions = program.getCompilerOptions();
const mainProgramInfo = getInfoWithChecker(
@@ -139362,7 +140299,7 @@ ${lanes.join("\n")}
if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
}
- const named = checker.tryGetMemberInModuleExportsAndProperties(symbol.name, moduleSymbol);
+ const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
if (named && skipAlias(named, checker) === symbol) {
return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
}
@@ -139428,7 +140365,7 @@ ${lanes.join("\n")}
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
return 2 /* Required */;
}
- if ((compilerOptions.isolatedModules && compilerOptions.preserveValueImports || compilerOptions.verbatimModuleSyntax) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
+ if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
return 2 /* Required */;
}
return 1 /* Allowed */;
@@ -139912,7 +140849,14 @@ ${lanes.join("\n")}
insertImports(
changes,
sourceFile,
- getDeclarations(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport),
+ getDeclarations(
+ moduleSpecifier,
+ quotePreference,
+ defaultImport,
+ namedImports,
+ namespaceLikeImport,
+ compilerOptions
+ ),
/*blankLineBetween*/
true,
preferences
@@ -139936,7 +140880,7 @@ ${lanes.join("\n")}
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
}
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
- const convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax;
+ const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
switch (aliasDeclaration.kind) {
case 273 /* ImportSpecifier */:
if (aliasDeclaration.isTypeOnly) {
@@ -140010,7 +140954,7 @@ ${lanes.join("\n")}
}
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
- const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions.preserveValueImports && compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax);
+ const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
if (defaultImport) {
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
@@ -140094,11 +141038,11 @@ ${lanes.join("\n")}
function needsTypeOnly({ addAsTypeOnly }) {
return addAsTypeOnly === 2 /* Required */;
}
- function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
+ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
let statements;
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
- const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
+ const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
statements = combine(statements, makeImport(
defaultImport && factory.createIdentifier(defaultImport.name),
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
@@ -140221,7 +141165,7 @@ ${lanes.join("\n")}
}
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
}
- var importFixName, importFixId, errorCodes17, ImportFixKind, AddAsTypeOnly;
+ var importFixName, importFixId, errorCodes17;
var init_importFixes = __esm({
"src/services/codefixes/importFixes.ts"() {
"use strict";
@@ -140280,20 +141224,6 @@ ${lanes.join("\n")}
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
}
});
- ImportFixKind = /* @__PURE__ */ ((ImportFixKind2) => {
- ImportFixKind2[ImportFixKind2["UseNamespace"] = 0] = "UseNamespace";
- ImportFixKind2[ImportFixKind2["JsdocTypeImport"] = 1] = "JsdocTypeImport";
- ImportFixKind2[ImportFixKind2["AddToExisting"] = 2] = "AddToExisting";
- ImportFixKind2[ImportFixKind2["AddNew"] = 3] = "AddNew";
- ImportFixKind2[ImportFixKind2["PromoteTypeOnly"] = 4] = "PromoteTypeOnly";
- return ImportFixKind2;
- })(ImportFixKind || {});
- AddAsTypeOnly = /* @__PURE__ */ ((AddAsTypeOnly2) => {
- AddAsTypeOnly2[AddAsTypeOnly2["Allowed"] = 1] = "Allowed";
- AddAsTypeOnly2[AddAsTypeOnly2["Required"] = 2] = "Required";
- AddAsTypeOnly2[AddAsTypeOnly2["NotAllowed"] = 4] = "NotAllowed";
- return AddAsTypeOnly2;
- })(AddAsTypeOnly || {});
}
});
@@ -140746,7 +141676,7 @@ ${lanes.join("\n")}
}
function updateExport(changes, program, sourceFile, node, names) {
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
- const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || find(namedExports, (e) => e.isTypeOnly));
+ const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
changes.replaceNode(
sourceFile,
node,
@@ -140778,7 +141708,7 @@ ${lanes.join("\n")}
factory.createNamedExports(createExportSpecifiers(
names,
/*allowTypeModifier*/
- !!program.getCompilerOptions().isolatedModules
+ getIsolatedModules(program.getCompilerOptions())
)),
/*moduleSpecifier*/
void 0,
@@ -141741,7 +142671,7 @@ ${lanes.join("\n")}
}
if (isObjectLiteralType(type)) {
const props = map(checker.getPropertiesOfType(type), (prop) => {
- const initializer = prop.valueDeclaration ? tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeAtLocation(prop.valueDeclaration), enclosingDeclaration) : createUndefined();
+ const initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), enclosingDeclaration);
return factory.createPropertyAssignment(prop.name, initializer);
});
return factory.createObjectLiteralExpression(
@@ -142308,8 +143238,8 @@ ${lanes.join("\n")}
var init_fixModuleAndTargetOptions = __esm({
"src/services/codefixes/fixModuleAndTargetOptions.ts"() {
"use strict";
- init_ts_codefix();
init_ts4();
+ init_ts_codefix();
registerCodeFix({
errorCodes: [
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
@@ -145062,13 +145992,7 @@ ${lanes.join("\n")}
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
if (length(signatures)) {
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
- return checker.typeToTypeNode(
- type,
- enclosingDeclaration,
- /*flags*/
- void 0,
- getNoopSymbolTrackerWithResolver(context)
- );
+ return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
}
}
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
@@ -145360,7 +146284,14 @@ ${lanes.join("\n")}
changeTracker.replaceNode(file, declaration, property);
}
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
- const assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
+ if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
+ if (assignment === declaration)
+ assignment = factory.cloneNode(assignment);
+ assignment.modifiers = void 0;
+ assignment.questionToken = void 0;
+ assignment.exclamationToken = void 0;
+ }
changeTracker.replacePropertyAssignment(file, declaration, assignment);
}
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
@@ -146489,7 +147420,7 @@ ${lanes.join("\n")}
return !!(origin && origin.kind === 32 /* ResolvedExport */);
}
function originIncludesSymbolName(origin) {
- return originIsExport(origin) || originIsResolvedExport(origin);
+ return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin);
}
function originIsPackageJsonImport(origin) {
return (originIsExport(origin) || originIsResolvedExport(origin)) && !!origin.isFromPackageJson;
@@ -146509,6 +147440,9 @@ ${lanes.join("\n")}
function originIsIgnore(origin) {
return !!(origin && origin.kind & 256 /* Ignore */);
}
+ function originIsComputedPropertyName(origin) {
+ return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
+ }
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
var _a2, _b, _c;
const start = timestamp();
@@ -146551,7 +147485,7 @@ ${lanes.join("\n")}
return result2 || (needsFullResolution ? "failed" : "skipped");
}
}
- function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
+ function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
var _a2;
const { previousToken } = getRelevantTokens(position, sourceFile);
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
@@ -146573,7 +147507,7 @@ ${lanes.join("\n")}
} else {
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
}
- const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
+ const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
if (stringCompletions) {
return stringCompletions;
}
@@ -146597,19 +147531,19 @@ ${lanes.join("\n")}
return void 0;
}
switch (completionData.kind) {
- case CompletionDataKind.Data:
- const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
+ case 0 /* Data */:
+ const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
if (response == null ? void 0 : response.isIncomplete) {
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
}
return response;
- case CompletionDataKind.JsDocTagName:
+ case 1 /* JsDocTagName */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagNameCompletions());
- case CompletionDataKind.JsDocTag:
+ case 2 /* JsDocTag */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagCompletions());
- case CompletionDataKind.JsDocParameterName:
+ case 3 /* JsDocParameterName */:
return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocParameterNameCompletions(completionData.tag));
- case CompletionDataKind.Keywords:
+ case 4 /* Keywords */:
return specificKeywordCompletionInfo(completionData.keywordCompletions, completionData.isNewIdentifierLocation);
default:
return Debug.assertNever(completionData);
@@ -146712,7 +147646,7 @@ ${lanes.join("\n")}
}
function keywordCompletionData(keywordFilters, filterOutTsOnlyKeywords, isNewIdentifierLocation) {
return {
- kind: CompletionDataKind.Keywords,
+ kind: 4 /* Keywords */,
keywordCompletions: getKeywordCompletions(keywordFilters, filterOutTsOnlyKeywords),
isNewIdentifierLocation
};
@@ -146728,7 +147662,7 @@ ${lanes.join("\n")}
function getOptionalReplacementSpan(location) {
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
}
- function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
+ function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
const {
symbols,
contextToken,
@@ -146802,7 +147736,8 @@ ${lanes.join("\n")}
symbolToOriginInfoMap,
symbolToSortTextMap,
isJsxIdentifierExpected,
- isRightOfOpenTag
+ isRightOfOpenTag,
+ includeSymbol
);
if (keywordFilters !== 0 /* None */) {
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
@@ -146942,64 +147877,6 @@ ${lanes.join("\n")}
}
return void 0;
}
- function newCaseClauseTracker(checker, clauses) {
- const existingStrings = /* @__PURE__ */ new Set();
- const existingNumbers = /* @__PURE__ */ new Set();
- const existingBigInts = /* @__PURE__ */ new Set();
- for (const clause of clauses) {
- if (!isDefaultClause(clause)) {
- if (isLiteralExpression(clause.expression)) {
- const expression = clause.expression;
- switch (expression.kind) {
- case 14 /* NoSubstitutionTemplateLiteral */:
- case 10 /* StringLiteral */:
- existingStrings.add(expression.text);
- break;
- case 8 /* NumericLiteral */:
- existingNumbers.add(parseInt(expression.text));
- break;
- case 9 /* BigIntLiteral */:
- const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
- if (parsedBigInt) {
- existingBigInts.add(pseudoBigIntToString(parsedBigInt));
- }
- break;
- }
- } else {
- const symbol = checker.getSymbolAtLocation(clause.expression);
- if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
- const enumValue = checker.getConstantValue(symbol.valueDeclaration);
- if (enumValue !== void 0) {
- addValue(enumValue);
- }
- }
- }
- }
- }
- return {
- addValue,
- hasValue
- };
- function addValue(value) {
- switch (typeof value) {
- case "string":
- existingStrings.add(value);
- break;
- case "number":
- existingNumbers.add(value);
- }
- }
- function hasValue(value) {
- switch (typeof value) {
- case "string":
- return existingStrings.has(value);
- case "number":
- return existingNumbers.has(value);
- case "object":
- return existingBigInts.has(pseudoBigIntToString(value));
- }
- }
- }
function typeNodeToExpression(typeNode, languageVersion, quotePreference) {
switch (typeNode.kind) {
case 180 /* TypeReference */:
@@ -147047,9 +147924,9 @@ ${lanes.join("\n")}
}
function isMemberCompletionKind(kind) {
switch (kind) {
- case CompletionKind.ObjectPropertyDeclaration:
- case CompletionKind.MemberLike:
- case CompletionKind.PropertyAccess:
+ case 0 /* ObjectPropertyDeclaration */:
+ case 3 /* MemberLike */:
+ case 2 /* PropertyAccess */:
return true;
default:
return false;
@@ -147109,7 +147986,7 @@ ${lanes.join("\n")}
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
- function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
+ function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
let insertText;
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
let data;
@@ -147153,7 +148030,9 @@ ${lanes.join("\n")}
}
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
- replacementSpan = createTextSpanFromBounds(propertyAccessToConvert.getStart(sourceFile), propertyAccessToConvert.end);
+ const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
+ const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
+ replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
}
if (originIsResolvedExport(origin)) {
sourceDisplay = [textPart(origin.moduleSpecifier)];
@@ -147165,7 +148044,7 @@ ${lanes.join("\n")}
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
hasAction = true;
}
- if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === CompletionKind.MemberLike && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
+ if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
let importAdder;
({ insertText, isSnippet, importAdder, replacementSpan } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext));
sortText = SortText.ClassMemberSnippets;
@@ -147187,7 +148066,7 @@ ${lanes.join("\n")}
let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
- if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
+ if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
isSnippet = true;
} else {
@@ -147221,7 +148100,8 @@ ${lanes.join("\n")}
isSnippet,
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
isImportStatementCompletion: !!importStatementCompletion || void 0,
- data
+ data,
+ ...includeSymbol ? { symbol } : void 0
};
}
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
@@ -147289,7 +148169,7 @@ ${lanes.join("\n")}
if (isAbstract) {
requiredModifiers |= 256 /* Abstract */;
}
- if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
+ if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
requiredModifiers |= 16384 /* Override */;
}
if (!completionNodes.length) {
@@ -147595,6 +148475,7 @@ ${lanes.join("\n")}
if (originIsResolvedExport(origin)) {
const resolvedData = {
exportName: origin.exportName,
+ exportMapKey: origin.exportMapKey,
moduleSpecifier: origin.moduleSpecifier,
ambientModuleName,
fileName: origin.fileName,
@@ -147618,6 +148499,7 @@ ${lanes.join("\n")}
const resolvedOrigin = {
kind: 32 /* ResolvedExport */,
exportName: data.exportName,
+ exportMapKey: data.exportMapKey,
moduleSpecifier: data.moduleSpecifier,
symbolName: completionName,
fileName: data.fileName,
@@ -147641,7 +148523,7 @@ ${lanes.join("\n")}
}
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
const replacementSpan = importStatementCompletion.replacementSpan;
- const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
+ const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
const importKind = ts_codefix_exports.getImportKind(
@@ -147689,7 +148571,7 @@ ${lanes.join("\n")}
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
}
}
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
var _a2;
const start = timestamp();
const variableDeclaration = getVariableDeclaration(location);
@@ -147700,7 +148582,7 @@ ${lanes.join("\n")}
const symbol = symbols[i];
const origin = symbolToOriginInfoMap == null ? void 0 : symbolToOriginInfoMap[i];
const info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, !!jsxIdentifierExpected);
- if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === CompletionKind.Global && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
+ if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === 1 /* Global */ && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
continue;
}
const { name, needsConvertPropertyAccess } = info;
@@ -147729,7 +148611,8 @@ ${lanes.join("\n")}
kind,
formatContext,
isJsxIdentifierExpected,
- isRightOfOpenTag
+ isRightOfOpenTag,
+ includeSymbol
);
if (!entry) {
continue;
@@ -147839,7 +148722,7 @@ ${lanes.join("\n")}
if (!completionData) {
return { type: "none" };
}
- if (completionData.kind !== CompletionDataKind.Data) {
+ if (completionData.kind !== 0 /* Data */) {
return { type: "request", request: completionData };
}
const { symbols, literals, location, completionKind, symbolToOriginInfoMap, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } = completionData;
@@ -147865,13 +148748,13 @@ ${lanes.join("\n")}
case "request": {
const { request } = symbolCompletion;
switch (request.kind) {
- case CompletionDataKind.JsDocTagName:
+ case 1 /* JsDocTagName */:
return ts_JsDoc_exports.getJSDocTagNameCompletionDetails(name);
- case CompletionDataKind.JsDocTag:
+ case 2 /* JsDocTag */:
return ts_JsDoc_exports.getJSDocTagCompletionDetails(name);
- case CompletionDataKind.JsDocParameterName:
+ case 3 /* JsDocParameterName */:
return ts_JsDoc_exports.getJSDocParameterNameCompletionDetails(name);
- case CompletionDataKind.Keywords:
+ case 4 /* Keywords */:
return some(request.keywordCompletions, (c) => c.name === name) ? createSimpleDetails(name, "keyword" /* keyword */, 5 /* keyword */) : void 0;
default:
return Debug.assertNever(request);
@@ -147880,7 +148763,8 @@ ${lanes.join("\n")}
case "symbol": {
const { symbol, location, contextToken: contextToken2, origin, previousToken: previousToken2 } = symbolCompletion;
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken2, formatContext, preferences, data, source, cancellationToken);
- return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
+ const symbolName2 = originIsComputedPropertyName(origin) ? origin.symbolName : symbol.name;
+ return createCompletionDetailsForSymbol(symbol, symbolName2, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
}
case "literal": {
const { literal } = symbolCompletion;
@@ -147931,12 +148815,12 @@ ${lanes.join("\n")}
function createSimpleDetails(name, kind, kind2) {
return createCompletionDetails(name, "" /* none */, kind, [displayPart(name, kind2)]);
}
- function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
+ function createCompletionDetailsForSymbol(symbol, name, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(
cancellationToken,
(checker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker2, symbol, sourceFile, location, location, 7 /* All */)
);
- return createCompletionDetails(symbol.name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
+ return createCompletionDetails(name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
}
function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) {
return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source };
@@ -147996,6 +148880,7 @@ ${lanes.join("\n")}
const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
targetSymbol,
moduleSymbol,
+ data == null ? void 0 : data.exportMapKey,
sourceFile,
name,
isJsxOpeningTagName,
@@ -148223,7 +149108,7 @@ ${lanes.join("\n")}
break;
case 291 /* JsxExpression */:
case 290 /* JsxSpreadAttribute */:
- if (previousToken.kind === 19 /* CloseBraceToken */ || (previousToken.kind === 79 /* Identifier */ || previousToken.parent.kind === 288 /* JsxAttribute */)) {
+ if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
isJsxIdentifierExpected = true;
}
break;
@@ -148685,16 +149570,16 @@ ${lanes.join("\n")}
if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
return;
}
- const firstImportableExportInfo = find(info, isImportableExportInfo);
- if (!firstImportableExportInfo) {
+ info = filter(info, isImportableExportInfo);
+ if (!info.length) {
return;
}
const result = context.tryResolve(info, isFromAmbientModule) || {};
if (result === "failed")
return;
- let exportInfo2 = firstImportableExportInfo, moduleSpecifier;
+ let exportInfo2 = info[0], moduleSpecifier;
if (result !== "skipped") {
- ({ exportInfo: exportInfo2 = firstImportableExportInfo, moduleSpecifier } = result);
+ ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
}
const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
@@ -148858,7 +149743,7 @@ ${lanes.join("\n")}
return false;
}
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) {
- return (isRegularExpressionLiteral(contextToken2) || isStringTextContainingNode(contextToken2)) && (rangeContainsPositionExclusive(createTextRangeFromSpan(createTextSpanFromNode(contextToken2)), position) || position === contextToken2.end && (!!contextToken2.isUnterminated || isRegularExpressionLiteral(contextToken2)));
+ return (isRegularExpressionLiteral(contextToken2) || isStringTextContainingNode(contextToken2)) && (rangeContainsPositionExclusive(contextToken2, position) || position === contextToken2.end && (!!contextToken2.isUnterminated || isRegularExpressionLiteral(contextToken2)));
}
function tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() {
const typeLiteralNode = tryGetTypeLiteralNode(contextToken);
@@ -149033,6 +149918,16 @@ ${lanes.join("\n")}
return classElementModifierFlags & 32 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
});
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
+ forEach(symbols, (symbol, index) => {
+ const declaration = symbol == null ? void 0 : symbol.valueDeclaration;
+ if (declaration && isClassElement(declaration) && declaration.name && isComputedPropertyName(declaration.name)) {
+ const origin = {
+ kind: 512 /* ComputedPropertyName */,
+ symbolName: typeChecker.symbolToString(symbol)
+ };
+ symbolToOriginInfoMap[index] = origin;
+ }
+ });
}
return 1 /* Success */;
}
@@ -149417,7 +150312,7 @@ ${lanes.join("\n")}
}
switch (kind) {
case 3 /* MemberLike */:
- return void 0;
+ return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
case 0 /* ObjectPropertyDeclaration */:
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
case 2 /* PropertyAccess */:
@@ -149557,7 +150452,7 @@ ${lanes.join("\n")}
function getApparentProperties(type, node, checker) {
if (!type.isUnion())
return type.getApparentProperties();
- return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 131068 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
+ return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
}
function containsNonPublicProperties(props) {
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
@@ -149877,7 +150772,7 @@ ${lanes.join("\n")}
}
return charCode;
}
- var moduleSpecifierResolutionLimit, moduleSpecifierResolutionCacheAttemptLimit, SortText, CompletionSource, SymbolOriginInfoKind, CompletionDataKind, CompletionKind, _keywordCompletions, allKeywordsCompletions;
+ var moduleSpecifierResolutionLimit, moduleSpecifierResolutionCacheAttemptLimit, SortText, CompletionSource, SymbolOriginInfoKind, CompletionKind, _keywordCompletions, allKeywordsCompletions;
var init_completions = __esm({
"src/services/completions.ts"() {
"use strict";
@@ -149925,18 +150820,11 @@ ${lanes.join("\n")}
SymbolOriginInfoKind2[SymbolOriginInfoKind2["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ObjectLiteralMethod"] = 128] = "ObjectLiteralMethod";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore";
+ SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport";
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport";
return SymbolOriginInfoKind2;
})(SymbolOriginInfoKind || {});
- CompletionDataKind = /* @__PURE__ */ ((CompletionDataKind2) => {
- CompletionDataKind2[CompletionDataKind2["Data"] = 0] = "Data";
- CompletionDataKind2[CompletionDataKind2["JsDocTagName"] = 1] = "JsDocTagName";
- CompletionDataKind2[CompletionDataKind2["JsDocTag"] = 2] = "JsDocTag";
- CompletionDataKind2[CompletionDataKind2["JsDocParameterName"] = 3] = "JsDocParameterName";
- CompletionDataKind2[CompletionDataKind2["Keywords"] = 4] = "Keywords";
- return CompletionDataKind2;
- })(CompletionDataKind || {});
CompletionKind = /* @__PURE__ */ ((CompletionKind2) => {
CompletionKind2[CompletionKind2["ObjectPropertyDeclaration"] = 0] = "ObjectPropertyDeclaration";
CompletionKind2[CompletionKind2["Global"] = 1] = "Global";
@@ -149977,7 +150865,7 @@ ${lanes.join("\n")}
values: map2.values.bind(map2)
};
}
- function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
+ function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
if (isInReferenceComment(sourceFile, position)) {
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
return entries && convertPathCompletions(entries);
@@ -149986,18 +150874,18 @@ ${lanes.join("\n")}
if (!contextToken || !isStringLiteralLike(contextToken))
return void 0;
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
- return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
+ return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
}
}
- function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
+ function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
if (completion === void 0) {
return void 0;
}
const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken);
switch (completion.kind) {
- case StringLiteralCompletionKind.Paths:
+ case 0 /* Paths */:
return convertPathCompletions(completion.paths);
- case StringLiteralCompletionKind.Properties: {
+ case 1 /* Properties */: {
const entries = createSortedArray();
getCompletionEntriesFromSymbols(
completion.symbols,
@@ -150015,11 +150903,32 @@ ${lanes.join("\n")}
preferences,
options,
/*formatContext*/
- void 0
+ void 0,
+ /*isTypeOnlyLocation */
+ void 0,
+ /*propertyAccessToConvert*/
+ void 0,
+ /*jsxIdentifierExpected*/
+ void 0,
+ /*isJsxInitializer*/
+ void 0,
+ /*importStatementCompletion*/
+ void 0,
+ /*recommendedCompletion*/
+ void 0,
+ /*symbolToOriginInfoMap*/
+ void 0,
+ /*symbolToSortTextMap*/
+ void 0,
+ /*isJsxIdentifierExpected*/
+ void 0,
+ /*isRightOfOpenTag*/
+ void 0,
+ includeSymbol
);
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
}
- case StringLiteralCompletionKind.Types: {
+ case 2 /* Types */: {
const entries = completion.types.map((type) => ({
name: type.value,
kindModifiers: "" /* none */,
@@ -150041,16 +150950,16 @@ ${lanes.join("\n")}
}
function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
switch (completion.kind) {
- case StringLiteralCompletionKind.Paths: {
+ case 0 /* Paths */: {
const match = find(completion.paths, (p) => p.name === name);
return match && createCompletionDetails(name, kindModifiersFromExtension(match.extension), match.kind, [textPart(name)]);
}
- case StringLiteralCompletionKind.Properties: {
+ case 1 /* Properties */: {
const match = find(completion.symbols, (s) => s.name === name);
- return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
+ return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
}
- case StringLiteralCompletionKind.Types:
- return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "type" /* typeElement */, [textPart(name)]) : void 0;
+ case 2 /* Types */:
+ return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
default:
return Debug.assertNever(completion);
}
@@ -150133,7 +151042,7 @@ ${lanes.join("\n")}
if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) {
return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent);
}
- return fromContextualType();
+ return fromContextualType() || fromContextualType(0 /* None */);
case 209 /* ElementAccessExpression */: {
const { expression, argumentExpression } = parent2;
if (node === skipParentheses(argumentExpression)) {
@@ -150152,11 +151061,23 @@ ${lanes.join("\n")}
case 275 /* ExportDeclaration */:
case 280 /* ExternalModuleReference */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) };
+ case 292 /* CaseClause */:
+ const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
+ const contextualTypes = fromContextualType();
+ if (!contextualTypes) {
+ return;
+ }
+ const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
+ return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
default:
return fromContextualType();
}
- function fromContextualType() {
- return { kind: 2 /* Types */, types: getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, 4 /* Completions */)), isNewIdentifier: false };
+ function fromContextualType(contextFlags = 4 /* Completions */) {
+ const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
+ if (!types.length) {
+ return;
+ }
+ return { kind: 2 /* Types */, types, isNewIdentifier: false };
}
}
function walkUpParentheses(node) {
@@ -150247,12 +151168,12 @@ ${lanes.join("\n")}
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
const scriptPath = sourceFile.path;
const scriptDirectory = getDirectoryPath(scriptPath);
- const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
+ const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
}
- function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
+ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
return {
- extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
+ extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
referenceKind,
importingSourceFile,
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
@@ -150282,8 +151203,17 @@ ${lanes.join("\n")}
).values());
}
}
- function getSupportedExtensionsForModuleResolution(compilerOptions) {
- const extensions = getSupportedExtensions(compilerOptions);
+ function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
+ const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
+ typeChecker.getAmbientModules(),
+ (module2) => {
+ const name = module2.name.slice(1, -1);
+ if (!name.startsWith("*.") || name.includes("/"))
+ return;
+ return name.slice(1);
+ }
+ );
+ const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
}
@@ -150754,7 +151684,7 @@ ${lanes.join("\n")}
function isRequireCallArgument(node) {
return isCallExpression(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier(node.parent.expression) && node.parent.expression.escapedText === "require";
}
- var kindPrecedence, StringLiteralCompletionKind, ReferenceKind, tripleSlashDirectiveFragmentRegex, nodeModulesDependencyKeys;
+ var kindPrecedence, tripleSlashDirectiveFragmentRegex, nodeModulesDependencyKeys;
var init_stringCompletions = __esm({
"src/services/stringCompletions.ts"() {
"use strict";
@@ -150765,17 +151695,6 @@ ${lanes.join("\n")}
["script" /* scriptElement */]: 1,
["external module name" /* externalModuleName */]: 2
};
- StringLiteralCompletionKind = /* @__PURE__ */ ((StringLiteralCompletionKind2) => {
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Paths"] = 0] = "Paths";
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Properties"] = 1] = "Properties";
- StringLiteralCompletionKind2[StringLiteralCompletionKind2["Types"] = 2] = "Types";
- return StringLiteralCompletionKind2;
- })(StringLiteralCompletionKind || {});
- ReferenceKind = /* @__PURE__ */ ((ReferenceKind2) => {
- ReferenceKind2[ReferenceKind2["Filename"] = 0] = "Filename";
- ReferenceKind2[ReferenceKind2["ModuleSpecifier"] = 1] = "ModuleSpecifier";
- return ReferenceKind2;
- })(ReferenceKind || {});
tripleSlashDirectiveFragmentRegex = /^(\/\/\/\s* ` * ${c}`).join("\n")}
if (isExpression(body)) {
const returnStatement = factory.createReturnStatement(body);
const file = body.getSourceFile();
+ setTextRange(returnStatement, body);
suppressLeadingAndTrailingTrivia(returnStatement);
copyTrailingAsLeadingComments(
body,
@@ -159254,10 +160170,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
const scopeDescription = isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope);
let functionDescription;
let constantDescription;
- if (scopeDescription === SpecialScope.Global) {
+ if (scopeDescription === 1 /* Global */) {
functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]);
constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"]);
- } else if (scopeDescription === SpecialScope.Module) {
+ } else if (scopeDescription === 0 /* Module */) {
functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]);
constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"]);
} else {
@@ -159323,7 +160239,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
return scope.kind === 260 /* ClassDeclaration */ ? scope.name ? `class '${scope.name.text}'` : "anonymous class declaration" : scope.name ? `class expression '${scope.name.text}'` : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? SpecialScope.Module : SpecialScope.Global;
+ return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) {
const checker = context.program.getTypeChecker();
@@ -159356,7 +160272,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
typeNode
);
parameters.push(paramDecl);
- if (usage.usage === Usage.Write) {
+ if (usage.usage === 2 /* Write */) {
(writes || (writes = [])).push(usage);
}
callArguments.push(factory.createIdentifier(name));
@@ -160314,7 +161230,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
function isStringLiteralJsxAttribute(node) {
return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent);
}
- var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts, SpecialScope, Usage;
+ var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts;
var init_extractSymbol = __esm({
"src/services/refactors/extractSymbol.ts"() {
"use strict";
@@ -160377,16 +161293,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
RangeFacts2[RangeFacts2["InStaticRegion"] = 32] = "InStaticRegion";
return RangeFacts2;
})(RangeFacts || {});
- SpecialScope = /* @__PURE__ */ ((SpecialScope2) => {
- SpecialScope2[SpecialScope2["Module"] = 0] = "Module";
- SpecialScope2[SpecialScope2["Global"] = 1] = "Global";
- return SpecialScope2;
- })(SpecialScope || {});
- Usage = /* @__PURE__ */ ((Usage2) => {
- Usage2[Usage2["Read"] = 1] = "Read";
- Usage2[Usage2["Write"] = 2] = "Write";
- return Usage2;
- })(Usage || {});
}
});
@@ -160818,7 +161724,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
if (!candidateInfo) {
return isSourceFileJS(sourceFile) ? createJSSignatureHelpItems(argumentInfo, program, cancellationToken) : void 0;
}
- return typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => candidateInfo.kind === CandidateOrTypeKind.Candidate ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2));
+ return typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => candidateInfo.kind === 0 /* Candidate */ ? createSignatureHelpItems(candidateInfo.candidates, candidateInfo.resolvedSignature, argumentInfo, sourceFile, typeChecker2) : createTypeHelpItems(candidateInfo.symbol, argumentInfo, sourceFile, typeChecker2));
}
function getCandidateOrTypeInfo({ invocation, argumentCount }, checker, sourceFile, startingToken, onlyUseSyntacticOwners) {
switch (invocation.kind) {
@@ -161290,16 +162196,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
});
return { name: typeParameter.symbol.name, documentation: typeParameter.symbol.getDocumentationComment(checker), displayParts, isOptional: false, isRest: false };
}
- var CandidateOrTypeKind, signatureHelpNodeBuilderFlags, separatorDisplayParts;
+ var signatureHelpNodeBuilderFlags, separatorDisplayParts;
var init_signatureHelp = __esm({
"src/services/signatureHelp.ts"() {
"use strict";
init_ts4();
- CandidateOrTypeKind = /* @__PURE__ */ ((CandidateOrTypeKind2) => {
- CandidateOrTypeKind2[CandidateOrTypeKind2["Candidate"] = 0] = "Candidate";
- CandidateOrTypeKind2[CandidateOrTypeKind2["Type"] = 1] = "Type";
- return CandidateOrTypeKind2;
- })(CandidateOrTypeKind || {});
signatureHelpNodeBuilderFlags = 8192 /* OmitParameterModifiers */ | 70221824 /* IgnoreErrors */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
separatorDisplayParts = [punctuationPart(27 /* CommaToken */), spacePart()];
}
@@ -164610,8 +165511,8 @@ ${options.prefix}` : "\n" : options.prefix
var init_rules = __esm({
"src/services/formatting/rules.ts"() {
"use strict";
- init_ts_formatting();
init_ts4();
+ init_ts_formatting();
}
});
@@ -165171,7 +166072,7 @@ ${options.prefix}` : "\n" : options.prefix
}
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
Debug.assert(!nodeIsSynthesized(child));
- if (nodeIsMissing(child)) {
+ if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
return inheritedIndentation;
}
const childStartPos = child.getStart(sourceFile);
@@ -165304,7 +166205,7 @@ ${options.prefix}` : "\n" : options.prefix
if (currentTokenInfo.leadingTrivia) {
processTrivia(currentTokenInfo.leadingTrivia, parent2, childContextNode, dynamicIndentation);
}
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
const isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token);
const tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
if (isTokenInRange) {
@@ -165312,11 +166213,11 @@ ${options.prefix}` : "\n" : options.prefix
const savePreviousRange = previousRange;
lineAction = processRange(currentTokenInfo.token, tokenStart, parent2, childContextNode, dynamicIndentation);
if (!rangeHasError) {
- if (lineAction === LineAction.None) {
+ if (lineAction === 0 /* None */) {
const prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
} else {
- indentToken = lineAction === LineAction.LineAdded;
+ indentToken = lineAction === 1 /* LineAdded */;
}
}
}
@@ -165342,7 +166243,7 @@ ${options.prefix}` : "\n" : options.prefix
);
}
if (tokenIndentation !== -1 /* Unknown */ && indentNextTokenOrTrivia) {
- insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAction === LineAction.LineAdded);
+ insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAction === 1 /* LineAdded */);
lastIndentedLine = tokenStart.line;
indentationOnLastIndentedLine = tokenIndentation;
}
@@ -165389,7 +166290,7 @@ ${options.prefix}` : "\n" : options.prefix
}
function processRange(range, rangeStart, parent2, contextNode, dynamicIndentation) {
const rangeHasError = rangeContainsError(range);
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
if (!rangeHasError) {
if (!previousRange) {
const originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos);
@@ -165408,13 +166309,13 @@ ${options.prefix}` : "\n" : options.prefix
formattingContext.updateContext(previousItem, previousParent2, currentItem, currentParent, contextNode);
const rules = getRules(formattingContext);
let trimTrailingWhitespaces = formattingContext.options.trimTrailingWhitespace !== false;
- let lineAction = LineAction.None;
+ let lineAction = 0 /* None */;
if (rules) {
forEachRight(rules, (rule2) => {
lineAction = applyRuleEdits(rule2, previousItem, previousStartLine, currentItem, currentStartLine);
if (dynamicIndentation) {
switch (lineAction) {
- case LineAction.LineRemoved:
+ case 2 /* LineRemoved */:
if (currentParent.getStart(sourceFile) === currentItem.pos) {
dynamicIndentation.recomputeIndentation(
/*lineAddedByFormatting*/
@@ -165423,7 +166324,7 @@ ${options.prefix}` : "\n" : options.prefix
);
}
break;
- case LineAction.LineAdded:
+ case 1 /* LineAdded */:
if (currentParent.getStart(sourceFile) === currentItem.pos) {
dynamicIndentation.recomputeIndentation(
/*lineAddedByFormatting*/
@@ -165433,7 +166334,7 @@ ${options.prefix}` : "\n" : options.prefix
}
break;
default:
- Debug.assert(lineAction === LineAction.None);
+ Debug.assert(lineAction === 0 /* None */);
}
}
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule2.action & 16 /* DeleteSpace */) && rule2.flags !== 1 /* CanDeleteNewLines */;
@@ -165580,11 +166481,11 @@ ${options.prefix}` : "\n" : options.prefix
const onLaterLine = currentStartLine !== previousStartLine;
switch (rule2.action) {
case 1 /* StopProcessingSpaceActions */:
- return LineAction.None;
+ return 0 /* None */;
case 16 /* DeleteSpace */:
if (previousRange2.end !== currentRange.pos) {
recordDelete(previousRange2.end, currentRange.pos - previousRange2.end);
- return onLaterLine ? LineAction.LineRemoved : LineAction.None;
+ return onLaterLine ? 2 /* LineRemoved */ : 0 /* None */;
}
break;
case 32 /* DeleteToken */:
@@ -165592,28 +166493,28 @@ ${options.prefix}` : "\n" : options.prefix
break;
case 8 /* InsertNewLine */:
if (rule2.flags !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {
- return LineAction.None;
+ return 0 /* None */;
}
const lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, getNewLineOrDefaultFromHost(host, options));
- return onLaterLine ? LineAction.None : LineAction.LineAdded;
+ return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
case 4 /* InsertSpace */:
if (rule2.flags !== 1 /* CanDeleteNewLines */ && previousStartLine !== currentStartLine) {
- return LineAction.None;
+ return 0 /* None */;
}
const posDelta = currentRange.pos - previousRange2.end;
if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange2.end) !== 32 /* space */) {
recordReplace(previousRange2.end, currentRange.pos - previousRange2.end, " ");
- return onLaterLine ? LineAction.LineRemoved : LineAction.None;
+ return onLaterLine ? 2 /* LineRemoved */ : 0 /* None */;
}
break;
case 64 /* InsertTrailingSemicolon */:
recordInsert(previousRange2.end, ";");
}
- return LineAction.None;
+ return 0 /* None */;
}
}
function getRangeOfEnclosingComment(sourceFile, position, precedingToken, tokenAtPosition = getTokenAtPosition(sourceFile, position)) {
@@ -165739,18 +166640,12 @@ ${options.prefix}` : "\n" : options.prefix
return remainder ? spacesString + repeatString(" ", remainder) : spacesString;
}
}
- var LineAction, internedSizes, internedTabsIndentation, internedSpacesIndentation;
+ var internedSizes, internedTabsIndentation, internedSpacesIndentation;
var init_formatting = __esm({
"src/services/formatting/formatting.ts"() {
"use strict";
init_ts4();
init_ts_formatting();
- LineAction = /* @__PURE__ */ ((LineAction2) => {
- LineAction2[LineAction2["None"] = 0] = "None";
- LineAction2[LineAction2["LineAdded"] = 1] = "LineAdded";
- LineAction2[LineAction2["LineRemoved"] = 2] = "LineRemoved";
- return LineAction2;
- })(LineAction || {});
}
});
@@ -165854,7 +166749,7 @@ ${options.prefix}` : "\n" : options.prefix
)) {
const currentStart = getStartLineAndCharacterForNode(current, sourceFile);
const nextTokenKind = nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile);
- const indentationDelta = nextTokenKind !== NextTokenKind.Unknown ? assumeNewLineBeforeCloseBrace && nextTokenKind === NextTokenKind.CloseBrace ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0;
+ const indentationDelta = nextTokenKind !== 0 /* Unknown */ ? assumeNewLineBeforeCloseBrace && nextTokenKind === 2 /* CloseBrace */ ? options.indentSize : 0 : lineAtPosition !== currentStart.line ? options.indentSize : 0;
return getIndentationForNodeWorker(
current,
currentStart,
@@ -166833,6 +167728,7 @@ ${options.prefix}` : "\n" : options.prefix
consumesNodeCoreModules: () => consumesNodeCoreModules,
contains: () => contains,
containsIgnoredPath: () => containsIgnoredPath,
+ containsObjectRestOrSpread: () => containsObjectRestOrSpread,
containsParseError: () => containsParseError,
containsPath: () => containsPath,
convertCompilerOptionsForTelemetry: () => convertCompilerOptionsForTelemetry,
@@ -167171,6 +168067,7 @@ ${options.prefix}` : "\n" : options.prefix
getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig,
getCompilerOptionValue: () => getCompilerOptionValue,
getCompilerOptionsDiffValue: () => getCompilerOptionsDiffValue,
+ getConditions: () => getConditions,
getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics,
getConstantValue: () => getConstantValue,
getContainerNode: () => getContainerNode,
@@ -167852,6 +168749,7 @@ ${options.prefix}` : "\n" : options.prefix
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
isGlobalDeclaration: () => isGlobalDeclaration,
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
+ isGrammarError: () => isGrammarError,
isHeritageClause: () => isHeritageClause,
isHoistedFunction: () => isHoistedFunction,
isHoistedVariableStatement: () => isHoistedVariableStatement,
@@ -168194,6 +169092,7 @@ ${options.prefix}` : "\n" : options.prefix
isString: () => isString,
isStringAKeyword: () => isStringAKeyword,
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
+ isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
isStringDoubleQuoted: () => isStringDoubleQuoted,
isStringLiteral: () => isStringLiteral,
isStringLiteralLike: () => isStringLiteralLike,
@@ -168358,6 +169257,7 @@ ${options.prefix}` : "\n" : options.prefix
mutateMapSkippingNewValues: () => mutateMapSkippingNewValues,
needsParentheses: () => needsParentheses,
needsScopeMarker: () => needsScopeMarker,
+ newCaseClauseTracker: () => newCaseClauseTracker,
newPrivateEnvironment: () => newPrivateEnvironment,
noEmitNotification: () => noEmitNotification,
noEmitSubstitution: () => noEmitSubstitution,
@@ -168731,7 +169631,6 @@ ${options.prefix}` : "\n" : options.prefix
typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
typeAliasNamePart: () => typeAliasNamePart,
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
- typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
typeKeywords: () => typeKeywords,
typeParameterNamePart: () => typeParameterNamePart,
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index 2d892a7d711e4..00afe537dc038 100644
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
// src/compiler/corePublic.ts
var versionMajorMinor = "5.0";
-var version = `${versionMajorMinor}.0-beta`;
+var version = `${versionMajorMinor}.1-rc`;
// src/compiler/core.ts
var emptyArray = [];
@@ -102,17 +102,6 @@ function find(array, predicate, startIndex) {
}
return void 0;
}
-function findLast(array, predicate, startIndex) {
- if (array === void 0)
- return void 0;
- for (let i = startIndex != null ? startIndex : array.length - 1; i >= 0; i--) {
- const value = array[i];
- if (predicate(value, i)) {
- return value;
- }
- }
- return void 0;
-}
function findIndex(array, predicate, startIndex) {
if (array === void 0)
return -1;
@@ -484,15 +473,6 @@ function arrayToMap(array, makeKey, makeValue = identity) {
}
return result;
}
-function clone(object) {
- const result = {};
- for (const id in object) {
- if (hasOwnProperty.call(object, id)) {
- result[id] = object[id];
- }
- }
- return result;
-}
function createMultiMap() {
const map2 = /* @__PURE__ */ new Map();
map2.add = multiMapAdd;
@@ -2280,7 +2260,7 @@ function tryGetNodePerformanceHooks() {
}
var nativePerformanceHooks = tryGetWebPerformanceHooks() || tryGetNodePerformanceHooks();
var nativePerformance = nativePerformanceHooks == null ? void 0 : nativePerformanceHooks.performance;
-var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +new Date();
+var timestamp = nativePerformance ? () => nativePerformance.now() : Date.now ? Date.now : () => +/* @__PURE__ */ new Date();
// src/compiler/perfLogger.ts
var nullLogger = {
@@ -2317,30 +2297,6 @@ var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule :
// src/compiler/performance.ts
var performanceImpl;
-function createTimerIf(condition, measureName, startMarkName, endMarkName) {
- return condition ? createTimer(measureName, startMarkName, endMarkName) : nullTimer;
-}
-function createTimer(measureName, startMarkName, endMarkName) {
- let enterCount = 0;
- return {
- enter,
- exit
- };
- function enter() {
- if (++enterCount === 1) {
- mark(startMarkName);
- }
- }
- function exit() {
- if (--enterCount === 0) {
- mark(endMarkName);
- measure(measureName, startMarkName, endMarkName);
- } else if (enterCount < 0) {
- Debug.fail("enter/exit count does not match.");
- }
- }
-}
-var nullTimer = { enter: noop, exit: noop };
var enabled = false;
var timeorigin = timestamp();
var marks = /* @__PURE__ */ new Map();
@@ -2353,6 +2309,9 @@ function mark(markName) {
counts.set(markName, count + 1);
marks.set(markName, timestamp());
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
+ if (typeof onProfilerEvent === "function") {
+ onProfilerEvent(markName);
+ }
}
}
function measure(measureName, startMarkName, endMarkName) {
@@ -3122,19 +3081,6 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
RelationComparisonResult3[RelationComparisonResult3["ReportsMask"] = 24] = "ReportsMask";
return RelationComparisonResult3;
})(RelationComparisonResult || {});
-var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["None"] = 0] = "None";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Auto"] = 1] = "Auto";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Loop"] = 2] = "Loop";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Unique"] = 3] = "Unique";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Node"] = 4] = "Node";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["KindMask"] = 7] = "KindMask";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["ReservedInNestedScopes"] = 8] = "ReservedInNestedScopes";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["Optimistic"] = 16] = "Optimistic";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["FileLevel"] = 32] = "FileLevel";
- GeneratedIdentifierFlags2[GeneratedIdentifierFlags2["AllowNameSubstitution"] = 64] = "AllowNameSubstitution";
- return GeneratedIdentifierFlags2;
-})(GeneratedIdentifierFlags || {});
var FlowFlags = /* @__PURE__ */ ((FlowFlags2) => {
FlowFlags2[FlowFlags2["Unreachable"] = 1] = "Unreachable";
FlowFlags2[FlowFlags2["Start"] = 2] = "Start";
@@ -3254,13 +3200,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
- TypeFlags2[TypeFlags2["Unit"] = 109440] = "Unit";
+ TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
+ TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
- TypeFlags2[TypeFlags2["Primitive"] = 131068] = "Primitive";
+ TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
@@ -3525,7 +3472,7 @@ var PollingInterval = /* @__PURE__ */ ((PollingInterval3) => {
PollingInterval3[PollingInterval3["Low"] = 250] = "Low";
return PollingInterval3;
})(PollingInterval || {});
-var missingFileModifiedTime = new Date(0);
+var missingFileModifiedTime = /* @__PURE__ */ new Date(0);
function getModifiedTime(host, fileName) {
return host.getModifiedTime(fileName) || missingFileModifiedTime;
}
@@ -3750,7 +3697,7 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
const watcher = fsWatch(
dirName,
- FileSystemEntryKind.Directory,
+ 1 /* Directory */,
(_eventName, relativeFileName, modifiedTime) => {
if (!isString(relativeFileName))
return;
@@ -3950,7 +3897,7 @@ function createDirectoryWatcherSupportingRecursive({
}
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
const parentWatcher = cache.get(dirPath);
- if (parentWatcher && fileSystemEntryExists(dirName, FileSystemEntryKind.Directory)) {
+ if (parentWatcher && fileSystemEntryExists(dirName, 1 /* Directory */)) {
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
return;
}
@@ -4015,7 +3962,7 @@ function createDirectoryWatcherSupportingRecursive({
return false;
let newChildWatches;
const hasChanges = enumerateInsertsAndDeletes(
- fileSystemEntryExists(parentDir, FileSystemEntryKind.Directory) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
+ fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
const childFullName = getNormalizedAbsolutePath(child, parentDir);
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
}) : emptyArray,
@@ -4046,11 +3993,6 @@ function createDirectoryWatcherSupportingRecursive({
return stringContains(toCanonicalFilePath(path2), searchPath);
}
}
-var FileSystemEntryKind = /* @__PURE__ */ ((FileSystemEntryKind2) => {
- FileSystemEntryKind2[FileSystemEntryKind2["File"] = 0] = "File";
- FileSystemEntryKind2[FileSystemEntryKind2["Directory"] = 1] = "Directory";
- return FileSystemEntryKind2;
-})(FileSystemEntryKind || {});
function createFileWatcherCallback(callback) {
return (_fileName, eventKind, modifiedTime) => callback(eventKind === 1 /* Changed */ ? "change" : "rename", "", modifiedTime);
}
@@ -4620,7 +4562,7 @@ var sys = (() => {
if (!err) {
try {
if ((_a2 = statSync(profilePath)) == null ? void 0 : _a2.isDirectory()) {
- profilePath = _path.join(profilePath, `${new Date().toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
+ profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
}
} catch (e) {
}
@@ -5513,7 +5455,6 @@ var Diagnostics = {
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* 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."),
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* 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}')'?"),
Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
- Type_arguments_cannot_be_used_here: diag(1342, 1 /* Error */, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* 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'."),
A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
@@ -5642,6 +5583,7 @@ var Diagnostics = {
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, 3 /* Message */, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", 'To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.'),
_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."),
+ Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."),
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -6035,7 +5977,6 @@ var Diagnostics = {
Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
- An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
@@ -6159,7 +6100,7 @@ var Diagnostics = {
Private_accessor_was_defined_without_a_getter: diag(2806, 1 /* Error */, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, 1 /* Error */, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
- Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
+ Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses: diag(2809, 1 /* Error */, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses."),
Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, 1 /* Error */, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
Initializer_for_property_0: diag(2811, 1 /* Error */, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
@@ -6351,13 +6292,11 @@ var Diagnostics = {
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
- Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_preserveValueImports_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later."),
+ Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
- Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(5099, 1 /* Error */, "Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Aster_5099", `Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.`),
- Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead: diag(5100, 1 /* Error */, "Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_defau_5100", "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead."),
- Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_ignoreDeprecations_Colon_2_to_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify 'ignoreDeprecations: "{2}"' to silence this error.`),
+ Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecat_5101", `Flag '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
Flag_0_is_deprecated_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Flag_0_is_deprecated_Please_remove_it_from_your_configuration_5102", "Flag '{0}' is deprecated. Please remove it from your configuration."),
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
@@ -6445,7 +6384,7 @@ var Diagnostics = {
Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
- File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
+ File_0_exists_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exists_use_it_as_a_name_resolution_result_6097", "File '{0}' exists - use it as a name resolution result."),
Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
@@ -6735,6 +6674,11 @@ var Diagnostics = {
Use_the_package_json_imports_field_when_resolving_imports: diag(6409, 3 /* Message */, "Use_the_package_json_imports_field_when_resolving_imports_6409", "Use the package.json 'imports' field when resolving imports."),
Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
+ Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
+ Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
+ Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
+ Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -6896,6 +6840,7 @@ var Diagnostics = {
new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, 1 /* Error */, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."),
_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, 1 /* Error */, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."),
Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, 1 /* Error */, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."),
+ This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation: diag(7012, 1 /* Error */, "This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation_7012", "This overload implicitly returns the type '{0}' because it lacks a return type annotation."),
Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, 1 /* Error */, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."),
Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7014, 1 /* Error */, "Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7014", "Function type, which lacks return-type annotation, implicitly has an '{0}' return type."),
Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, 1 /* Error */, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."),
@@ -6993,7 +6938,7 @@ var Diagnostics = {
You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* Error */, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."),
- Decorators_must_come_after_export_or_export_default_in_JavaScript_files: diag(8038, 1 /* Error */, "Decorators_must_come_after_export_or_export_default_in_JavaScript_files_8038", "Decorators must come after 'export' or 'export default' in JavaScript files."),
+ Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."),
Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, 1 /* Error */, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -7533,17 +7478,6 @@ function computeLineOfPosition(lineStarts, position, lowerBound) {
}
return lineNumber;
}
-function getLinesBetweenPositions(sourceFile, pos1, pos2) {
- if (pos1 === pos2)
- return 0;
- const lineStarts = getLineStarts(sourceFile);
- const lower = Math.min(pos1, pos2);
- const isNegative = lower === pos2;
- const upper = isNegative ? pos1 : pos2;
- const lowerLine = computeLineOfPosition(lineStarts, lower);
- const upperLine = computeLineOfPosition(lineStarts, upper, lowerLine);
- return isNegative ? lowerLine - upperLine : upperLine - lowerLine;
-}
function getLineAndCharacterOfPosition(sourceFile, position) {
return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
}
@@ -7798,30 +7732,6 @@ function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
}
return accumulator;
}
-function forEachLeadingCommentRange(text, pos, cb, state) {
- return iterateCommentRanges(
- /*reduce*/
- false,
- text,
- pos,
- /*trailing*/
- false,
- cb,
- state
- );
-}
-function forEachTrailingCommentRange(text, pos, cb, state) {
- return iterateCommentRanges(
- /*reduce*/
- false,
- text,
- pos,
- /*trailing*/
- true,
- cb,
- state
- );
-}
function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {
return iterateCommentRanges(
/*reduce*/
@@ -7900,18 +7810,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
return true;
}
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start, length2) {
- let text = textInitial;
- let pos;
- let end;
- let startPos;
- let tokenPos;
- let token;
- let tokenValue;
- let tokenFlags;
- let commentDirectives;
- let inJSDocType = 0;
+ var text = textInitial;
+ var pos;
+ var end;
+ var startPos;
+ var tokenPos;
+ var token;
+ var tokenValue;
+ var tokenFlags;
+ var commentDirectives;
+ var inJSDocType = 0;
setText(text, start, length2);
- const scanner = {
+ var scanner = {
getStartPos: () => startPos,
getTextPos: () => pos,
getToken: () => token,
@@ -9458,17 +9368,6 @@ function getCombinedModifierFlags(node) {
function getCombinedNodeFlags(node) {
return getCombinedFlags(node, (n) => n.flags);
}
-function getOriginalNode(node, nodeTest) {
- if (node) {
- while (node.original !== void 0) {
- node = node.original;
- }
- }
- if (!node || !nodeTest) {
- return node;
- }
- return nodeTest(node) ? node : void 0;
-}
function findAncestor(node, callback) {
while (node) {
const result = callback(node);
@@ -9767,15 +9666,6 @@ function getJSDocTagsWorker(node, noCache) {
function getFirstJSDocTag(node, predicate, noCache) {
return find(getJSDocTagsWorker(node, noCache), predicate);
}
-function getTextOfJSDocComment(comment) {
- return typeof comment === "string" ? comment : comment == null ? void 0 : comment.map((c) => c.kind === 324 /* JSDocText */ ? c.text : formatJSDocLink(c)).join("");
-}
-function formatJSDocLink(link) {
- const kind = link.kind === 327 /* JSDocLink */ ? "link" : link.kind === 328 /* JSDocLinkCode */ ? "linkcode" : "linkplain";
- const name = link.name ? entityNameToString(link.name) : "";
- const space = link.name && link.text.startsWith("://") ? "" : " ";
- return `{@${kind} ${name}${space}${link.text}}`;
-}
function isMemberName(node) {
return node.kind === 79 /* Identifier */ || node.kind === 80 /* PrivateIdentifier */;
}
@@ -9813,24 +9703,9 @@ function isNonNullChain(node) {
function isNamedExportBindings(node) {
return node.kind === 277 /* NamespaceExport */ || node.kind === 276 /* NamedExports */;
}
-function isUnparsedTextLike(node) {
- switch (node.kind) {
- case 305 /* UnparsedText */:
- case 306 /* UnparsedInternalText */:
- return true;
- default:
- return false;
- }
-}
-function isUnparsedNode(node) {
- return isUnparsedTextLike(node) || node.kind === 303 /* UnparsedPrologue */ || node.kind === 307 /* UnparsedSyntheticReference */;
-}
function isNodeKind(kind) {
return kind >= 163 /* FirstNode */;
}
-function isTokenKind(kind) {
- return kind >= 0 /* FirstToken */ && kind <= 162 /* LastToken */;
-}
function isNodeArray(array) {
return hasProperty(array, "pos") && hasProperty(array, "end");
}
@@ -10294,9 +10169,6 @@ function isCaseOrDefaultClause(node) {
function isJSDocNode(node) {
return node.kind >= 312 /* FirstJSDocNode */ && node.kind <= 353 /* LastJSDocNode */;
}
-function isJSDocTag(node) {
- return node.kind >= 330 /* FirstJSDocTagNode */ && node.kind <= 353 /* LastJSDocTagNode */;
-}
function hasJSDocNodes(node) {
if (!canHaveJSDoc(node))
return false;
@@ -10306,28 +10178,6 @@ function hasJSDocNodes(node) {
function hasInitializer(node) {
return !!node.initializer;
}
-var MAX_SMI_X86 = 1073741823;
-function guessIndentation(lines) {
- let indentation = MAX_SMI_X86;
- for (const line of lines) {
- if (!line.length) {
- continue;
- }
- let i = 0;
- for (; i < line.length && i < indentation; i++) {
- if (!isWhiteSpaceLike(line.charCodeAt(i))) {
- break;
- }
- }
- if (i < indentation) {
- indentation = i;
- }
- if (indentation === 0) {
- return 0;
- }
- }
- return indentation === MAX_SMI_X86 ? void 0 : indentation;
-}
function isStringLiteralLike(node) {
return node.kind === 10 /* StringLiteral */ || node.kind === 14 /* NoSubstitutionTemplateLiteral */;
}
@@ -10344,7 +10194,7 @@ function createSymbolTable(symbols) {
}
var stringWriter = createSingleLineStringWriter();
function createSingleLineStringWriter() {
- let str = "";
+ var str = "";
const writeText = (text) => str += text;
return {
getText: () => str,
@@ -10426,9 +10276,6 @@ function getEndLinePosition(line, sourceFile) {
return pos;
}
}
-function isFileLevelUniqueName(sourceFile, name, hasGlobalName) {
- return !(hasGlobalName && hasGlobalName(name)) && !sourceFile.identifiers.has(name);
-}
function nodeIsMissing(node) {
if (node === void 0) {
return true;
@@ -10438,16 +10285,6 @@ function nodeIsMissing(node) {
function nodeIsPresent(node) {
return !nodeIsMissing(node);
}
-function isRecognizedTripleSlashComment(text, commentPos, commentEnd) {
- if (text.charCodeAt(commentPos + 1) === 47 /* slash */ && commentPos + 2 < commentEnd && text.charCodeAt(commentPos + 2) === 47 /* slash */) {
- const textSubStr = text.substring(commentPos, commentEnd);
- return fullTripleSlashReferencePathRegEx.test(textSubStr) || fullTripleSlashAMDReferencePathRegEx.test(textSubStr) || fullTripleSlashReferenceTypeReferenceDirectiveRegEx.test(textSubStr) || defaultLibReferenceRegEx.test(textSubStr) ? true : false;
- }
- return false;
-}
-function isPinnedComment(text, start) {
- return text.charCodeAt(start + 1) === 42 /* asterisk */ && text.charCodeAt(start + 2) === 33 /* exclamation */;
-}
function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
if (nodeIsMissing(node)) {
return node.pos;
@@ -10501,65 +10338,6 @@ function getEmitFlags(node) {
const emitNode = node.emitNode;
return emitNode && emitNode.flags || 0;
}
-function getInternalEmitFlags(node) {
- const emitNode = node.emitNode;
- return emitNode && emitNode.internalFlags || 0;
-}
-function getLiteralText(node, sourceFile, flags) {
- var _a2;
- if (sourceFile && canUseOriginalText(node, flags)) {
- return getSourceTextOfNodeFromSourceFile(sourceFile, node);
- }
- switch (node.kind) {
- case 10 /* StringLiteral */: {
- const escapeText = flags & 2 /* JsxAttributeEscape */ ? escapeJsxAttributeString : flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
- if (node.singleQuote) {
- return "'" + escapeText(node.text, 39 /* singleQuote */) + "'";
- } else {
- return '"' + escapeText(node.text, 34 /* doubleQuote */) + '"';
- }
- }
- case 14 /* NoSubstitutionTemplateLiteral */:
- case 15 /* TemplateHead */:
- case 16 /* TemplateMiddle */:
- case 17 /* TemplateTail */: {
- const escapeText = flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
- const rawText = (_a2 = node.rawText) != null ? _a2 : escapeTemplateSubstitution(escapeText(node.text, 96 /* backtick */));
- switch (node.kind) {
- case 14 /* NoSubstitutionTemplateLiteral */:
- return "`" + rawText + "`";
- case 15 /* TemplateHead */:
- return "`" + rawText + "${";
- case 16 /* TemplateMiddle */:
- return "}" + rawText + "${";
- case 17 /* TemplateTail */:
- return "}" + rawText + "`";
- }
- break;
- }
- case 8 /* NumericLiteral */:
- case 9 /* BigIntLiteral */:
- return node.text;
- case 13 /* RegularExpressionLiteral */:
- if (flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) {
- return node.text + (node.text.charCodeAt(node.text.length - 1) === 92 /* backslash */ ? " /" : "/");
- }
- return node.text;
- }
- return Debug.fail(`Literal kind '${node.kind}' not accounted for.`);
-}
-function canUseOriginalText(node, flags) {
- if (nodeIsSynthesized(node) || !node.parent || flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) {
- return false;
- }
- if (isNumericLiteral(node) && node.numericLiteralFlags & 512 /* ContainsSeparator */) {
- return !!(flags & 8 /* AllowNumericSeparator */);
- }
- return !isBigIntLiteral(node);
-}
-function makeIdentifierFromModuleName(moduleName) {
- return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
-}
function isBlockOrCatchScoped(declaration) {
return (getCombinedNodeFlags(declaration) & 3 /* BlockScoped */) !== 0 || isCatchClauseVariableDeclarationOrBindingElement(declaration);
}
@@ -10642,27 +10420,6 @@ function tryGetTextOfPropertyName(name) {
function getTextOfPropertyName(name) {
return Debug.checkDefined(tryGetTextOfPropertyName(name));
}
-function entityNameToString(name) {
- switch (name.kind) {
- case 108 /* ThisKeyword */:
- return "this";
- case 80 /* PrivateIdentifier */:
- case 79 /* Identifier */:
- return getFullWidth(name) === 0 ? idText(name) : getTextOfNode(name);
- case 163 /* QualifiedName */:
- return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 208 /* PropertyAccessExpression */:
- if (isIdentifier(name.name) || isPrivateIdentifier(name.name)) {
- return entityNameToString(name.expression) + "." + entityNameToString(name.name);
- } else {
- return Debug.assertNever(name.name);
- }
- case 314 /* JSDocMemberName */:
- return entityNameToString(name.left) + entityNameToString(name.right);
- default:
- return Debug.assertNever(name);
- }
-}
function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) {
const span = getErrorSpanForNode(sourceFile, node);
return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3);
@@ -10766,15 +10523,6 @@ function isJsonSourceFile(file) {
function isEnumConst(node) {
return !!(getCombinedModifierFlags(node) & 2048 /* Const */);
}
-function isVarConst(node) {
- return !!(getCombinedNodeFlags(node) & 2 /* Const */);
-}
-function isLet(node) {
- return !!(getCombinedNodeFlags(node) & 1 /* Let */);
-}
-function isLiteralImportTypeNode(n) {
- return isImportTypeNode(n) && isLiteralTypeNode(n.argument) && isStringLiteral(n.argument.literal);
-}
function isPrologueDirective(node) {
return node.kind === 241 /* ExpressionStatement */ && node.expression.kind === 10 /* StringLiteral */;
}
@@ -10790,17 +10538,10 @@ function isHoistedVariable(node) {
function isHoistedVariableStatement(node) {
return isCustomPrologue(node) && isVariableStatement(node) && every(node.declarationList.declarations, isHoistedVariable);
}
-function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
- return node.kind !== 11 /* JsxText */ ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0;
-}
function getJSDocCommentRanges(node, text) {
const commentRanges = node.kind === 166 /* Parameter */ || node.kind === 165 /* TypeParameter */ || node.kind === 215 /* FunctionExpression */ || node.kind === 216 /* ArrowFunction */ || node.kind === 214 /* ParenthesizedExpression */ || node.kind === 257 /* VariableDeclaration */ || node.kind === 278 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos);
return filter(commentRanges, (comment) => text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
}
-var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/;
-var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/;
-var fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/;
-var defaultLibReferenceRegEx = /^(\/\/\/\s*/;
function isVariableLike(node) {
if (node) {
switch (node.kind) {
@@ -10917,9 +10658,6 @@ function isPartOfTypeQuery(node) {
function isInJSFile(node) {
return !!node && !!(node.flags & 262144 /* JavaScriptFile */);
}
-function isInJsonFile(node) {
- return !!node && !!(node.flags & 67108864 /* JsonFile */);
-}
function isInJSDoc(node) {
return !!node && !!(node.flags & 8388608 /* JSDoc */);
}
@@ -11166,23 +10904,6 @@ function isFunctionSymbol(symbol) {
const decl = symbol.valueDeclaration;
return decl.kind === 259 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
}
-function getExternalModuleName(node) {
- switch (node.kind) {
- case 269 /* ImportDeclaration */:
- case 275 /* ExportDeclaration */:
- return node.moduleSpecifier;
- case 268 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 280 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0;
- case 202 /* ImportType */:
- return isLiteralImportTypeNode(node) ? node.argument.literal : void 0;
- case 210 /* CallExpression */:
- return node.arguments[0];
- case 264 /* ModuleDeclaration */:
- return node.name.kind === 10 /* StringLiteral */ ? node.name : void 0;
- default:
- return Debug.assertNever(node);
- }
-}
function isJSDocConstructSignature(node) {
const param = isJSDocFunctionType(node) ? firstOrUndefined(node.parameters) : void 0;
const name = tryCast(param && param.name, isIdentifier);
@@ -11411,14 +11132,6 @@ function skipParentheses(node, excludeJSDocTypeAssertions) {
const flags = excludeJSDocTypeAssertions ? 1 /* Parentheses */ | 16 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */;
return skipOuterExpressions(node, flags);
}
-function isNodeDescendantOf(node, ancestor) {
- while (node) {
- if (node === ancestor)
- return true;
- node = node.parent;
- }
- return false;
-}
function isIdentifierName(node) {
const parent = node.parent;
switch (parent.kind) {
@@ -11705,16 +11418,9 @@ function getBinaryOperatorPrecedence(kind) {
}
return -1;
}
-var templateSubstitutionRegExp = /\$\{/g;
-function escapeTemplateSubstitution(str) {
- return str.replace(templateSubstitutionRegExp, "\\${");
-}
function hasInvalidEscape(template) {
return template && !!(isNoSubstitutionTemplateLiteral(template) ? template.templateFlags : template.head.templateFlags || some(template.templateSpans, (span) => !!span.literal.templateFlags));
}
-var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
-var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
-var backtickQuoteEscapedCharsRegExp = /\r\n|[\\\`\u0000-\u001f\t\v\f\b\r\u2028\u2029\u0085]/g;
var escapedCharsMap = new Map(Object.entries({
" ": "\\t",
"\v": "\\v",
@@ -11735,231 +11441,10 @@ var escapedCharsMap = new Map(Object.entries({
"\r\n": "\\r\\n"
// special case for CRLFs in backticks
}));
-function encodeUtf16EscapeSequence(charCode) {
- const hexCharCode = charCode.toString(16).toUpperCase();
- const paddedHexCode = ("0000" + hexCharCode).slice(-4);
- return "\\u" + paddedHexCode;
-}
-function getReplacement(c, offset, input) {
- if (c.charCodeAt(0) === 0 /* nullCharacter */) {
- const lookAhead = input.charCodeAt(offset + c.length);
- if (lookAhead >= 48 /* _0 */ && lookAhead <= 57 /* _9 */) {
- return "\\x00";
- }
- return "\\0";
- }
- return escapedCharsMap.get(c) || encodeUtf16EscapeSequence(c.charCodeAt(0));
-}
-function escapeString(s, quoteChar) {
- const escapedCharsRegExp = quoteChar === 96 /* backtick */ ? backtickQuoteEscapedCharsRegExp : quoteChar === 39 /* singleQuote */ ? singleQuoteEscapedCharsRegExp : doubleQuoteEscapedCharsRegExp;
- return s.replace(escapedCharsRegExp, getReplacement);
-}
-var nonAsciiCharacters = /[^\u0000-\u007F]/g;
-function escapeNonAsciiString(s, quoteChar) {
- s = escapeString(s, quoteChar);
- return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, (c) => encodeUtf16EscapeSequence(c.charCodeAt(0))) : s;
-}
-var jsxDoubleQuoteEscapedCharsRegExp = /[\"\u0000-\u001f\u2028\u2029\u0085]/g;
-var jsxSingleQuoteEscapedCharsRegExp = /[\'\u0000-\u001f\u2028\u2029\u0085]/g;
var jsxEscapedCharsMap = new Map(Object.entries({
'"': """,
"'": "'"
}));
-function encodeJsxCharacterEntity(charCode) {
- const hexCharCode = charCode.toString(16).toUpperCase();
- return "" + hexCharCode + ";";
-}
-function getJsxAttributeStringReplacement(c) {
- if (c.charCodeAt(0) === 0 /* nullCharacter */) {
- return "";
- }
- return jsxEscapedCharsMap.get(c) || encodeJsxCharacterEntity(c.charCodeAt(0));
-}
-function escapeJsxAttributeString(s, quoteChar) {
- const escapedCharsRegExp = quoteChar === 39 /* singleQuote */ ? jsxSingleQuoteEscapedCharsRegExp : jsxDoubleQuoteEscapedCharsRegExp;
- return s.replace(escapedCharsRegExp, getJsxAttributeStringReplacement);
-}
-var indentStrings = ["", " "];
-function getIndentString(level) {
- const singleLevel = indentStrings[1];
- for (let current = indentStrings.length; current <= level; current++) {
- indentStrings.push(indentStrings[current - 1] + singleLevel);
- }
- return indentStrings[level];
-}
-function getIndentSize() {
- return indentStrings[1].length;
-}
-function createTextWriter(newLine) {
- let output;
- let indent2;
- let lineStart;
- let lineCount;
- let linePos;
- let hasTrailingComment = false;
- function updateLineCountAndPosFor(s) {
- const lineStartsOfS = computeLineStarts(s);
- if (lineStartsOfS.length > 1) {
- lineCount = lineCount + lineStartsOfS.length - 1;
- linePos = output.length - s.length + last(lineStartsOfS);
- lineStart = linePos - output.length === 0;
- } else {
- lineStart = false;
- }
- }
- function writeText(s) {
- if (s && s.length) {
- if (lineStart) {
- s = getIndentString(indent2) + s;
- lineStart = false;
- }
- output += s;
- updateLineCountAndPosFor(s);
- }
- }
- function write(s) {
- if (s)
- hasTrailingComment = false;
- writeText(s);
- }
- function writeComment(s) {
- if (s)
- hasTrailingComment = true;
- writeText(s);
- }
- function reset() {
- output = "";
- indent2 = 0;
- lineStart = true;
- lineCount = 0;
- linePos = 0;
- hasTrailingComment = false;
- }
- function rawWrite(s) {
- if (s !== void 0) {
- output += s;
- updateLineCountAndPosFor(s);
- hasTrailingComment = false;
- }
- }
- function writeLiteral(s) {
- if (s && s.length) {
- write(s);
- }
- }
- function writeLine(force) {
- if (!lineStart || force) {
- output += newLine;
- lineCount++;
- linePos = output.length;
- lineStart = true;
- hasTrailingComment = false;
- }
- }
- function getTextPosWithWriteLine() {
- return lineStart ? output.length : output.length + newLine.length;
- }
- reset();
- return {
- write,
- rawWrite,
- writeLiteral,
- writeLine,
- increaseIndent: () => {
- indent2++;
- },
- decreaseIndent: () => {
- indent2--;
- },
- getIndent: () => indent2,
- getTextPos: () => output.length,
- getLine: () => lineCount,
- getColumn: () => lineStart ? indent2 * getIndentSize() : output.length - linePos,
- getText: () => output,
- isAtStartOfLine: () => lineStart,
- hasTrailingComment: () => hasTrailingComment,
- hasTrailingWhitespace: () => !!output.length && isWhiteSpaceLike(output.charCodeAt(output.length - 1)),
- clear: reset,
- writeKeyword: write,
- writeOperator: write,
- writeParameter: write,
- writeProperty: write,
- writePunctuation: write,
- writeSpace: write,
- writeStringLiteral: write,
- writeSymbol: (s, _) => write(s),
- writeTrailingSemicolon: write,
- writeComment,
- getTextPosWithWriteLine
- };
-}
-function getTrailingSemicolonDeferringWriter(writer) {
- let pendingTrailingSemicolon = false;
- function commitPendingTrailingSemicolon() {
- if (pendingTrailingSemicolon) {
- writer.writeTrailingSemicolon(";");
- pendingTrailingSemicolon = false;
- }
- }
- return {
- ...writer,
- writeTrailingSemicolon() {
- pendingTrailingSemicolon = true;
- },
- writeLiteral(s) {
- commitPendingTrailingSemicolon();
- writer.writeLiteral(s);
- },
- writeStringLiteral(s) {
- commitPendingTrailingSemicolon();
- writer.writeStringLiteral(s);
- },
- writeSymbol(s, sym) {
- commitPendingTrailingSemicolon();
- writer.writeSymbol(s, sym);
- },
- writePunctuation(s) {
- commitPendingTrailingSemicolon();
- writer.writePunctuation(s);
- },
- writeKeyword(s) {
- commitPendingTrailingSemicolon();
- writer.writeKeyword(s);
- },
- writeOperator(s) {
- commitPendingTrailingSemicolon();
- writer.writeOperator(s);
- },
- writeParameter(s) {
- commitPendingTrailingSemicolon();
- writer.writeParameter(s);
- },
- writeSpace(s) {
- commitPendingTrailingSemicolon();
- writer.writeSpace(s);
- },
- writeProperty(s) {
- commitPendingTrailingSemicolon();
- writer.writeProperty(s);
- },
- writeComment(s) {
- commitPendingTrailingSemicolon();
- writer.writeComment(s);
- },
- writeLine() {
- commitPendingTrailingSemicolon();
- writer.writeLine();
- },
- increaseIndent() {
- commitPendingTrailingSemicolon();
- writer.increaseIndent();
- },
- decreaseIndent() {
- commitPendingTrailingSemicolon();
- writer.decreaseIndent();
- }
- };
-}
function hostUsesCaseSensitiveFileNames(host) {
return host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : false;
}
@@ -11993,156 +11478,12 @@ function writeFileEnsuringDirectories(path2, data, writeByteOrderMark, writeFile
writeFile2(path2, data, writeByteOrderMark);
}
}
-function getLineOfLocalPositionFromLineMap(lineMap, pos) {
- return computeLineOfPosition(lineMap, pos);
-}
function isThisIdentifier(node) {
return !!node && node.kind === 79 /* Identifier */ && identifierIsThisKeyword(node);
}
function identifierIsThisKeyword(id) {
return id.escapedText === "this";
}
-function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) {
- emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments);
-}
-function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) {
- if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos && getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) {
- writer.writeLine();
- }
-}
-function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) {
- if (pos !== commentPos && getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) {
- writer.writeLine();
- }
-}
-function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) {
- if (comments && comments.length > 0) {
- if (leadingSeparator) {
- writer.writeSpace(" ");
- }
- let emitInterveningSeparator = false;
- for (const comment of comments) {
- if (emitInterveningSeparator) {
- writer.writeSpace(" ");
- emitInterveningSeparator = false;
- }
- writeComment(text, lineMap, writer, comment.pos, comment.end, newLine);
- if (comment.hasTrailingNewLine) {
- writer.writeLine();
- } else {
- emitInterveningSeparator = true;
- }
- }
- if (emitInterveningSeparator && trailingSeparator) {
- writer.writeSpace(" ");
- }
- }
-}
-function emitDetachedComments(text, lineMap, writer, writeComment, node, newLine, removeComments) {
- let leadingComments;
- let currentDetachedCommentInfo;
- if (removeComments) {
- if (node.pos === 0) {
- leadingComments = filter(getLeadingCommentRanges(text, node.pos), isPinnedCommentLocal);
- }
- } else {
- leadingComments = getLeadingCommentRanges(text, node.pos);
- }
- if (leadingComments) {
- const detachedComments = [];
- let lastComment;
- for (const comment of leadingComments) {
- if (lastComment) {
- const lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, lastComment.end);
- const commentLine = getLineOfLocalPositionFromLineMap(lineMap, comment.pos);
- if (commentLine >= lastCommentLine + 2) {
- break;
- }
- }
- detachedComments.push(comment);
- lastComment = comment;
- }
- if (detachedComments.length) {
- const lastCommentLine = getLineOfLocalPositionFromLineMap(lineMap, last(detachedComments).end);
- const nodeLine = getLineOfLocalPositionFromLineMap(lineMap, skipTrivia(text, node.pos));
- if (nodeLine >= lastCommentLine + 2) {
- emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments);
- emitComments(
- text,
- lineMap,
- writer,
- detachedComments,
- /*leadingSeparator*/
- false,
- /*trailingSeparator*/
- true,
- newLine,
- writeComment
- );
- currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: last(detachedComments).end };
- }
- }
- }
- return currentDetachedCommentInfo;
- function isPinnedCommentLocal(comment) {
- return isPinnedComment(text, comment.pos);
- }
-}
-function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) {
- if (text.charCodeAt(commentPos + 1) === 42 /* asterisk */) {
- const firstCommentLineAndCharacter = computeLineAndCharacterOfPosition(lineMap, commentPos);
- const lineCount = lineMap.length;
- let firstCommentLineIndent;
- for (let pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) {
- const nextLineStart = currentLine + 1 === lineCount ? text.length + 1 : lineMap[currentLine + 1];
- if (pos !== commentPos) {
- if (firstCommentLineIndent === void 0) {
- firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos);
- }
- const currentWriterIndentSpacing = writer.getIndent() * getIndentSize();
- const spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(text, pos, nextLineStart);
- if (spacesToEmit > 0) {
- let numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize();
- const indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize());
- writer.rawWrite(indentSizeSpaceString);
- while (numberOfSingleSpacesToEmit) {
- writer.rawWrite(" ");
- numberOfSingleSpacesToEmit--;
- }
- } else {
- writer.rawWrite("");
- }
- }
- writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart);
- pos = nextLineStart;
- }
- } else {
- writer.writeComment(text.substring(commentPos, commentEnd));
- }
-}
-function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) {
- const end = Math.min(commentEnd, nextLineStart - 1);
- const currentLineText = trimString(text.substring(pos, end));
- if (currentLineText) {
- writer.writeComment(currentLineText);
- if (end !== commentEnd) {
- writer.writeLine();
- }
- } else {
- writer.rawWrite(newLine);
- }
-}
-function calculateIndent(text, pos, end) {
- let currentLineIndent = 0;
- for (; pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos)); pos++) {
- if (text.charCodeAt(pos) === 9 /* tab */) {
- currentLineIndent += getIndentSize() - currentLineIndent % getIndentSize();
- } else {
- currentLineIndent++;
- }
- }
- return currentLineIndent;
-}
function hasSyntacticModifier(node, flags) {
return !!getSelectedSyntacticModifierFlags(node, flags);
}
@@ -12323,118 +11664,6 @@ function readJson(path2, host) {
function directoryProbablyExists(directoryName, host) {
return !host.directoryExists || host.directoryExists(directoryName);
}
-var carriageReturnLineFeed = "\r\n";
-var lineFeed = "\n";
-function getNewLineCharacter(options) {
- switch (options.newLine) {
- case 0 /* CarriageReturnLineFeed */:
- return carriageReturnLineFeed;
- case 1 /* LineFeed */:
- case void 0:
- return lineFeed;
- }
-}
-function createRange(pos, end = pos) {
- Debug.assert(end >= pos || end === -1);
- return { pos, end };
-}
-function moveRangePos(range, pos) {
- return createRange(pos, range.end);
-}
-function moveRangePastDecorators(node) {
- const lastDecorator = canHaveModifiers(node) ? findLast(node.modifiers, isDecorator) : void 0;
- return lastDecorator && !positionIsSynthesized(lastDecorator.end) ? moveRangePos(node, lastDecorator.end) : node;
-}
-function moveRangePastModifiers(node) {
- if (isPropertyDeclaration(node) || isMethodDeclaration(node)) {
- return moveRangePos(node, node.name.pos);
- }
- const lastModifier = canHaveModifiers(node) ? lastOrUndefined(node.modifiers) : void 0;
- return lastModifier && !positionIsSynthesized(lastModifier.end) ? moveRangePos(node, lastModifier.end) : moveRangePastDecorators(node);
-}
-function rangeIsOnSingleLine(range, sourceFile) {
- return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile);
-}
-function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) {
- return positionsAreOnSameLine(
- getStartPositionOfRange(
- range1,
- sourceFile,
- /*includeComments*/
- false
- ),
- getStartPositionOfRange(
- range2,
- sourceFile,
- /*includeComments*/
- false
- ),
- sourceFile
- );
-}
-function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) {
- return positionsAreOnSameLine(range1.end, range2.end, sourceFile);
-}
-function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) {
- return positionsAreOnSameLine(getStartPositionOfRange(
- range1,
- sourceFile,
- /*includeComments*/
- false
- ), range2.end, sourceFile);
-}
-function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) {
- return positionsAreOnSameLine(range1.end, getStartPositionOfRange(
- range2,
- sourceFile,
- /*includeComments*/
- false
- ), sourceFile);
-}
-function getLinesBetweenRangeEndAndRangeStart(range1, range2, sourceFile, includeSecondRangeComments) {
- const range2Start = getStartPositionOfRange(range2, sourceFile, includeSecondRangeComments);
- return getLinesBetweenPositions(sourceFile, range1.end, range2Start);
-}
-function positionsAreOnSameLine(pos1, pos2, sourceFile) {
- return getLinesBetweenPositions(sourceFile, pos1, pos2) === 0;
-}
-function getStartPositionOfRange(range, sourceFile, includeComments) {
- return positionIsSynthesized(range.pos) ? -1 : skipTrivia(
- sourceFile.text,
- range.pos,
- /*stopAfterLineBreak*/
- false,
- includeComments
- );
-}
-function getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) {
- const startPos = skipTrivia(
- sourceFile.text,
- pos,
- /*stopAfterLineBreak*/
- false,
- includeComments
- );
- const prevPos = getPreviousNonWhitespacePosition(startPos, stopPos, sourceFile);
- return getLinesBetweenPositions(sourceFile, prevPos != null ? prevPos : stopPos, startPos);
-}
-function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) {
- const nextPos = skipTrivia(
- sourceFile.text,
- pos,
- /*stopAfterLineBreak*/
- false,
- includeComments
- );
- return getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
-}
-function getPreviousNonWhitespacePosition(pos, stopPos = 0, sourceFile) {
- while (pos-- > stopPos) {
- if (!isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
- return pos;
- }
- }
-}
function closeFileWatcher(watcher) {
watcher.close();
}
@@ -12467,15 +11696,6 @@ function isTypeNodeKind(kind) {
function isAccessExpression(node) {
return node.kind === 208 /* PropertyAccessExpression */ || node.kind === 209 /* ElementAccessExpression */;
}
-function isBundleFileTextLike(section) {
- switch (section.kind) {
- case "text" /* Text */:
- case "internal" /* Internal */:
- return true;
- default:
- return false;
- }
-}
function getLeftmostAccessExpression(expr) {
while (isAccessExpression(expr)) {
expr = expr.expression;
@@ -12728,12 +11948,18 @@ function getEmitModuleResolutionKind(compilerOptions) {
}
return moduleResolution;
}
+function getIsolatedModules(options) {
+ return !!(options.isolatedModules || options.verbatimModuleSyntax);
+}
function unreachableCodeIsError(options) {
return options.allowUnreachableCode === false;
}
function unusedLabelIsError(options) {
return options.allowUnusedLabels === false;
}
+function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
+ return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
+}
function getResolveJsonModule(compilerOptions) {
if (compilerOptions.resolveJsonModule !== void 0) {
return compilerOptions.resolveJsonModule;
@@ -12741,7 +11967,7 @@ function getResolveJsonModule(compilerOptions) {
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
}
function shouldPreserveConstEnums(compilerOptions) {
- return !!(compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
+ return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
}
function getStrictOptionValue(compilerOptions, flag) {
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
@@ -13151,71 +12377,6 @@ function setParentRecursive(rootNode, incremental) {
return bindParentToChildIgnoringJSDoc(child, parent) || bindJSDoc(child);
}
}
-function getContainingNodeArray(node) {
- if (!node.parent)
- return void 0;
- switch (node.kind) {
- case 165 /* TypeParameter */:
- const { parent: parent2 } = node;
- return parent2.kind === 192 /* InferType */ ? void 0 : parent2.typeParameters;
- case 166 /* Parameter */:
- return node.parent.parameters;
- case 201 /* TemplateLiteralTypeSpan */:
- return node.parent.templateSpans;
- case 236 /* TemplateSpan */:
- return node.parent.templateSpans;
- case 167 /* Decorator */: {
- const { parent: parent3 } = node;
- return canHaveDecorators(parent3) ? parent3.modifiers : void 0;
- }
- case 294 /* HeritageClause */:
- return node.parent.heritageClauses;
- }
- const { parent } = node;
- if (isJSDocTag(node)) {
- return isJSDocTypeLiteral(node.parent) ? void 0 : node.parent.tags;
- }
- switch (parent.kind) {
- case 184 /* TypeLiteral */:
- case 261 /* InterfaceDeclaration */:
- return isTypeElement(node) ? parent.members : void 0;
- case 189 /* UnionType */:
- case 190 /* IntersectionType */:
- return parent.types;
- case 186 /* TupleType */:
- case 206 /* ArrayLiteralExpression */:
- case 357 /* CommaListExpression */:
- case 272 /* NamedImports */:
- case 276 /* NamedExports */:
- return parent.elements;
- case 207 /* ObjectLiteralExpression */:
- case 289 /* JsxAttributes */:
- return parent.properties;
- case 210 /* CallExpression */:
- case 211 /* NewExpression */:
- return isTypeNode(node) ? parent.typeArguments : parent.expression === node ? void 0 : parent.arguments;
- case 281 /* JsxElement */:
- case 285 /* JsxFragment */:
- return isJsxChild(node) ? parent.children : void 0;
- case 283 /* JsxOpeningElement */:
- case 282 /* JsxSelfClosingElement */:
- return isTypeNode(node) ? parent.typeArguments : void 0;
- case 238 /* Block */:
- case 292 /* CaseClause */:
- case 293 /* DefaultClause */:
- case 265 /* ModuleBlock */:
- return parent.statements;
- case 266 /* CaseBlock */:
- return parent.clauses;
- case 260 /* ClassDeclaration */:
- case 228 /* ClassExpression */:
- return isClassElement(node) ? parent.members : void 0;
- case 263 /* EnumDeclaration */:
- return isEnumMember(node) ? parent.members : void 0;
- case 308 /* SourceFile */:
- return parent.statements;
- }
-}
// src/compiler/factory/baseNodeFactory.ts
function createBaseNodeFactory() {
@@ -15804,24 +14965,7 @@ function createNodeFactory(flags, baseFactory2) {
return node;
}
function propagateAssignmentPatternFlags(node) {
- if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
- return 65536 /* ContainsObjectRestOrSpread */;
- if (node.transformFlags & 128 /* ContainsES2018 */) {
- for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
- const target = getTargetOfBindingOrAssignmentElement(element);
- if (target && isAssignmentPattern(target)) {
- if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
- return 65536 /* ContainsObjectRestOrSpread */;
- }
- if (target.transformFlags & 128 /* ContainsES2018 */) {
- const flags2 = propagateAssignmentPatternFlags(target);
- if (flags2)
- return flags2;
- }
- }
- }
- }
- return 0 /* None */;
+ return containsObjectRestOrSpread(node) ? 65536 /* ContainsObjectRestOrSpread */ : 0 /* None */;
}
function updateBinaryExpression(node, left, operator, right) {
return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node;
@@ -18299,22 +17443,6 @@ function getSyntheticTrailingComments(node) {
var _a2;
return (_a2 = node.emitNode) == null ? void 0 : _a2.trailingComments;
}
-function getConstantValue(node) {
- var _a2;
- return (_a2 = node.emitNode) == null ? void 0 : _a2.constantValue;
-}
-function getEmitHelpers(node) {
- var _a2;
- return (_a2 = node.emitNode) == null ? void 0 : _a2.helpers;
-}
-function getSnippetElement(node) {
- var _a2;
- return (_a2 = node.emitNode) == null ? void 0 : _a2.snippetElement;
-}
-function getTypeNode(node) {
- var _a2;
- return (_a2 = node.emitNode) == null ? void 0 : _a2.typeNode;
-}
function setIdentifierTypeArguments(node, typeArguments) {
getOrCreateEmitNode(node).identifierTypeArguments = typeArguments;
return node;
@@ -18329,17 +17457,6 @@ function setIdentifierAutoGenerate(node, autoGenerate) {
}
// src/compiler/factory/emitHelpers.ts
-function compareEmitHelpers(x, y) {
- if (x === y)
- return 0 /* EqualTo */;
- if (x.priority === y.priority)
- return 0 /* EqualTo */;
- if (x.priority === void 0)
- return 1 /* GreaterThan */;
- if (y.priority === void 0)
- return -1 /* LessThan */;
- return compareValues(x.priority, y.priority);
-}
function helperString(input, ...args) {
return (uniqueName) => {
let result = "";
@@ -18623,9 +17740,6 @@ function isNonNullExpression(node) {
function isMetaProperty(node) {
return node.kind === 233 /* MetaProperty */;
}
-function isPartiallyEmittedExpression(node) {
- return node.kind === 356 /* PartiallyEmittedExpression */;
-}
function isCommaListExpression(node) {
return node.kind === 357 /* CommaListExpression */;
}
@@ -18638,9 +17752,6 @@ function isBlock(node) {
function isVariableStatement(node) {
return node.kind === 240 /* VariableStatement */;
}
-function isEmptyStatement(node) {
- return node.kind === 239 /* EmptyStatement */;
-}
function isExpressionStatement(node) {
return node.kind === 241 /* ExpressionStatement */;
}
@@ -18749,15 +17860,9 @@ function isShorthandPropertyAssignment(node) {
function isEnumMember(node) {
return node.kind === 302 /* EnumMember */;
}
-function isUnparsedPrepend(node) {
- return node.kind === 304 /* UnparsedPrepend */;
-}
function isSourceFile(node) {
return node.kind === 308 /* SourceFile */;
}
-function isUnparsedSource(node) {
- return node.kind === 310 /* UnparsedSource */;
-}
function isJSDocTypeExpression(node) {
return node.kind === 312 /* JSDocTypeExpression */;
}
@@ -18770,9 +17875,6 @@ function isJSDocFunctionType(node) {
function isJSDoc(node) {
return node.kind === 323 /* JSDoc */;
}
-function isJSDocTypeLiteral(node) {
- return node.kind === 325 /* JSDocTypeLiteral */;
-}
function isJSDocPublicTag(node) {
return node.kind === 336 /* JSDocPublicTag */;
}
@@ -18870,16 +17972,6 @@ function startOnNewLine(node) {
true
);
}
-function getExternalHelpersModuleName(node) {
- const parseNode = getOriginalNode(node, isSourceFile);
- const emitNode = parseNode && parseNode.emitNode;
- return emitNode && emitNode.externalHelpersModuleName;
-}
-function hasRecordedExternalHelpers(sourceFile) {
- const parseNode = getOriginalNode(sourceFile, isSourceFile);
- const emitNode = parseNode && parseNode.emitNode;
- return !!emitNode && (!!emitNode.externalHelpersModuleName || !!emitNode.externalHelpers);
-}
function getTargetOfBindingOrAssignmentElement(bindingElement) {
if (isDeclarationBindingElement(bindingElement)) {
return bindingElement.name;
@@ -19124,25 +18216,6 @@ function createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight,
return resultHolder.value;
}
}
-function getNodeForGeneratedName(name) {
- var _a2;
- const autoGenerate = name.emitNode.autoGenerate;
- if (autoGenerate.flags & 4 /* Node */) {
- const autoGenerateId = autoGenerate.id;
- let node = name;
- let original = node.original;
- while (original) {
- node = original;
- const autoGenerate2 = (_a2 = node.emitNode) == null ? void 0 : _a2.autoGenerate;
- if (isMemberName(node) && (autoGenerate2 === void 0 || !!(autoGenerate2.flags & 4 /* Node */) && autoGenerate2.id !== autoGenerateId)) {
- break;
- }
- original = node.original;
- }
- return node;
- }
- return name;
-}
function formatGeneratedNamePart(part, generateName) {
return typeof part === "object" ? formatGeneratedName(
/*privateName*/
@@ -19165,6 +18238,25 @@ function formatGeneratedName(privateName, prefix, baseName, suffix, generateName
baseName = formatIdentifier(baseName, generateName);
return `${privateName ? "#" : ""}${prefix}${baseName}${suffix}`;
}
+function containsObjectRestOrSpread(node) {
+ if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */)
+ return true;
+ if (node.transformFlags & 128 /* ContainsES2018 */) {
+ for (const element of getElementsOfBindingOrAssignmentPattern(node)) {
+ const target = getTargetOfBindingOrAssignmentElement(element);
+ if (target && isAssignmentPattern(target)) {
+ if (target.transformFlags & 65536 /* ContainsObjectRestOrSpread */) {
+ return true;
+ }
+ if (target.transformFlags & 128 /* ContainsES2018 */) {
+ if (containsObjectRestOrSpread(target))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
// src/compiler/factory/utilitiesPublic.ts
function setTextRange(range, location) {
@@ -19174,10 +18266,6 @@ function canHaveModifiers(node) {
const kind = node.kind;
return kind === 165 /* TypeParameter */ || kind === 166 /* Parameter */ || kind === 168 /* PropertySignature */ || kind === 169 /* PropertyDeclaration */ || kind === 170 /* MethodSignature */ || kind === 171 /* MethodDeclaration */ || kind === 173 /* Constructor */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 178 /* IndexSignature */ || kind === 182 /* ConstructorType */ || kind === 215 /* FunctionExpression */ || kind === 216 /* ArrowFunction */ || kind === 228 /* ClassExpression */ || kind === 240 /* VariableStatement */ || kind === 259 /* FunctionDeclaration */ || kind === 260 /* ClassDeclaration */ || kind === 261 /* InterfaceDeclaration */ || kind === 262 /* TypeAliasDeclaration */ || kind === 263 /* EnumDeclaration */ || kind === 264 /* ModuleDeclaration */ || kind === 268 /* ImportEqualsDeclaration */ || kind === 269 /* ImportDeclaration */ || kind === 274 /* ExportAssignment */ || kind === 275 /* ExportDeclaration */;
}
-function canHaveDecorators(node) {
- const kind = node.kind;
- return kind === 166 /* Parameter */ || kind === 169 /* PropertyDeclaration */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 228 /* ClassExpression */ || kind === 260 /* ClassDeclaration */;
-}
// src/compiler/parser.ts
var NodeConstructor;
@@ -19767,22 +18855,22 @@ function isExternalModule(file) {
}
var Parser;
((Parser2) => {
- const scanner = createScanner(
+ var scanner = createScanner(
99 /* Latest */,
/*skipTrivia*/
true
);
- const disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
- let NodeConstructor2;
- let TokenConstructor2;
- let IdentifierConstructor2;
- let PrivateIdentifierConstructor2;
- let SourceFileConstructor2;
+ var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
+ var NodeConstructor2;
+ var TokenConstructor2;
+ var IdentifierConstructor2;
+ var PrivateIdentifierConstructor2;
+ var SourceFileConstructor2;
function countNode(node) {
nodeCount++;
return node;
}
- const baseNodeFactory = {
+ var baseNodeFactory = {
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
kind,
/*pos*/
@@ -19819,25 +18907,53 @@ var Parser;
0
))
};
- const factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
- let fileName;
- let sourceFlags;
- let sourceText;
- let languageVersion;
- let scriptKind;
- let languageVariant;
- let parseDiagnostics;
- let jsDocDiagnostics;
- let syntaxCursor;
- let currentToken;
- let nodeCount;
- let identifiers;
- let identifierCount;
- let parsingContext;
- let notParenthesizedArrow;
- let contextFlags;
- let topLevel = true;
- let parseErrorBeforeNextFinishedNode = false;
+ var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
+ var {
+ createNodeArray: factoryCreateNodeArray,
+ createNumericLiteral: factoryCreateNumericLiteral,
+ createStringLiteral: factoryCreateStringLiteral,
+ createLiteralLikeNode: factoryCreateLiteralLikeNode,
+ createIdentifier: factoryCreateIdentifier,
+ createPrivateIdentifier: factoryCreatePrivateIdentifier,
+ createToken: factoryCreateToken,
+ createArrayLiteralExpression: factoryCreateArrayLiteralExpression,
+ createObjectLiteralExpression: factoryCreateObjectLiteralExpression,
+ createPropertyAccessExpression: factoryCreatePropertyAccessExpression,
+ createPropertyAccessChain: factoryCreatePropertyAccessChain,
+ createElementAccessExpression: factoryCreateElementAccessExpression,
+ createElementAccessChain: factoryCreateElementAccessChain,
+ createCallExpression: factoryCreateCallExpression,
+ createCallChain: factoryCreateCallChain,
+ createNewExpression: factoryCreateNewExpression,
+ createParenthesizedExpression: factoryCreateParenthesizedExpression,
+ createBlock: factoryCreateBlock,
+ createVariableStatement: factoryCreateVariableStatement,
+ createExpressionStatement: factoryCreateExpressionStatement,
+ createIfStatement: factoryCreateIfStatement,
+ createWhileStatement: factoryCreateWhileStatement,
+ createForStatement: factoryCreateForStatement,
+ createForOfStatement: factoryCreateForOfStatement,
+ createVariableDeclaration: factoryCreateVariableDeclaration,
+ createVariableDeclarationList: factoryCreateVariableDeclarationList
+ } = factory2;
+ var fileName;
+ var sourceFlags;
+ var sourceText;
+ var languageVersion;
+ var scriptKind;
+ var languageVariant;
+ var parseDiagnostics;
+ var jsDocDiagnostics;
+ var syntaxCursor;
+ var currentToken;
+ var nodeCount;
+ var identifiers;
+ var identifierCount;
+ var parsingContext;
+ var notParenthesizedArrow;
+ var contextFlags;
+ var topLevel = true;
+ var parseErrorBeforeNextFinishedNode = false;
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
var _a2;
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
@@ -19937,8 +19053,8 @@ var Parser;
}
}
}
- const expression = isArray(expressions) ? finishNode(factory2.createArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
- const statement = factory2.createExpressionStatement(expression);
+ const expression = isArray(expressions) ? finishNode(factoryCreateArrayLiteralExpression(expressions), pos) : Debug.checkDefined(expressions);
+ const statement = factoryCreateExpressionStatement(expression);
finishNode(statement, pos);
statements = createNodeArray([statement], pos);
endOfFileToken = parseExpectedToken(1 /* EndOfFileToken */, Diagnostics.Unexpected_token);
@@ -20030,7 +19146,7 @@ var Parser;
}
sourceFlags = contextFlags;
nextToken();
- const statements = parseList(ParsingContext.SourceElements, parseStatement);
+ const statements = parseList(0 /* SourceElements */, parseStatement);
Debug.assert(token() === 1 /* EndOfFileToken */);
const endOfFileToken = addJSDocComment(parseTokenNode());
const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
@@ -20093,7 +19209,7 @@ var Parser;
nextToken();
while (token() !== 1 /* EndOfFileToken */) {
const startPos = scanner.getStartPos();
- const statement = parseListElement(ParsingContext.SourceElements, parseStatement);
+ const statement = parseListElement(0 /* SourceElements */, parseStatement);
statements.push(statement);
if (startPos === scanner.getStartPos()) {
nextToken();
@@ -20121,7 +19237,7 @@ var Parser;
}
}
syntaxCursor = savedSyntaxCursor;
- return factory2.updateSourceFile(sourceFile, setTextRange(factory2.createNodeArray(statements), sourceFile.statements));
+ return factory2.updateSourceFile(sourceFile, setTextRange(factoryCreateNodeArray(statements), sourceFile.statements));
function containsPossibleTopLevelAwait(node) {
return !(node.flags & 32768 /* AwaitContext */) && !!(node.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */);
}
@@ -20562,13 +19678,13 @@ var Parser;
const pos = getNodePos();
const kind = token();
nextToken();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseTokenNodeJSDoc() {
const pos = getNodePos();
const kind = token();
nextTokenJSDoc();
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function canParseSemicolon() {
if (token() === 26 /* SemicolonToken */) {
@@ -20589,7 +19705,7 @@ var Parser;
return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */);
}
function createNodeArray(elements, pos, end, hasTrailingComma) {
- const array = factory2.createNodeArray(elements, hasTrailingComma);
+ const array = factoryCreateNodeArray(elements, hasTrailingComma);
setTextRangePosEnd(array, pos, end != null ? end : scanner.getStartPos());
return array;
}
@@ -20611,7 +19727,7 @@ var Parser;
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
const pos = getNodePos();
- const result = kind === 79 /* Identifier */ ? factory2.createIdentifier(
+ const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier(
"",
/*originalKeywordKind*/
void 0
@@ -20621,15 +19737,15 @@ var Parser;
"",
/*templateFlags*/
void 0
- ) : kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(
+ ) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(
"",
/*numericLiteralFlags*/
void 0
- ) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ ) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
"",
/*isSingleQuote*/
void 0
- ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factory2.createToken(kind);
+ ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind);
return finishNode(result, pos);
}
function internIdentifier(text) {
@@ -20647,7 +19763,7 @@ var Parser;
const text = internIdentifier(scanner.getTokenValue());
const hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
nextTokenWithoutCheck();
- return finishNode(factory2.createIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
+ return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos);
}
if (token() === 80 /* PrivateIdentifier */) {
parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
@@ -20718,7 +19834,7 @@ var Parser;
}
function parsePrivateIdentifier() {
const pos = getNodePos();
- const node = factory2.createPrivateIdentifier(internIdentifier(scanner.getTokenValue()));
+ const node = factoryCreatePrivateIdentifier(internIdentifier(scanner.getTokenValue()));
nextToken();
return finishNode(node, pos);
}
@@ -20747,7 +19863,6 @@ var Parser;
return canFollowExportModifier();
case 88 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 127 /* AccessorKeyword */:
case 124 /* StaticKeyword */:
case 137 /* GetKeyword */:
case 151 /* SetKeyword */:
@@ -20780,19 +19895,19 @@ var Parser;
return true;
}
switch (parsingContext2) {
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return lookAhead(isClassMemberStart) || token() === 26 /* SemicolonToken */ && !inErrorRecovery;
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return token() === 22 /* OpenBracketToken */ || isLiteralPropertyName();
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
switch (token()) {
case 22 /* OpenBracketToken */:
case 41 /* AsteriskToken */:
@@ -20802,13 +19917,13 @@ var Parser;
default:
return isLiteralPropertyName();
}
- case ParsingContext.RestProperties:
+ case 18 /* RestProperties */:
return isLiteralPropertyName();
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return token() === 22 /* OpenBracketToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName();
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return isAssertionKey2();
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
if (token() === 18 /* OpenBraceToken */) {
return lookAhead(isValidHeritageClauseObjectLiteral);
}
@@ -20817,40 +19932,40 @@ var Parser;
} else {
return isIdentifier2() && !isHeritageClauseExtendsOrImplementsKeyword();
}
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2();
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
switch (token()) {
case 27 /* CommaToken */:
case 24 /* DotToken */:
return true;
}
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 25 /* DotDotDotToken */ || isStartOfExpression();
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isStartOfParameter(
/*isJSDocParameter*/
false
);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return isStartOfParameter(
/*isJSDocParameter*/
true
);
- case ParsingContext.TypeArguments:
- case ParsingContext.TupleElementTypes:
+ case 20 /* TypeArguments */:
+ case 21 /* TupleElementTypes */:
return token() === 27 /* CommaToken */ || isStartOfType();
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return isHeritageClause2();
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return tokenIsIdentifierOrKeyword(token());
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return true;
}
return Debug.fail("Non-exhaustive case in 'isListElement'.");
@@ -20894,41 +20009,41 @@ var Parser;
return true;
}
switch (kind) {
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauses:
- case ParsingContext.TypeMembers:
- case ParsingContext.ClassMembers:
- case ParsingContext.EnumMembers:
- case ParsingContext.ObjectLiteralMembers:
- case ParsingContext.ObjectBindingElements:
- case ParsingContext.ImportOrExportSpecifiers:
- case ParsingContext.AssertEntries:
+ case 1 /* BlockStatements */:
+ case 2 /* SwitchClauses */:
+ case 4 /* TypeMembers */:
+ case 5 /* ClassMembers */:
+ case 6 /* EnumMembers */:
+ case 12 /* ObjectLiteralMembers */:
+ case 9 /* ObjectBindingElements */:
+ case 23 /* ImportOrExportSpecifiers */:
+ case 24 /* AssertEntries */:
return token() === 19 /* CloseBraceToken */;
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return token() === 19 /* CloseBraceToken */ || token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */;
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return token() === 31 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
- case ParsingContext.ArrayLiteralMembers:
- case ParsingContext.TupleElementTypes:
- case ParsingContext.ArrayBindingElements:
+ case 15 /* ArrayLiteralMembers */:
+ case 21 /* TupleElementTypes */:
+ case 10 /* ArrayBindingElements */:
return token() === 23 /* CloseBracketToken */;
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
- case ParsingContext.RestProperties:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
+ case 18 /* RestProperties */:
return token() === 21 /* CloseParenToken */ || token() === 23 /* CloseBracketToken */;
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return token() !== 27 /* CommaToken */;
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return token() === 18 /* OpenBraceToken */ || token() === 19 /* CloseBraceToken */;
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return token() === 31 /* GreaterThanToken */ || token() === 43 /* SlashToken */;
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsSlash);
default:
return false;
@@ -20947,7 +20062,7 @@ var Parser;
return false;
}
function isInSomeParsingContext() {
- for (let kind = 0; kind < ParsingContext.Count; kind++) {
+ for (let kind = 0; kind < 25 /* Count */; kind++) {
if (parsingContext & 1 << kind) {
if (isListElement(
kind,
@@ -21016,38 +20131,38 @@ var Parser;
}
function isReusableParsingContext(parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
- case ParsingContext.SwitchClauses:
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
- case ParsingContext.EnumMembers:
- case ParsingContext.TypeMembers:
- case ParsingContext.VariableDeclarations:
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 5 /* ClassMembers */:
+ case 2 /* SwitchClauses */:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
+ case 6 /* EnumMembers */:
+ case 4 /* TypeMembers */:
+ case 8 /* VariableDeclarations */:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return true;
}
return false;
}
function canReuseNode(node, parsingContext2) {
switch (parsingContext2) {
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return isReusableClassMember(node);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return isReusableSwitchClause(node);
- case ParsingContext.SourceElements:
- case ParsingContext.BlockStatements:
- case ParsingContext.SwitchClauseStatements:
+ case 0 /* SourceElements */:
+ case 1 /* BlockStatements */:
+ case 3 /* SwitchClauseStatements */:
return isReusableStatement(node);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return isReusableEnumMember(node);
- case ParsingContext.TypeMembers:
+ case 4 /* TypeMembers */:
return isReusableTypeMember(node);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isReusableVariableDeclaration(node);
- case ParsingContext.JSDocParameters:
- case ParsingContext.Parameters:
+ case 17 /* JSDocParameters */:
+ case 16 /* Parameters */:
return isReusableParameter(node);
}
return false;
@@ -21157,56 +20272,56 @@ var Parser;
}
function parsingContextErrors(context) {
switch (context) {
- case ParsingContext.SourceElements:
+ case 0 /* SourceElements */:
return token() === 88 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(93 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.BlockStatements:
+ case 1 /* BlockStatements */:
return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
- case ParsingContext.SwitchClauses:
+ case 2 /* SwitchClauses */:
return parseErrorAtCurrentToken(Diagnostics.case_or_default_expected);
- case ParsingContext.SwitchClauseStatements:
+ case 3 /* SwitchClauseStatements */:
return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
- case ParsingContext.RestProperties:
- case ParsingContext.TypeMembers:
+ case 18 /* RestProperties */:
+ case 4 /* TypeMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_or_signature_expected);
- case ParsingContext.ClassMembers:
+ case 5 /* ClassMembers */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected);
- case ParsingContext.EnumMembers:
+ case 6 /* EnumMembers */:
return parseErrorAtCurrentToken(Diagnostics.Enum_member_expected);
- case ParsingContext.HeritageClauseElement:
+ case 7 /* HeritageClauseElement */:
return parseErrorAtCurrentToken(Diagnostics.Expression_expected);
- case ParsingContext.VariableDeclarations:
+ case 8 /* VariableDeclarations */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_variable_declaration_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Variable_declaration_expected);
- case ParsingContext.ObjectBindingElements:
+ case 9 /* ObjectBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Property_destructuring_pattern_expected);
- case ParsingContext.ArrayBindingElements:
+ case 10 /* ArrayBindingElements */:
return parseErrorAtCurrentToken(Diagnostics.Array_element_destructuring_pattern_expected);
- case ParsingContext.ArgumentExpressions:
+ case 11 /* ArgumentExpressions */:
return parseErrorAtCurrentToken(Diagnostics.Argument_expression_expected);
- case ParsingContext.ObjectLiteralMembers:
+ case 12 /* ObjectLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
- case ParsingContext.ArrayLiteralMembers:
+ case 15 /* ArrayLiteralMembers */:
return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
- case ParsingContext.JSDocParameters:
+ case 17 /* JSDocParameters */:
return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.Parameters:
+ case 16 /* Parameters */:
return isKeyword(token()) ? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token())) : parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
- case ParsingContext.TypeParameters:
+ case 19 /* TypeParameters */:
return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
- case ParsingContext.TypeArguments:
+ case 20 /* TypeArguments */:
return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
- case ParsingContext.TupleElementTypes:
+ case 21 /* TupleElementTypes */:
return parseErrorAtCurrentToken(Diagnostics.Type_expected);
- case ParsingContext.HeritageClauses:
+ case 22 /* HeritageClauses */:
return parseErrorAtCurrentToken(Diagnostics.Unexpected_token_expected);
- case ParsingContext.ImportOrExportSpecifiers:
+ case 23 /* ImportOrExportSpecifiers */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxAttributes:
+ case 13 /* JsxAttributes */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.JsxChildren:
+ case 14 /* JsxChildren */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
- case ParsingContext.AssertEntries:
+ case 24 /* AssertEntries */:
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
- case ParsingContext.Count:
+ case 25 /* Count */:
return Debug.fail("ParsingContext.Count used as a context");
default:
Debug.assertNever(context);
@@ -21265,7 +20380,7 @@ var Parser;
);
}
function getExpectedCommaDiagnostic(kind) {
- return kind === ParsingContext.EnumMembers ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
+ return kind === 6 /* EnumMembers */ ? Diagnostics.An_enum_member_name_must_be_followed_by_a_or : void 0;
}
function createMissingList() {
const list = createNodeArray([], getNodePos());
@@ -21434,12 +20549,12 @@ var Parser;
// never get a token like this. Instead, we would get 00 and 9 as two separate tokens.
// We also do not need to check for negatives because any prefix operator would be part of a
// parent unary expression.
- kind === 8 /* NumericLiteral */ ? factory2.createNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factory2.createStringLiteral(
+ kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner.getTokenValue(), scanner.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral(
scanner.getTokenValue(),
/*isSingleQuote*/
void 0,
scanner.hasExtendedUnicodeEscape()
- ) : isLiteralKind(kind) ? factory2.createLiteralLikeNode(kind, scanner.getTokenValue()) : Debug.fail()
+ ) : isLiteralKind(kind) ? factoryCreateLiteralLikeNode(kind, scanner.getTokenValue()) : Debug.fail()
);
if (scanner.hasExtendedUnicodeEscape()) {
node.hasExtendedUnicodeEscape = true;
@@ -21459,7 +20574,7 @@ var Parser;
}
function parseTypeArgumentsOfTypeReference() {
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function parseTypeReference() {
@@ -21641,7 +20756,7 @@ var Parser;
}
function parseTypeParameters() {
if (token() === 29 /* LessThanToken */) {
- return parseBracketedList(ParsingContext.TypeParameters, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
+ return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */);
}
}
function isStartOfParameter(isJSDocParameter) {
@@ -21747,7 +20862,7 @@ var Parser;
const savedAwaitContext = inAwaitContext();
setYieldContext(!!(flags & 1 /* Yield */));
setAwaitContext(!!(flags & 2 /* Await */));
- const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
+ const parameters = flags & 32 /* JSDoc */ ? parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) : parseDelimitedList(16 /* Parameters */, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext));
setYieldContext(savedYieldContext);
setAwaitContext(savedAwaitContext);
return parameters;
@@ -21815,7 +20930,7 @@ var Parser;
return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers) {
- const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(
+ const parameters = parseBracketedList(16 /* Parameters */, () => parseParameter(
/*inOuterAwaitContext*/
false
), 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
@@ -21914,7 +21029,7 @@ var Parser;
function parseObjectTypeMembers() {
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -21968,7 +21083,7 @@ var Parser;
}
const type = parseTypeAnnotation();
parseSemicolon();
- const members = parseList(ParsingContext.TypeMembers, parseTypeMember);
+ const members = parseList(4 /* TypeMembers */, parseTypeMember);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos);
}
@@ -22013,7 +21128,7 @@ var Parser;
const pos = getNodePos();
return finishNode(
factory2.createTupleTypeNode(
- parseBracketedList(ParsingContext.TupleElementTypes, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
+ parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */)
),
pos
);
@@ -22030,7 +21145,7 @@ var Parser;
if (token() === 126 /* AbstractKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(126 /* AbstractKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -22040,6 +21155,7 @@ var Parser;
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiersForConstructorType();
const isConstructorType = parseOptional(103 /* NewKeyword */);
+ Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
const typeParameters = parseTypeParameters();
const parameters = parseParameters(4 /* Type */);
const type = parseReturnType(
@@ -22048,8 +21164,6 @@ var Parser;
false
);
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
- if (!isConstructorType)
- node.modifiers = modifiers;
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseKeywordAndNoDot() {
@@ -22641,10 +21755,10 @@ var Parser;
}
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
const triState = isParenthesizedArrowFunctionExpression();
- if (triState === Tristate.False) {
+ if (triState === 0 /* False */) {
return void 0;
}
- return triState === Tristate.True ? parseParenthesizedArrowFunctionExpression(
+ return triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpression(
/*allowAmbiguity*/
true,
/*allowReturnTypeInArrowFunction*/
@@ -22656,18 +21770,18 @@ var Parser;
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
- return Tristate.False;
+ return 0 /* False */;
}
if (token() !== 20 /* OpenParenToken */ && token() !== 29 /* LessThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
}
const first2 = token();
@@ -22679,45 +21793,45 @@ var Parser;
case 38 /* EqualsGreaterThanToken */:
case 58 /* ColonToken */:
case 18 /* OpenBraceToken */:
- return Tristate.True;
+ return 1 /* True */;
default:
- return Tristate.False;
+ return 0 /* False */;
}
}
if (second === 22 /* OpenBracketToken */ || second === 18 /* OpenBraceToken */) {
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
if (second === 25 /* DotDotDotToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
if (isModifierKind(second) && second !== 132 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
if (nextToken() === 128 /* AsKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.True;
+ return 1 /* True */;
}
if (!isIdentifier2() && second !== 108 /* ThisKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
switch (nextToken()) {
case 58 /* ColonToken */:
- return Tristate.True;
+ return 1 /* True */;
case 57 /* QuestionToken */:
nextToken();
if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 63 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
case 27 /* CommaToken */:
case 63 /* EqualsToken */:
case 21 /* CloseParenToken */:
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
- return Tristate.False;
+ return 0 /* False */;
} else {
Debug.assert(first2 === 29 /* LessThanToken */);
if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) {
- return Tristate.False;
+ return 0 /* False */;
}
if (languageVariant === 1 /* JSX */) {
const isArrowFunctionInJsx = lookAhead(() => {
@@ -22728,6 +21842,7 @@ var Parser;
switch (fourth) {
case 63 /* EqualsToken */:
case 31 /* GreaterThanToken */:
+ case 43 /* SlashToken */:
return false;
default:
return true;
@@ -22738,11 +21853,11 @@ var Parser;
return false;
});
if (isArrowFunctionInJsx) {
- return Tristate.True;
+ return 1 /* True */;
}
- return Tristate.False;
+ return 0 /* False */;
}
- return Tristate.Unknown;
+ return 2 /* Unknown */;
}
}
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
@@ -22762,7 +21877,7 @@ var Parser;
}
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) {
if (token() === 132 /* AsyncKeyword */) {
- if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === Tristate.True) {
+ if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
const pos = getNodePos();
const asyncModifier = parseModifiersForArrowFunction();
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
@@ -22775,14 +21890,14 @@ var Parser;
if (token() === 132 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak() || token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.False;
+ return 0 /* False */;
}
const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
if (!scanner.hasPrecedingLineBreak() && expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
- return Tristate.True;
+ return 1 /* True */;
}
}
- return Tristate.False;
+ return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, allowReturnTypeInArrowFunction) {
const pos = getNodePos();
@@ -22987,6 +22102,12 @@ var Parser;
case 114 /* VoidKeyword */:
return parseVoidExpression();
case 29 /* LessThanToken */:
+ if (languageVariant === 1 /* JSX */) {
+ return parseJsxElementOrSelfClosingElementOrFragment(
+ /*inExpressionContext*/
+ true
+ );
+ }
return parseTypeAssertion();
case 133 /* AwaitKeyword */:
if (isAwaitExpression2()) {
@@ -23081,7 +22202,7 @@ var Parser;
return expression;
}
parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
- return finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -23102,7 +22223,7 @@ var Parser;
factory2.createJsxElement(
lastChild.openingElement,
lastChild.children,
- finishNode(factory2.createJsxClosingElement(finishNode(factory2.createIdentifier(""), end, end)), end, end)
+ finishNode(factory2.createJsxClosingElement(finishNode(factoryCreateIdentifier(""), end, end)), end, end)
),
lastChild.openingElement.pos,
end
@@ -23190,7 +22311,7 @@ var Parser;
const list = [];
const listPos = getNodePos();
const saveParsingContext = parsingContext;
- parsingContext |= 1 << ParsingContext.JsxChildren;
+ parsingContext |= 1 << 14 /* JsxChildren */;
while (true) {
const child = parseJsxChild(openingTag, currentToken = scanner.reScanJsxToken());
if (!child)
@@ -23205,7 +22326,7 @@ var Parser;
}
function parseJsxAttributes() {
const pos = getNodePos();
- return finishNode(factory2.createJsxAttributes(parseList(ParsingContext.JsxAttributes, parseJsxAttribute)), pos);
+ return finishNode(factory2.createJsxAttributes(parseList(13 /* JsxAttributes */, parseJsxAttribute)), pos);
}
function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) {
const pos = getNodePos();
@@ -23245,7 +22366,7 @@ var Parser;
scanJsxIdentifier();
let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- expression = finishNode(factory2.createPropertyAccessExpression(expression, parseRightSideOfDot(
+ expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
/*allowIdentifierNames*/
true,
/*allowPrivateIdentifiers*/
@@ -23339,13 +22460,9 @@ var Parser;
function parseJsxClosingFragment(inExpressionContext) {
const pos = getNodePos();
parseExpected(30 /* LessThanSlashToken */);
- if (tokenIsIdentifierOrKeyword(token())) {
- parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
- }
if (parseExpected(
31 /* GreaterThanToken */,
- /*diagnostic*/
- void 0,
+ Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
/*shouldAdvance*/
false
)) {
@@ -23358,6 +22475,7 @@ var Parser;
return finishNode(factory2.createJsxJsxClosingFragment(), pos);
}
function parseTypeAssertion() {
+ Debug.assert(languageVariant !== 1 /* JSX */, "Type assertions should never be parsed in JSX; they should be parsed as comparisons or JSX elements/fragments.");
const pos = getNodePos();
parseExpected(29 /* LessThanToken */);
const type = parseType();
@@ -23399,7 +22517,7 @@ var Parser;
true
);
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
- const propertyAccess = isOptionalChain2 ? factory2.createPropertyAccessChain(expression, questionDotToken, name) : factory2.createPropertyAccessExpression(expression, name);
+ const propertyAccess = isOptionalChain2 ? factoryCreatePropertyAccessChain(expression, questionDotToken, name) : factoryCreatePropertyAccessExpression(expression, name);
if (isOptionalChain2 && isPrivateIdentifier(propertyAccess.name)) {
parseErrorAtRange(propertyAccess.name, Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
}
@@ -23427,7 +22545,7 @@ var Parser;
argumentExpression = argument;
}
parseExpected(23 /* CloseBracketToken */);
- const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createElementAccessChain(expression, questionDotToken, argumentExpression) : factory2.createElementAccessExpression(expression, argumentExpression);
+ const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression);
return finishNode(indexedAccess, pos);
}
function parseMemberExpressionRest(pos, expression, allowOptionalChain) {
@@ -23514,7 +22632,7 @@ var Parser;
expression = expression.expression;
}
const argumentList = parseArgumentList();
- const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factory2.createCallChain(expression, questionDotToken, typeArguments, argumentList) : factory2.createCallExpression(expression, typeArguments, argumentList);
+ const callExpr = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateCallChain(expression, questionDotToken, typeArguments, argumentList) : factoryCreateCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
}
@@ -23525,7 +22643,7 @@ var Parser;
false,
Diagnostics.Identifier_expected
);
- expression = finishNode(factory2.createPropertyAccessChain(expression, questionDotToken, name), pos);
+ expression = finishNode(factoryCreatePropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
}
@@ -23533,7 +22651,7 @@ var Parser;
}
function parseArgumentList() {
parseExpected(20 /* OpenParenToken */);
- const result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression);
+ const result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression);
parseExpected(21 /* CloseParenToken */);
return result;
}
@@ -23545,7 +22663,7 @@ var Parser;
return void 0;
}
nextToken();
- const typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType);
+ const typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
return void 0;
}
@@ -23620,7 +22738,7 @@ var Parser;
parseExpected(20 /* OpenParenToken */);
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- return withJSDoc(finishNode(factory2.createParenthesizedExpression(expression), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc);
}
function parseSpreadElement() {
const pos = getNodePos();
@@ -23645,9 +22763,9 @@ var Parser;
const openBracketPosition = scanner.getTokenPos();
const openBracketParsed = parseExpected(22 /* OpenBracketToken */);
const multiLine = scanner.hasPrecedingLineBreak();
- const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement);
+ const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
- return finishNode(factory2.createArrayLiteralExpression(elements, multiLine), pos);
+ return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos);
}
function parseObjectLiteralElement() {
const pos = getNodePos();
@@ -23706,13 +22824,13 @@ var Parser;
const openBraceParsed = parseExpected(18 /* OpenBraceToken */);
const multiLine = scanner.hasPrecedingLineBreak();
const properties = parseDelimitedList(
- ParsingContext.ObjectLiteralMembers,
+ 12 /* ObjectLiteralMembers */,
parseObjectLiteralElement,
/*considerSemicolonAsDelimiter*/
true
);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- return finishNode(factory2.createObjectLiteralExpression(properties, multiLine), pos);
+ return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos);
}
function parseFunctionExpression() {
const savedDecoratorContext = inDecoratorContext();
@@ -23769,7 +22887,7 @@ var Parser;
parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression));
}
const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0;
- return finishNode(factory2.createNewExpression(expression, typeArguments, argumentList), pos);
+ return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
const pos = getNodePos();
@@ -23778,17 +22896,17 @@ var Parser;
const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
if (openBraceParsed || ignoreMissingOpenBrace) {
const multiLine = scanner.hasPrecedingLineBreak();
- const statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ const statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
- const result = withJSDoc(finishNode(factory2.createBlock(statements, multiLine), pos), hasJSDoc);
+ const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc);
if (token() === 63 /* EqualsToken */) {
- parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
+ parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses);
nextToken();
}
return result;
} else {
const statements = createMissingList();
- return withJSDoc(finishNode(factory2.createBlock(
+ return withJSDoc(finishNode(factoryCreateBlock(
statements,
/*multiLine*/
void 0
@@ -23837,7 +22955,7 @@ var Parser;
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const thenStatement = parseStatement();
const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0;
- return withJSDoc(finishNode(factory2.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
}
function parseDoStatement() {
const pos = getNodePos();
@@ -23861,7 +22979,7 @@ var Parser;
const expression = allowInAnd(parseExpression);
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
const statement = parseStatement();
- return withJSDoc(finishNode(factory2.createWhileStatement(expression, statement), pos), hasJSDoc);
+ return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc);
}
function parseForOrForInOrForOfStatement() {
const pos = getNodePos();
@@ -23887,7 +23005,7 @@ var Parser;
true
));
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForOfStatement(awaitToken, initializer, expression, parseStatement());
+ node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement());
} else if (parseOptional(101 /* InKeyword */)) {
const expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -23898,7 +23016,7 @@ var Parser;
parseExpected(26 /* SemicolonToken */);
const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0;
parseExpected(21 /* CloseParenToken */);
- node = factory2.createForStatement(initializer, condition, incrementor, parseStatement());
+ node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement());
}
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@@ -23936,14 +23054,14 @@ var Parser;
parseExpected(82 /* CaseKeyword */);
const expression = allowInAnd(parseExpression);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return withJSDoc(finishNode(factory2.createCaseClause(expression, statements), pos), hasJSDoc);
}
function parseDefaultClause() {
const pos = getNodePos();
parseExpected(88 /* DefaultKeyword */);
parseExpected(58 /* ColonToken */);
- const statements = parseList(ParsingContext.SwitchClauseStatements, parseStatement);
+ const statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(factory2.createDefaultClause(statements), pos);
}
function parseCaseOrDefaultClause() {
@@ -23952,7 +23070,7 @@ var Parser;
function parseCaseBlock() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const clauses = parseList(ParsingContext.SwitchClauses, parseCaseOrDefaultClause);
+ const clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createCaseBlock(clauses), pos);
}
@@ -23973,7 +23091,7 @@ var Parser;
let expression = scanner.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression);
if (expression === void 0) {
identifierCount++;
- expression = finishNode(factory2.createIdentifier(""), getNodePos());
+ expression = finishNode(factoryCreateIdentifier(""), getNodePos());
}
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
@@ -24034,7 +23152,7 @@ var Parser;
if (!tryParseSemicolon()) {
parseErrorForMissingSemicolonAfter(expression);
}
- node = factory2.createExpressionStatement(expression);
+ node = factoryCreateExpressionStatement(expression);
if (hasParen) {
hasJSDoc = false;
}
@@ -24393,14 +23511,14 @@ var Parser;
function parseObjectBindingPattern() {
const pos = getNodePos();
parseExpected(18 /* OpenBraceToken */);
- const elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement);
+ const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(factory2.createObjectBindingPattern(elements), pos);
}
function parseArrayBindingPattern() {
const pos = getNodePos();
parseExpected(22 /* OpenBracketToken */);
- const elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement);
+ const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
return finishNode(factory2.createArrayBindingPattern(elements), pos);
}
@@ -24432,7 +23550,7 @@ var Parser;
}
const type = parseTypeAnnotation();
const initializer = isInOrOfKeyword(token()) ? void 0 : parseInitializer();
- const node = factory2.createVariableDeclaration(name, exclamationToken, type, initializer);
+ const node = factoryCreateVariableDeclaration(name, exclamationToken, type, initializer);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseVariableDeclarationList(inForStatementInitializer) {
@@ -24458,12 +23576,12 @@ var Parser;
const savedDisallowIn = inDisallowInContext();
setDisallowInContext(inForStatementInitializer);
declarations = parseDelimitedList(
- ParsingContext.VariableDeclarations,
+ 8 /* VariableDeclarations */,
inForStatementInitializer ? parseVariableDeclaration : parseVariableDeclarationAllowExclamation
);
setDisallowInContext(savedDisallowIn);
}
- return finishNode(factory2.createVariableDeclarationList(declarations, flags), pos);
+ return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos);
}
function canFollowContextualOfKeyword() {
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
@@ -24474,7 +23592,7 @@ var Parser;
false
);
parseSemicolon();
- const node = factory2.createVariableStatement(modifiers, declarationList);
+ const node = factoryCreateVariableStatement(modifiers, declarationList);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseFunctionDeclaration(pos, hasJSDoc, modifiers) {
@@ -24703,22 +23821,30 @@ var Parser;
return void 0;
}
}
- return finishNode(factory2.createToken(kind), pos);
+ return finishNode(factoryCreateToken(kind), pos);
}
function parseModifiers(allowDecorators, permitConstAsModifier, stopOnStartOfClassStaticBlock) {
const pos = getNodePos();
let list;
- let modifier, hasSeenStaticModifier = false;
+ let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false;
+ if (allowDecorators && token() === 59 /* AtToken */) {
+ while (decorator = tryParseDecorator()) {
+ list = append(list, decorator);
+ }
+ }
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
list = append(list, modifier);
+ hasLeadingModifier = true;
}
- if (allowDecorators && token() === 59 /* AtToken */) {
- let decorator;
+ if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) {
while (decorator = tryParseDecorator()) {
list = append(list, decorator);
+ hasTrailingDecorator = true;
}
+ }
+ if (hasTrailingDecorator) {
while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) {
if (modifier.kind === 124 /* StaticKeyword */)
hasSeenStaticModifier = true;
@@ -24732,7 +23858,7 @@ var Parser;
if (token() === 132 /* AsyncKeyword */) {
const pos = getNodePos();
nextToken();
- const modifier = finishNode(factory2.createToken(132 /* AsyncKeyword */), pos);
+ const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos);
modifiers = createNodeArray([modifier], pos);
}
return modifiers;
@@ -24861,7 +23987,7 @@ var Parser;
}
function parseHeritageClauses() {
if (isHeritageClause2()) {
- return parseList(ParsingContext.HeritageClauses, parseHeritageClause);
+ return parseList(22 /* HeritageClauses */, parseHeritageClause);
}
return void 0;
}
@@ -24870,7 +23996,7 @@ var Parser;
const tok = token();
Debug.assert(tok === 94 /* ExtendsKeyword */ || tok === 117 /* ImplementsKeyword */);
nextToken();
- const types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
+ const types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(factory2.createHeritageClause(tok, types), pos);
}
function parseExpressionWithTypeArguments() {
@@ -24883,13 +24009,13 @@ var Parser;
return finishNode(factory2.createExpressionWithTypeArguments(expression, typeArguments), pos);
}
function tryParseTypeArguments() {
- return token() === 29 /* LessThanToken */ ? parseBracketedList(ParsingContext.TypeArguments, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
+ return token() === 29 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0;
}
function isHeritageClause2() {
return token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */;
}
function parseClassMembers() {
- return parseList(ParsingContext.ClassMembers, parseClassElement);
+ return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(pos, hasJSDoc, modifiers) {
parseExpected(118 /* InterfaceKeyword */);
@@ -24922,7 +24048,7 @@ var Parser;
const name = parseIdentifier();
let members;
if (parseExpected(18 /* OpenBraceToken */)) {
- members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(ParsingContext.EnumMembers, parseEnumMember));
+ members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(6 /* EnumMembers */, parseEnumMember));
parseExpected(19 /* CloseBraceToken */);
} else {
members = createMissingList();
@@ -24934,7 +24060,7 @@ var Parser;
const pos = getNodePos();
let statements;
if (parseExpected(18 /* OpenBraceToken */)) {
- statements = parseList(ParsingContext.BlockStatements, parseStatement);
+ statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
} else {
statements = createMissingList();
@@ -25059,7 +24185,7 @@ var Parser;
if (parseExpected(18 /* OpenBraceToken */)) {
const multiLine = scanner.hasPrecedingLineBreak();
const elements = parseDelimitedList(
- ParsingContext.AssertEntries,
+ 24 /* AssertEntries */,
parseAssertEntry,
/*considerSemicolonAsDelimiter*/
true
@@ -25143,7 +24269,7 @@ var Parser;
}
function parseNamedImportsOrExports(kind) {
const pos = getNodePos();
- const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(ParsingContext.ImportOrExportSpecifiers, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
+ const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */));
return finishNode(node, pos);
}
function parseExportSpecifier() {
@@ -25319,7 +24445,7 @@ var Parser;
/*isDeclarationFile*/
false,
[],
- factory2.createToken(1 /* EndOfFileToken */),
+ factoryCreateToken(1 /* EndOfFileToken */),
0 /* None */,
noop
);
@@ -25980,7 +25106,7 @@ var Parser;
let node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
const name = parseJSDocIdentifierName();
- node = finishNode(factory2.createPropertyAccessExpression(node, name), pos);
+ node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos);
}
return node;
}
@@ -26271,7 +25397,7 @@ var Parser;
const end2 = scanner.getTextPos();
const originalKeywordKind = token();
const text = internIdentifier(scanner.getTokenValue());
- const result = finishNode(factory2.createIdentifier(text, originalKeywordKind), pos, end2);
+ const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2);
nextTokenJSDoc();
return result;
}
@@ -26593,7 +25719,7 @@ var IncrementalParser;
let currentArrayIndex = 0;
Debug.assert(currentArrayIndex < currentArray.length);
let current = currentArray[currentArrayIndex];
- let lastQueriedPosition = InvalidPosition.Value;
+ let lastQueriedPosition = -1 /* Value */;
return {
currentNode(position) {
if (position !== lastQueriedPosition) {
@@ -26612,7 +25738,7 @@ var IncrementalParser;
};
function findHighestListElementThatStartsAtPosition(position) {
currentArray = void 0;
- currentArrayIndex = InvalidPosition.Value;
+ currentArrayIndex = -1 /* Value */;
current = void 0;
forEachChild(sourceFile, visitNode3, visitArray2);
return;
@@ -27926,7 +27052,7 @@ var commandOptionsWithoutBuild = [
{
name: "allowArbitraryExtensions",
type: "boolean",
- affectsModuleResolution: true,
+ affectsProgramStructure: true,
category: Diagnostics.Modules,
description: Diagnostics.Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present,
defaultValueDescription: false
@@ -28839,6 +27965,22 @@ function formatExtensions(extensions) {
result.push("JSON");
return result.join(", ");
}
+function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
+ if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
+ const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
+ if (originalPath)
+ resolved = { ...resolved, path: resolvedFileName, originalPath };
+ }
+ return createResolvedModuleWithFailedLookupLocations(
+ resolved,
+ isExternalLibraryImport,
+ failedLookupLocations,
+ affectingLocations,
+ diagnostics,
+ state.resultFromCache,
+ legacyResult
+ );
+}
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
if (resultFromCache) {
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
@@ -28971,36 +28113,48 @@ function arePathsEqual(path1, path2, host) {
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
}
+function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
+ const resolvedFileName = realPath(fileName, host, traceEnabled);
+ const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
+ return {
+ // If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
+ resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
+ originalPath: pathsAreEqual ? void 0 : fileName
+ };
+}
function getNodeResolutionFeatures(options) {
- let features = NodeResolutionFeatures.None;
+ let features = 0 /* None */;
switch (getEmitModuleResolutionKind(options)) {
case 3 /* Node16 */:
- features = NodeResolutionFeatures.Node16Default;
+ features = 30 /* Node16Default */;
break;
case 99 /* NodeNext */:
- features = NodeResolutionFeatures.NodeNextDefault;
+ features = 30 /* NodeNextDefault */;
break;
case 100 /* Bundler */:
- features = NodeResolutionFeatures.BundlerDefault;
+ features = 30 /* BundlerDefault */;
break;
}
if (options.resolvePackageJsonExports) {
- features |= NodeResolutionFeatures.Exports;
+ features |= 8 /* Exports */;
} else if (options.resolvePackageJsonExports === false) {
- features &= ~NodeResolutionFeatures.Exports;
+ features &= ~8 /* Exports */;
}
if (options.resolvePackageJsonImports) {
- features |= NodeResolutionFeatures.Imports;
+ features |= 2 /* Imports */;
} else if (options.resolvePackageJsonImports === false) {
- features &= ~NodeResolutionFeatures.Imports;
+ features &= ~2 /* Imports */;
}
return features;
}
function getConditions(options, esmMode) {
- const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["node", "import"] : ["node", "require"];
+ const conditions = esmMode || getEmitModuleResolutionKind(options) === 100 /* Bundler */ ? ["import"] : ["require"];
if (!options.noDtsResolution) {
conditions.push("types");
}
+ if (getEmitModuleResolutionKind(options) !== 100 /* Bundler */) {
+ conditions.push("node");
+ }
return concatenate(conditions, options.customConditions);
}
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
@@ -29204,19 +28358,6 @@ function resolveJSModule(moduleName, initialDir, host) {
}
return resolvedModule.resolvedFileName;
}
-var NodeResolutionFeatures = /* @__PURE__ */ ((NodeResolutionFeatures2) => {
- NodeResolutionFeatures2[NodeResolutionFeatures2["None"] = 0] = "None";
- NodeResolutionFeatures2[NodeResolutionFeatures2["Imports"] = 2] = "Imports";
- NodeResolutionFeatures2[NodeResolutionFeatures2["SelfName"] = 4] = "SelfName";
- NodeResolutionFeatures2[NodeResolutionFeatures2["Exports"] = 8] = "Exports";
- NodeResolutionFeatures2[NodeResolutionFeatures2["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
- NodeResolutionFeatures2[NodeResolutionFeatures2["AllFeatures"] = 30] = "AllFeatures";
- NodeResolutionFeatures2[NodeResolutionFeatures2["Node16Default"] = 30] = "Node16Default";
- NodeResolutionFeatures2[NodeResolutionFeatures2["NodeNextDefault"] = 30 /* AllFeatures */] = "NodeNextDefault";
- NodeResolutionFeatures2[NodeResolutionFeatures2["BundlerDefault"] = 30] = "BundlerDefault";
- NodeResolutionFeatures2[NodeResolutionFeatures2["EsmMode"] = 32] = "EsmMode";
- return NodeResolutionFeatures2;
-})(NodeResolutionFeatures || {});
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
return nodeNextModuleNameResolverWorker(
30 /* Node16Default */,
@@ -29330,7 +28471,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
isConfigLookup,
candidateIsFromPackageJsonField: false
};
- if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
+ if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(compilerOptions))) {
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
}
let result;
@@ -29356,13 +28497,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
legacyResult = diagnosticResult.value.resolved.path;
}
}
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache,
+ state,
legacyResult
);
function tryResolve(extensions2, state2) {
@@ -29392,16 +28534,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
}
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
}
- if (!resolved2)
- return void 0;
- let resolvedValue = resolved2.value;
- if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
- const path2 = realPath(resolvedValue.path, host, traceEnabled);
- const pathsAreEqual = arePathsEqual(path2, resolvedValue.path, host);
- const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
- resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path2, originalPath };
- }
- return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
+ return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
} else {
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
const resolved2 = nodeLoadModuleByRelativeName(
@@ -29584,7 +28717,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
if (!onlyRecordFailures) {
if (state.host.fileExists(fileName)) {
if (state.traceEnabled) {
- trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
+ trace(state.host, Diagnostics.File_0_exists_use_it_as_a_name_resolution_result, fileName);
}
return fileName;
} else {
@@ -30062,18 +29195,24 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
)));
} else if (typeof target === "object" && target !== null) {
if (!Array.isArray(target)) {
+ traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
for (const condition of getOwnKeys(target)) {
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
const subTarget = target[condition];
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
if (result) {
+ traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return result;
+ } else {
+ traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
}
} else {
traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
}
}
+ traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
return void 0;
} else {
if (!length(target)) {
@@ -30427,13 +29566,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
candidateIsFromPackageJsonField: false
};
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
- return createResolvedModuleWithFailedLookupLocations(
+ return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
+ moduleName,
resolved && resolved.value,
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
failedLookupLocations,
affectingLocations,
diagnostics,
- state.resultFromCache
+ state
);
function tryResolve(extensions) {
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -30612,35 +29752,36 @@ function initFlowNode(node) {
}
var binder = createBinder();
function createBinder() {
- let file;
- let options;
- let languageVersion;
- let parent;
- let container;
- let thisParentContainer;
- let blockScopeContainer;
- let lastContainer;
- let delayedTypeAliases;
- let seenThisKeyword;
- let currentFlow;
- let currentBreakTarget;
- let currentContinueTarget;
- let currentReturnTarget;
- let currentTrueTarget;
- let currentFalseTarget;
- let currentExceptionTarget;
- let preSwitchCaseFlow;
- let activeLabelList;
- let hasExplicitReturn;
- let emitFlags;
- let inStrictMode;
- let inAssignmentPattern = false;
- let symbolCount = 0;
- let Symbol12;
- let classifiableNames;
- const unreachableFlow = { flags: 1 /* Unreachable */ };
- const reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
- const bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ var file;
+ var options;
+ var languageVersion;
+ var parent;
+ var container;
+ var thisParentContainer;
+ var blockScopeContainer;
+ var lastContainer;
+ var delayedTypeAliases;
+ var seenThisKeyword;
+ var currentFlow;
+ var currentBreakTarget;
+ var currentContinueTarget;
+ var currentReturnTarget;
+ var currentTrueTarget;
+ var currentFalseTarget;
+ var currentExceptionTarget;
+ var preSwitchCaseFlow;
+ var activeLabelList;
+ var hasExplicitReturn;
+ var emitFlags;
+ var inStrictMode;
+ var inAssignmentPattern = false;
+ var symbolCount = 0;
+ var Symbol12;
+ var classifiableNames;
+ var unreachableFlow = { flags: 1 /* Unreachable */ };
+ var reportedUnreachableFlow = { flags: 1 /* Unreachable */ };
+ var bindBinaryExpressionFlow = createBindBinaryExpressionFlow();
+ return bindSourceFile2;
function createDiagnosticForNode2(node, message, arg0, arg1, arg2) {
return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2);
}
@@ -30691,7 +29832,6 @@ function createBinder() {
inAssignmentPattern = false;
emitFlags = 0 /* None */;
}
- return bindSourceFile2;
function bindInStrictMode(file2, opts) {
if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) {
return true;
@@ -33461,6 +32601,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
+ SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
return SignatureCheckMode3;
})(SignatureCheckMode || {});
@@ -34677,7 +33818,7 @@ var visitEachChildTable = {
[291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
return context.factory.updateJsxExpression(
node,
- Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
+ nodeVisitor(node.expression, visitor, isExpression)
);
},
// Clauses
@@ -34762,24 +33903,6 @@ function extractSingleNode(nodes) {
return singleOrUndefined(nodes);
}
-// src/compiler/sourcemap.ts
-function isStringOrNull(x) {
- return typeof x === "string" || x === null;
-}
-function isRawSourceMap(x) {
- return x !== null && typeof x === "object" && x.version === 3 && typeof x.file === "string" && typeof x.mappings === "string" && isArray(x.sources) && every(x.sources, isString) && (x.sourceRoot === void 0 || x.sourceRoot === null || typeof x.sourceRoot === "string") && (x.sourcesContent === void 0 || x.sourcesContent === null || isArray(x.sourcesContent) && every(x.sourcesContent, isStringOrNull)) && (x.names === void 0 || x.names === null || isArray(x.names) && every(x.names, isString));
-}
-function tryParseRawSourceMap(text) {
- try {
- const parsed = JSON.parse(text);
- if (isRawSourceMap(parsed)) {
- return parsed;
- }
- } catch (e) {
- }
- return void 0;
-}
-
// src/compiler/transformers/jsx.ts
var entities = new Map(Object.entries({
quot: 34,
@@ -35038,54 +34161,8 @@ var entities = new Map(Object.entries({
}));
// src/compiler/transformers/declarations.ts
-function hasInternalAnnotation(range, currentSourceFile) {
- const comment = currentSourceFile.text.substring(range.pos, range.end);
- return stringContains(comment, "@internal");
-}
-function isInternalDeclaration(node, currentSourceFile) {
- const parseTreeNode = getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 166 /* Parameter */) {
- const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
- const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
- const text = currentSourceFile.text;
- const commentRanges = previousSibling ? concatenate(
- // to handle
- // ... parameters, /** @internal */
- // public param: string
- getTrailingCommentRanges(text, skipTrivia(
- text,
- previousSibling.end + 1,
- /* stopAfterLineBreak */
- false,
- /* stopAtComments */
- true
- )),
- getLeadingCommentRanges(text, node.pos)
- ) : getTrailingCommentRanges(text, skipTrivia(
- text,
- node.pos,
- /* stopAfterLineBreak */
- false,
- /* stopAtComments */
- true
- ));
- return commentRanges && commentRanges.length && hasInternalAnnotation(last(commentRanges), currentSourceFile);
- }
- const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
- return !!forEach(leadingCommentRanges, (range) => {
- return hasInternalAnnotation(range, currentSourceFile);
- });
-}
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
-// src/compiler/transformer.ts
-function noEmitSubstitution(_hint, node) {
- return node;
-}
-function noEmitNotification(hint, node, callback) {
- callback(hint, node);
-}
-
// src/compiler/emitter.ts
var brackets = createBracketsMap();
function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCanonicalFileName, checkSourceFilesBelongToPath) {
@@ -35104,4989 +34181,328 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa
}
return commonSourceDirectory;
}
-var createPrinterWithDefaults = memoize(() => createPrinter({}));
-var createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
-var createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
-var createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
-function createPrinter(printerOptions = {}, handlers = {}) {
- const {
- hasGlobalName,
- onEmitNode = noEmitNotification,
- isEmitNotificationEnabled,
- substituteNode = noEmitSubstitution,
- onBeforeEmitNode,
- onAfterEmitNode,
- onBeforeEmitNodeArray,
- onAfterEmitNodeArray,
- onBeforeEmitToken,
- onAfterEmitToken
- } = handlers;
- const extendedDiagnostics = !!printerOptions.extendedDiagnostics;
- const newLine = getNewLineCharacter(printerOptions);
- const moduleKind = getEmitModuleKind(printerOptions);
- const bundledHelpers = /* @__PURE__ */ new Map();
- let currentSourceFile;
- let nodeIdToGeneratedName;
- let nodeIdToGeneratedPrivateName;
- let autoGeneratedIdToGeneratedName;
- let generatedNames;
- let formattedNameTempFlagsStack;
- let formattedNameTempFlags;
- let privateNameTempFlagsStack;
- let privateNameTempFlags;
- let tempFlagsStack;
- let tempFlags;
- let reservedNamesStack;
- let reservedNames;
- let reservedPrivateNamesStack;
- let reservedPrivateNames;
- let preserveSourceNewlines = printerOptions.preserveSourceNewlines;
- let nextListElementPos;
- let writer;
- let ownWriter;
- let write = writeBase;
- let isOwnFileEmit;
- const bundleFileInfo = printerOptions.writeBundleFileInfo ? { sections: [] } : void 0;
- const relativeToBuildInfo = bundleFileInfo ? Debug.checkDefined(printerOptions.relativeToBuildInfo) : void 0;
- const recordInternalSection = printerOptions.recordInternalSection;
- let sourceFileTextPos = 0;
- let sourceFileTextKind = "text" /* Text */;
- let sourceMapsDisabled = true;
- let sourceMapGenerator;
- let sourceMapSource;
- let sourceMapSourceIndex = -1;
- let mostRecentlyAddedSourceMapSource;
- let mostRecentlyAddedSourceMapSourceIndex = -1;
- let containerPos = -1;
- let containerEnd = -1;
- let declarationListContainerEnd = -1;
- let currentLineMap;
- let detachedCommentsInfo;
- let hasWrittenComment = false;
- let commentsDisabled = !!printerOptions.removeComments;
- let lastSubstitution;
- let currentParenthesizerRule;
- const { enter: enterComment, exit: exitComment } = createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment");
- const parenthesizer = factory.parenthesizer;
- const typeArgumentParenthesizerRuleSelector = {
- select: (index) => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : void 0
+function createBracketsMap() {
+ const brackets2 = [];
+ brackets2[1024 /* Braces */] = ["{", "}"];
+ brackets2[2048 /* Parenthesis */] = ["(", ")"];
+ brackets2[4096 /* AngleBrackets */] = ["<", ">"];
+ brackets2[8192 /* SquareBrackets */] = ["[", "]"];
+ return brackets2;
+}
+
+// src/compiler/watchUtilities.ts
+function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
+ setSysLog(watchLogLevel === 2 /* Verbose */ ? log2 : noop);
+ const plainInvokeFactory = {
+ watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
+ watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1 /* Recursive */) !== 0, options)
};
- const emitBinaryExpression = createEmitBinaryExpression();
- reset();
+ const triggerInvokingFactory = watchLogLevel !== 0 /* None */ ? {
+ watchFile: createTriggerLoggingAddWatch("watchFile"),
+ watchDirectory: createTriggerLoggingAddWatch("watchDirectory")
+ } : void 0;
+ const factory2 = watchLogLevel === 2 /* Verbose */ ? {
+ watchFile: createFileWatcherWithLogging,
+ watchDirectory: createDirectoryWatcherWithLogging
+ } : triggerInvokingFactory || plainInvokeFactory;
+ const excludeWatcherFactory = watchLogLevel === 2 /* Verbose */ ? createExcludeWatcherWithLogging : returnNoopFileWatcher;
return {
- // public API
- printNode,
- printList,
- printFile,
- printBundle,
- // internal API
- writeNode,
- writeList,
- writeFile: writeFile2,
- writeBundle,
- bundleFileInfo
+ watchFile: createExcludeHandlingAddWatch("watchFile"),
+ watchDirectory: createExcludeHandlingAddWatch("watchDirectory")
};
- function printNode(hint, node, sourceFile) {
- switch (hint) {
- case 0 /* SourceFile */:
- Debug.assert(isSourceFile(node), "Expected a SourceFile node.");
- break;
- case 2 /* IdentifierName */:
- Debug.assert(isIdentifier(node), "Expected an Identifier node.");
- break;
- case 1 /* Expression */:
- Debug.assert(isExpression(node), "Expected an Expression node.");
- break;
- }
- switch (node.kind) {
- case 308 /* SourceFile */:
- return printFile(node);
- case 309 /* Bundle */:
- return printBundle(node);
- case 310 /* UnparsedSource */:
- return printUnparsedSource(node);
- }
- writeNode(hint, node, sourceFile, beginPrint());
- return endPrint();
- }
- function printList(format, nodes, sourceFile) {
- writeList(format, nodes, sourceFile, beginPrint());
- return endPrint();
- }
- function printBundle(bundle) {
- writeBundle(
- bundle,
- beginPrint(),
- /*sourceMapEmitter*/
- void 0
- );
- return endPrint();
+ function createExcludeHandlingAddWatch(key) {
+ return (file, cb, flags, options, detailInfo1, detailInfo2) => {
+ var _a2;
+ return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a2 = host.getCurrentDirectory) == null ? void 0 : _a2.call(host)) || "") ? factory2[key].call(
+ /*thisArgs*/
+ void 0,
+ file,
+ cb,
+ flags,
+ options,
+ detailInfo1,
+ detailInfo2
+ ) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
+ };
}
- function printFile(sourceFile) {
- writeFile2(
- sourceFile,
- beginPrint(),
- /*sourceMapEmitter*/
- void 0
- );
- return endPrint();
+ function useCaseSensitiveFileNames() {
+ return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
}
- function printUnparsedSource(unparsed) {
- writeUnparsedSource(unparsed, beginPrint());
- return endPrint();
+ function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
+ log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
+ return {
+ close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
+ };
}
- function writeNode(hint, node, sourceFile, output) {
- const previousWriter = writer;
- setWriter(
- output,
- /*_sourceMapGenerator*/
- void 0
- );
- print(hint, node, sourceFile);
- reset();
- writer = previousWriter;
+ function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
+ log2(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
+ const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
+ return {
+ close: () => {
+ log2(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
+ watcher.close();
+ }
+ };
}
- function writeList(format, nodes, sourceFile, output) {
- const previousWriter = writer;
- setWriter(
- output,
- /*_sourceMapGenerator*/
- void 0
- );
- if (sourceFile) {
- setSourceFile(sourceFile);
- }
- emitList(
- /*parentNode*/
+ function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
+ const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
+ log2(watchInfo);
+ const start = timestamp();
+ const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
+ const elapsed = timestamp() - start;
+ log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
+ return {
+ close: () => {
+ const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
+ log2(watchInfo2);
+ const start2 = timestamp();
+ watcher.close();
+ const elapsed2 = timestamp() - start2;
+ log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
+ }
+ };
+ }
+ function createTriggerLoggingAddWatch(key) {
+ return (file, cb, flags, options, detailInfo1, detailInfo2) => plainInvokeFactory[key].call(
+ /*thisArgs*/
void 0,
- nodes,
- format
+ file,
+ (...args) => {
+ const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
+ log2(triggerredInfo);
+ const start = timestamp();
+ cb.call(
+ /*thisArg*/
+ void 0,
+ ...args
+ );
+ const elapsed = timestamp() - start;
+ log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
+ },
+ flags,
+ options,
+ detailInfo1,
+ detailInfo2
);
- reset();
- writer = previousWriter;
}
- function getTextPosWithWriteLine() {
- return writer.getTextPosWithWriteLine ? writer.getTextPosWithWriteLine() : writer.getTextPos();
+ function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
+ return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
}
- function updateOrPushBundleFileTextLike(pos, end, kind) {
- const last2 = lastOrUndefined(bundleFileInfo.sections);
- if (last2 && last2.kind === kind) {
- last2.end = end;
- } else {
- bundleFileInfo.sections.push({ pos, end, kind });
+}
+function getFallbackOptions(options) {
+ const fallbackPolling = options == null ? void 0 : options.fallbackPolling;
+ return {
+ watchFile: fallbackPolling !== void 0 ? fallbackPolling : 1 /* PriorityPollingInterval */
+ };
+}
+function closeFileWatcherOf(objWithWatcher) {
+ objWithWatcher.watcher.close();
+}
+
+// src/compiler/program.ts
+function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) {
+ let commonPathComponents;
+ const failed = forEach(fileNames, (sourceFile) => {
+ const sourcePathComponents = getNormalizedPathComponents(sourceFile, currentDirectory);
+ sourcePathComponents.pop();
+ if (!commonPathComponents) {
+ commonPathComponents = sourcePathComponents;
+ return;
}
- }
- function recordBundleFileInternalSectionStart(node) {
- if (recordInternalSection && bundleFileInfo && currentSourceFile && (isDeclaration(node) || isVariableStatement(node)) && isInternalDeclaration(node, currentSourceFile) && sourceFileTextKind !== "internal" /* Internal */) {
- const prevSourceFileTextKind = sourceFileTextKind;
- recordBundleFileTextLikeSection(writer.getTextPos());
- sourceFileTextPos = getTextPosWithWriteLine();
- sourceFileTextKind = "internal" /* Internal */;
- return prevSourceFileTextKind;
+ const n = Math.min(commonPathComponents.length, sourcePathComponents.length);
+ for (let i = 0; i < n; i++) {
+ if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) {
+ if (i === 0) {
+ return true;
+ }
+ commonPathComponents.length = i;
+ break;
+ }
}
- return void 0;
- }
- function recordBundleFileInternalSectionEnd(prevSourceFileTextKind) {
- if (prevSourceFileTextKind) {
- recordBundleFileTextLikeSection(writer.getTextPos());
- sourceFileTextPos = getTextPosWithWriteLine();
- sourceFileTextKind = prevSourceFileTextKind;
+ if (sourcePathComponents.length < commonPathComponents.length) {
+ commonPathComponents.length = sourcePathComponents.length;
}
+ });
+ if (failed) {
+ return "";
}
- function recordBundleFileTextLikeSection(end) {
- if (sourceFileTextPos < end) {
- updateOrPushBundleFileTextLike(sourceFileTextPos, end, sourceFileTextKind);
- return true;
- }
- return false;
+ if (!commonPathComponents) {
+ return currentDirectory;
}
- function writeBundle(bundle, output, sourceMapGenerator2) {
- isOwnFileEmit = false;
- const previousWriter = writer;
- setWriter(output, sourceMapGenerator2);
- emitShebangIfNeeded(bundle);
- emitPrologueDirectivesIfNeeded(bundle);
- emitHelpers(bundle);
- emitSyntheticTripleSlashReferencesIfNeeded(bundle);
- for (const prepend of bundle.prepends) {
- writeLine();
- const pos = writer.getTextPos();
- const savedSections = bundleFileInfo && bundleFileInfo.sections;
- if (savedSections)
- bundleFileInfo.sections = [];
- print(
- 4 /* Unspecified */,
- prepend,
- /*sourceFile*/
- void 0
- );
- if (bundleFileInfo) {
- const newSections = bundleFileInfo.sections;
- bundleFileInfo.sections = savedSections;
- if (prepend.oldFileOfCurrentEmit)
- bundleFileInfo.sections.push(...newSections);
- else {
- newSections.forEach((section) => Debug.assert(isBundleFileTextLike(section)));
- bundleFileInfo.sections.push({
- pos,
- end: writer.getTextPos(),
- kind: "prepend" /* Prepend */,
- data: relativeToBuildInfo(prepend.fileName),
- texts: newSections
+ return getPathFromPathComponents(commonPathComponents);
+}
+var plainJSErrors = /* @__PURE__ */ new Set([
+ // binder errors
+ Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
+ Diagnostics.A_module_cannot_have_multiple_default_exports.code,
+ Diagnostics.Another_export_default_is_here.code,
+ Diagnostics.The_first_export_default_is_here.code,
+ Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
+ Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
+ Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
+ Diagnostics.constructor_is_a_reserved_word.code,
+ Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
+ 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.code,
+ Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
+ Diagnostics.Invalid_use_of_0_in_strict_mode.code,
+ Diagnostics.A_label_is_not_allowed_here.code,
+ Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
+ Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
+ // grammar errors
+ Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
+ Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
+ Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
+ Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
+ Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
+ Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
+ Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
+ Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
+ Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
+ Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
+ Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
+ Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
+ Diagnostics.A_get_accessor_cannot_have_parameters.code,
+ Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
+ Diagnostics.A_rest_element_cannot_have_a_property_name.code,
+ Diagnostics.A_rest_element_cannot_have_an_initializer.code,
+ Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
+ Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
+ Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
+ Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
+ Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
+ Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
+ Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
+ Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
+ Diagnostics.An_export_declaration_cannot_have_modifiers.code,
+ Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
+ Diagnostics.An_import_declaration_cannot_have_modifiers.code,
+ Diagnostics.An_object_member_cannot_be_declared_optional.code,
+ Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
+ Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
+ Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
+ Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
+ Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
+ Diagnostics.Classes_can_only_extend_a_single_class.code,
+ Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
+ Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
+ Diagnostics.Duplicate_label_0.code,
+ Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
+ Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
+ Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
+ Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
+ Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
+ Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
+ Diagnostics.Jump_target_cannot_cross_function_boundary.code,
+ Diagnostics.Line_terminator_not_permitted_before_arrow.code,
+ Diagnostics.Modifiers_cannot_appear_here.code,
+ Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
+ Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
+ Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
+ Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
+ Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
+ Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
+ Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
+ Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
+ Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
+ Diagnostics.Trailing_comma_not_allowed.code,
+ Diagnostics.Variable_declaration_list_cannot_be_empty.code,
+ Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
+ Diagnostics._0_expected.code,
+ Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
+ Diagnostics._0_list_cannot_be_empty.code,
+ Diagnostics._0_modifier_already_seen.code,
+ Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
+ Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
+ Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
+ Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
+ Diagnostics._0_modifier_cannot_be_used_here.code,
+ Diagnostics._0_modifier_must_precede_1_modifier.code,
+ Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
+ Diagnostics.const_declarations_must_be_initialized.code,
+ Diagnostics.extends_clause_already_seen.code,
+ Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
+ Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
+ Diagnostics.Class_constructor_may_not_be_a_generator.code,
+ Diagnostics.Class_constructor_may_not_be_an_accessor.code,
+ Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
+]);
+
+// src/compiler/builderState.ts
+var BuilderState;
+((BuilderState2) => {
+ function createManyToManyPathMap() {
+ function create2(forward, reverse, deleted) {
+ const map2 = {
+ getKeys: (v) => reverse.get(v),
+ getValues: (k) => forward.get(k),
+ keys: () => forward.keys(),
+ deleteKey: (k) => {
+ (deleted || (deleted = /* @__PURE__ */ new Set())).add(k);
+ const set = forward.get(k);
+ if (!set) {
+ return false;
+ }
+ set.forEach((v) => deleteFromMultimap(reverse, v, k));
+ forward.delete(k);
+ return true;
+ },
+ set: (k, vSet) => {
+ deleted == null ? void 0 : deleted.delete(k);
+ const existingVSet = forward.get(k);
+ forward.set(k, vSet);
+ existingVSet == null ? void 0 : existingVSet.forEach((v) => {
+ if (!vSet.has(v)) {
+ deleteFromMultimap(reverse, v, k);
+ }
});
+ vSet.forEach((v) => {
+ if (!(existingVSet == null ? void 0 : existingVSet.has(v))) {
+ addToMultimap(reverse, v, k);
+ }
+ });
+ return map2;
}
- }
- }
- sourceFileTextPos = getTextPosWithWriteLine();
- for (const sourceFile of bundle.sourceFiles) {
- print(0 /* SourceFile */, sourceFile, sourceFile);
- }
- if (bundleFileInfo && bundle.sourceFiles.length) {
- const end = writer.getTextPos();
- if (recordBundleFileTextLikeSection(end)) {
- const prologues = getPrologueDirectivesFromBundledSourceFiles(bundle);
- if (prologues) {
- if (!bundleFileInfo.sources)
- bundleFileInfo.sources = {};
- bundleFileInfo.sources.prologues = prologues;
- }
- const helpers = getHelpersFromBundledSourceFiles(bundle);
- if (helpers) {
- if (!bundleFileInfo.sources)
- bundleFileInfo.sources = {};
- bundleFileInfo.sources.helpers = helpers;
- }
- }
+ };
+ return map2;
}
- reset();
- writer = previousWriter;
- }
- function writeUnparsedSource(unparsed, output) {
- const previousWriter = writer;
- setWriter(
- output,
- /*_sourceMapGenerator*/
- void 0
- );
- print(
- 4 /* Unspecified */,
- unparsed,
- /*sourceFile*/
+ return create2(
+ /* @__PURE__ */ new Map(),
+ /* @__PURE__ */ new Map(),
+ /*deleted*/
void 0
);
- reset();
- writer = previousWriter;
- }
- function writeFile2(sourceFile, output, sourceMapGenerator2) {
- isOwnFileEmit = true;
- const previousWriter = writer;
- setWriter(output, sourceMapGenerator2);
- emitShebangIfNeeded(sourceFile);
- emitPrologueDirectivesIfNeeded(sourceFile);
- print(0 /* SourceFile */, sourceFile, sourceFile);
- reset();
- writer = previousWriter;
- }
- function beginPrint() {
- return ownWriter || (ownWriter = createTextWriter(newLine));
- }
- function endPrint() {
- const text = ownWriter.getText();
- ownWriter.clear();
- return text;
}
- function print(hint, node, sourceFile) {
- if (sourceFile) {
- setSourceFile(sourceFile);
+ BuilderState2.createManyToManyPathMap = createManyToManyPathMap;
+ function addToMultimap(map2, k, v) {
+ let set = map2.get(k);
+ if (!set) {
+ set = /* @__PURE__ */ new Set();
+ map2.set(k, set);
}
- pipelineEmit(
- hint,
- node,
- /*parenthesizerRule*/
- void 0
- );
- }
- function setSourceFile(sourceFile) {
- currentSourceFile = sourceFile;
- currentLineMap = void 0;
- detachedCommentsInfo = void 0;
- if (sourceFile) {
- setSourceMapSource(sourceFile);
- }
- }
- function setWriter(_writer, _sourceMapGenerator) {
- if (_writer && printerOptions.omitTrailingSemicolon) {
- _writer = getTrailingSemicolonDeferringWriter(_writer);
- }
- writer = _writer;
- sourceMapGenerator = _sourceMapGenerator;
- sourceMapsDisabled = !writer || !sourceMapGenerator;
- }
- function reset() {
- nodeIdToGeneratedName = [];
- nodeIdToGeneratedPrivateName = [];
- autoGeneratedIdToGeneratedName = [];
- generatedNames = /* @__PURE__ */ new Set();
- formattedNameTempFlagsStack = [];
- formattedNameTempFlags = /* @__PURE__ */ new Map();
- privateNameTempFlagsStack = [];
- privateNameTempFlags = TempFlags.Auto;
- tempFlagsStack = [];
- tempFlags = TempFlags.Auto;
- reservedNamesStack = [];
- reservedNames = void 0;
- reservedPrivateNamesStack = [];
- reservedPrivateNames = void 0;
- currentSourceFile = void 0;
- currentLineMap = void 0;
- detachedCommentsInfo = void 0;
- setWriter(
- /*output*/
- void 0,
- /*_sourceMapGenerator*/
- void 0
- );
- }
- function getCurrentLineMap() {
- return currentLineMap || (currentLineMap = getLineStarts(Debug.checkDefined(currentSourceFile)));
- }
- function emit(node, parenthesizerRule) {
- if (node === void 0)
- return;
- const prevSourceFileTextKind = recordBundleFileInternalSectionStart(node);
- pipelineEmit(4 /* Unspecified */, node, parenthesizerRule);
- recordBundleFileInternalSectionEnd(prevSourceFileTextKind);
- }
- function emitIdentifierName(node) {
- if (node === void 0)
- return;
- pipelineEmit(
- 2 /* IdentifierName */,
- node,
- /*parenthesizerRule*/
- void 0
- );
- }
- function emitExpression(node, parenthesizerRule) {
- if (node === void 0)
- return;
- pipelineEmit(1 /* Expression */, node, parenthesizerRule);
- }
- function emitJsxAttributeValue(node) {
- pipelineEmit(isStringLiteral(node) ? 6 /* JsxAttributeValue */ : 4 /* Unspecified */, node);
+ set.add(v);
}
- function beforeEmitNode(node) {
- if (preserveSourceNewlines && getInternalEmitFlags(node) & 4 /* IgnoreSourceNewlines */) {
- preserveSourceNewlines = false;
+ function deleteFromMultimap(map2, k, v) {
+ const set = map2.get(k);
+ if (set == null ? void 0 : set.delete(v)) {
+ if (!set.size) {
+ map2.delete(k);
+ }
+ return true;
}
+ return false;
}
- function afterEmitNode(savedPreserveSourceNewlines) {
- preserveSourceNewlines = savedPreserveSourceNewlines;
- }
- function pipelineEmit(emitHint, node, parenthesizerRule) {
- currentParenthesizerRule = parenthesizerRule;
- const pipelinePhase = getPipelinePhase(0 /* Notification */, emitHint, node);
- pipelinePhase(emitHint, node);
- currentParenthesizerRule = void 0;
- }
- function shouldEmitComments(node) {
- return !commentsDisabled && !isSourceFile(node);
- }
- function shouldEmitSourceMaps(node) {
- return !sourceMapsDisabled && !isSourceFile(node) && !isInJsonFile(node) && !isUnparsedSource(node) && !isUnparsedPrepend(node);
- }
- function getPipelinePhase(phase, emitHint, node) {
- switch (phase) {
- case 0 /* Notification */:
- if (onEmitNode !== noEmitNotification && (!isEmitNotificationEnabled || isEmitNotificationEnabled(node))) {
- return pipelineEmitWithNotification;
- }
- case 1 /* Substitution */:
- if (substituteNode !== noEmitSubstitution && (lastSubstitution = substituteNode(emitHint, node) || node) !== node) {
- if (currentParenthesizerRule) {
- lastSubstitution = currentParenthesizerRule(lastSubstitution);
- }
- return pipelineEmitWithSubstitution;
- }
- case 2 /* Comments */:
- if (shouldEmitComments(node)) {
- return pipelineEmitWithComments;
- }
- case 3 /* SourceMaps */:
- if (shouldEmitSourceMaps(node)) {
- return pipelineEmitWithSourceMaps;
- }
- case 4 /* Emit */:
- return pipelineEmitWithHint;
- default:
- return Debug.assertNever(phase);
- }
+ function getReferencedFilesFromImportedModuleSymbol(symbol) {
+ return mapDefined(symbol.declarations, (declaration) => {
+ var _a2;
+ return (_a2 = getSourceFileOfNode(declaration)) == null ? void 0 : _a2.resolvedPath;
+ });
}
- function getNextPipelinePhase(currentPhase, emitHint, node) {
- return getPipelinePhase(currentPhase + 1, emitHint, node);
+ function getReferencedFilesFromImportLiteral(checker, importName) {
+ const symbol = checker.getSymbolAtLocation(importName);
+ return symbol && getReferencedFilesFromImportedModuleSymbol(symbol);
}
- function pipelineEmitWithNotification(hint, node) {
- const pipelinePhase = getNextPipelinePhase(0 /* Notification */, hint, node);
- onEmitNode(hint, node, pipelinePhase);
- }
- function pipelineEmitWithHint(hint, node) {
- onBeforeEmitNode == null ? void 0 : onBeforeEmitNode(node);
- if (preserveSourceNewlines) {
- const savedPreserveSourceNewlines = preserveSourceNewlines;
- beforeEmitNode(node);
- pipelineEmitWithHintWorker(hint, node);
- afterEmitNode(savedPreserveSourceNewlines);
- } else {
- pipelineEmitWithHintWorker(hint, node);
- }
- onAfterEmitNode == null ? void 0 : onAfterEmitNode(node);
- currentParenthesizerRule = void 0;
- }
- function pipelineEmitWithHintWorker(hint, node, allowSnippets = true) {
- if (allowSnippets) {
- const snippet = getSnippetElement(node);
- if (snippet) {
- return emitSnippetNode(hint, node, snippet);
- }
- }
- if (hint === 0 /* SourceFile */)
- return emitSourceFile(cast(node, isSourceFile));
- if (hint === 2 /* IdentifierName */)
- return emitIdentifier(cast(node, isIdentifier));
- if (hint === 6 /* JsxAttributeValue */)
- return emitLiteral(
- cast(node, isStringLiteral),
- /*jsxAttributeEscape*/
- true
- );
- if (hint === 3 /* MappedTypeParameter */)
- return emitMappedTypeParameter(cast(node, isTypeParameterDeclaration));
- if (hint === 5 /* EmbeddedStatement */) {
- Debug.assertNode(node, isEmptyStatement);
- return emitEmptyStatement(
- /*isEmbeddedStatement*/
- true
- );
- }
- if (hint === 4 /* Unspecified */) {
- switch (node.kind) {
- case 15 /* TemplateHead */:
- case 16 /* TemplateMiddle */:
- case 17 /* TemplateTail */:
- return emitLiteral(
- node,
- /*jsxAttributeEscape*/
- false
- );
- case 79 /* Identifier */:
- return emitIdentifier(node);
- case 80 /* PrivateIdentifier */:
- return emitPrivateIdentifier(node);
- case 163 /* QualifiedName */:
- return emitQualifiedName(node);
- case 164 /* ComputedPropertyName */:
- return emitComputedPropertyName(node);
- case 165 /* TypeParameter */:
- return emitTypeParameter(node);
- case 166 /* Parameter */:
- return emitParameter(node);
- case 167 /* Decorator */:
- return emitDecorator(node);
- case 168 /* PropertySignature */:
- return emitPropertySignature(node);
- case 169 /* PropertyDeclaration */:
- return emitPropertyDeclaration(node);
- case 170 /* MethodSignature */:
- return emitMethodSignature(node);
- case 171 /* MethodDeclaration */:
- return emitMethodDeclaration(node);
- case 172 /* ClassStaticBlockDeclaration */:
- return emitClassStaticBlockDeclaration(node);
- case 173 /* Constructor */:
- return emitConstructor(node);
- case 174 /* GetAccessor */:
- case 175 /* SetAccessor */:
- return emitAccessorDeclaration(node);
- case 176 /* CallSignature */:
- return emitCallSignature(node);
- case 177 /* ConstructSignature */:
- return emitConstructSignature(node);
- case 178 /* IndexSignature */:
- return emitIndexSignature(node);
- case 179 /* TypePredicate */:
- return emitTypePredicate(node);
- case 180 /* TypeReference */:
- return emitTypeReference(node);
- case 181 /* FunctionType */:
- return emitFunctionType(node);
- case 182 /* ConstructorType */:
- return emitConstructorType(node);
- case 183 /* TypeQuery */:
- return emitTypeQuery(node);
- case 184 /* TypeLiteral */:
- return emitTypeLiteral(node);
- case 185 /* ArrayType */:
- return emitArrayType(node);
- case 186 /* TupleType */:
- return emitTupleType(node);
- case 187 /* OptionalType */:
- return emitOptionalType(node);
- case 189 /* UnionType */:
- return emitUnionType(node);
- case 190 /* IntersectionType */:
- return emitIntersectionType(node);
- case 191 /* ConditionalType */:
- return emitConditionalType(node);
- case 192 /* InferType */:
- return emitInferType(node);
- case 193 /* ParenthesizedType */:
- return emitParenthesizedType(node);
- case 230 /* ExpressionWithTypeArguments */:
- return emitExpressionWithTypeArguments(node);
- case 194 /* ThisType */:
- return emitThisType();
- case 195 /* TypeOperator */:
- return emitTypeOperator(node);
- case 196 /* IndexedAccessType */:
- return emitIndexedAccessType(node);
- case 197 /* MappedType */:
- return emitMappedType(node);
- case 198 /* LiteralType */:
- return emitLiteralType(node);
- case 199 /* NamedTupleMember */:
- return emitNamedTupleMember(node);
- case 200 /* TemplateLiteralType */:
- return emitTemplateType(node);
- case 201 /* TemplateLiteralTypeSpan */:
- return emitTemplateTypeSpan(node);
- case 202 /* ImportType */:
- return emitImportTypeNode(node);
- case 203 /* ObjectBindingPattern */:
- return emitObjectBindingPattern(node);
- case 204 /* ArrayBindingPattern */:
- return emitArrayBindingPattern(node);
- case 205 /* BindingElement */:
- return emitBindingElement(node);
- case 236 /* TemplateSpan */:
- return emitTemplateSpan(node);
- case 237 /* SemicolonClassElement */:
- return emitSemicolonClassElement();
- case 238 /* Block */:
- return emitBlock(node);
- case 240 /* VariableStatement */:
- return emitVariableStatement(node);
- case 239 /* EmptyStatement */:
- return emitEmptyStatement(
- /*isEmbeddedStatement*/
- false
- );
- case 241 /* ExpressionStatement */:
- return emitExpressionStatement(node);
- case 242 /* IfStatement */:
- return emitIfStatement(node);
- case 243 /* DoStatement */:
- return emitDoStatement(node);
- case 244 /* WhileStatement */:
- return emitWhileStatement(node);
- case 245 /* ForStatement */:
- return emitForStatement(node);
- case 246 /* ForInStatement */:
- return emitForInStatement(node);
- case 247 /* ForOfStatement */:
- return emitForOfStatement(node);
- case 248 /* ContinueStatement */:
- return emitContinueStatement(node);
- case 249 /* BreakStatement */:
- return emitBreakStatement(node);
- case 250 /* ReturnStatement */:
- return emitReturnStatement(node);
- case 251 /* WithStatement */:
- return emitWithStatement(node);
- case 252 /* SwitchStatement */:
- return emitSwitchStatement(node);
- case 253 /* LabeledStatement */:
- return emitLabeledStatement(node);
- case 254 /* ThrowStatement */:
- return emitThrowStatement(node);
- case 255 /* TryStatement */:
- return emitTryStatement(node);
- case 256 /* DebuggerStatement */:
- return emitDebuggerStatement(node);
- case 257 /* VariableDeclaration */:
- return emitVariableDeclaration(node);
- case 258 /* VariableDeclarationList */:
- return emitVariableDeclarationList(node);
- case 259 /* FunctionDeclaration */:
- return emitFunctionDeclaration(node);
- case 260 /* ClassDeclaration */:
- return emitClassDeclaration(node);
- case 261 /* InterfaceDeclaration */:
- return emitInterfaceDeclaration(node);
- case 262 /* TypeAliasDeclaration */:
- return emitTypeAliasDeclaration(node);
- case 263 /* EnumDeclaration */:
- return emitEnumDeclaration(node);
- case 264 /* ModuleDeclaration */:
- return emitModuleDeclaration(node);
- case 265 /* ModuleBlock */:
- return emitModuleBlock(node);
- case 266 /* CaseBlock */:
- return emitCaseBlock(node);
- case 267 /* NamespaceExportDeclaration */:
- return emitNamespaceExportDeclaration(node);
- case 268 /* ImportEqualsDeclaration */:
- return emitImportEqualsDeclaration(node);
- case 269 /* ImportDeclaration */:
- return emitImportDeclaration(node);
- case 270 /* ImportClause */:
- return emitImportClause(node);
- case 271 /* NamespaceImport */:
- return emitNamespaceImport(node);
- case 277 /* NamespaceExport */:
- return emitNamespaceExport(node);
- case 272 /* NamedImports */:
- return emitNamedImports(node);
- case 273 /* ImportSpecifier */:
- return emitImportSpecifier(node);
- case 274 /* ExportAssignment */:
- return emitExportAssignment(node);
- case 275 /* ExportDeclaration */:
- return emitExportDeclaration(node);
- case 276 /* NamedExports */:
- return emitNamedExports(node);
- case 278 /* ExportSpecifier */:
- return emitExportSpecifier(node);
- case 296 /* AssertClause */:
- return emitAssertClause(node);
- case 297 /* AssertEntry */:
- return emitAssertEntry(node);
- case 279 /* MissingDeclaration */:
- return;
- case 280 /* ExternalModuleReference */:
- return emitExternalModuleReference(node);
- case 11 /* JsxText */:
- return emitJsxText(node);
- case 283 /* JsxOpeningElement */:
- case 286 /* JsxOpeningFragment */:
- return emitJsxOpeningElementOrFragment(node);
- case 284 /* JsxClosingElement */:
- case 287 /* JsxClosingFragment */:
- return emitJsxClosingElementOrFragment(node);
- case 288 /* JsxAttribute */:
- return emitJsxAttribute(node);
- case 289 /* JsxAttributes */:
- return emitJsxAttributes(node);
- case 290 /* JsxSpreadAttribute */:
- return emitJsxSpreadAttribute(node);
- case 291 /* JsxExpression */:
- return emitJsxExpression(node);
- case 292 /* CaseClause */:
- return emitCaseClause(node);
- case 293 /* DefaultClause */:
- return emitDefaultClause(node);
- case 294 /* HeritageClause */:
- return emitHeritageClause(node);
- case 295 /* CatchClause */:
- return emitCatchClause(node);
- case 299 /* PropertyAssignment */:
- return emitPropertyAssignment(node);
- case 300 /* ShorthandPropertyAssignment */:
- return emitShorthandPropertyAssignment(node);
- case 301 /* SpreadAssignment */:
- return emitSpreadAssignment(node);
- case 302 /* EnumMember */:
- return emitEnumMember(node);
- case 303 /* UnparsedPrologue */:
- return writeUnparsedNode(node);
- case 310 /* UnparsedSource */:
- case 304 /* UnparsedPrepend */:
- return emitUnparsedSourceOrPrepend(node);
- case 305 /* UnparsedText */:
- case 306 /* UnparsedInternalText */:
- return emitUnparsedTextLike(node);
- case 307 /* UnparsedSyntheticReference */:
- return emitUnparsedSyntheticReference(node);
- case 308 /* SourceFile */:
- return emitSourceFile(node);
- case 309 /* Bundle */:
- return Debug.fail("Bundles should be printed using printBundle");
- case 311 /* InputFiles */:
- return Debug.fail("InputFiles should not be printed");
- case 312 /* JSDocTypeExpression */:
- return emitJSDocTypeExpression(node);
- case 313 /* JSDocNameReference */:
- return emitJSDocNameReference(node);
- case 315 /* JSDocAllType */:
- return writePunctuation("*");
- case 316 /* JSDocUnknownType */:
- return writePunctuation("?");
- case 317 /* JSDocNullableType */:
- return emitJSDocNullableType(node);
- case 318 /* JSDocNonNullableType */:
- return emitJSDocNonNullableType(node);
- case 319 /* JSDocOptionalType */:
- return emitJSDocOptionalType(node);
- case 320 /* JSDocFunctionType */:
- return emitJSDocFunctionType(node);
- case 188 /* RestType */:
- case 321 /* JSDocVariadicType */:
- return emitRestOrJSDocVariadicType(node);
- case 322 /* JSDocNamepathType */:
- return;
- case 323 /* JSDoc */:
- return emitJSDoc(node);
- case 325 /* JSDocTypeLiteral */:
- return emitJSDocTypeLiteral(node);
- case 326 /* JSDocSignature */:
- return emitJSDocSignature(node);
- case 330 /* JSDocTag */:
- case 335 /* JSDocClassTag */:
- case 340 /* JSDocOverrideTag */:
- return emitJSDocSimpleTag(node);
- case 331 /* JSDocAugmentsTag */:
- case 332 /* JSDocImplementsTag */:
- return emitJSDocHeritageTag(node);
- case 333 /* JSDocAuthorTag */:
- case 334 /* JSDocDeprecatedTag */:
- return;
- case 336 /* JSDocPublicTag */:
- case 337 /* JSDocPrivateTag */:
- case 338 /* JSDocProtectedTag */:
- case 339 /* JSDocReadonlyTag */:
- return;
- case 341 /* JSDocCallbackTag */:
- return emitJSDocCallbackTag(node);
- case 342 /* JSDocOverloadTag */:
- return emitJSDocOverloadTag(node);
- case 344 /* JSDocParameterTag */:
- case 351 /* JSDocPropertyTag */:
- return emitJSDocPropertyLikeTag(node);
- case 343 /* JSDocEnumTag */:
- case 345 /* JSDocReturnTag */:
- case 346 /* JSDocThisTag */:
- case 347 /* JSDocTypeTag */:
- case 352 /* JSDocThrowsTag */:
- case 353 /* JSDocSatisfiesTag */:
- return emitJSDocSimpleTypedTag(node);
- case 348 /* JSDocTemplateTag */:
- return emitJSDocTemplateTag(node);
- case 349 /* JSDocTypedefTag */:
- return emitJSDocTypedefTag(node);
- case 350 /* JSDocSeeTag */:
- return emitJSDocSeeTag(node);
- case 355 /* NotEmittedStatement */:
- case 359 /* EndOfDeclarationMarker */:
- case 358 /* MergeDeclarationMarker */:
- return;
- }
- if (isExpression(node)) {
- hint = 1 /* Expression */;
- if (substituteNode !== noEmitSubstitution) {
- const substitute = substituteNode(hint, node) || node;
- if (substitute !== node) {
- node = substitute;
- if (currentParenthesizerRule) {
- node = currentParenthesizerRule(node);
- }
- }
- }
- }
- }
- if (hint === 1 /* Expression */) {
- switch (node.kind) {
- case 8 /* NumericLiteral */:
- case 9 /* BigIntLiteral */:
- return emitNumericOrBigIntLiteral(node);
- case 10 /* StringLiteral */:
- case 13 /* RegularExpressionLiteral */:
- case 14 /* NoSubstitutionTemplateLiteral */:
- return emitLiteral(
- node,
- /*jsxAttributeEscape*/
- false
- );
- case 79 /* Identifier */:
- return emitIdentifier(node);
- case 80 /* PrivateIdentifier */:
- return emitPrivateIdentifier(node);
- case 206 /* ArrayLiteralExpression */:
- return emitArrayLiteralExpression(node);
- case 207 /* ObjectLiteralExpression */:
- return emitObjectLiteralExpression(node);
- case 208 /* PropertyAccessExpression */:
- return emitPropertyAccessExpression(node);
- case 209 /* ElementAccessExpression */:
- return emitElementAccessExpression(node);
- case 210 /* CallExpression */:
- return emitCallExpression(node);
- case 211 /* NewExpression */:
- return emitNewExpression(node);
- case 212 /* TaggedTemplateExpression */:
- return emitTaggedTemplateExpression(node);
- case 213 /* TypeAssertionExpression */:
- return emitTypeAssertionExpression(node);
- case 214 /* ParenthesizedExpression */:
- return emitParenthesizedExpression(node);
- case 215 /* FunctionExpression */:
- return emitFunctionExpression(node);
- case 216 /* ArrowFunction */:
- return emitArrowFunction(node);
- case 217 /* DeleteExpression */:
- return emitDeleteExpression(node);
- case 218 /* TypeOfExpression */:
- return emitTypeOfExpression(node);
- case 219 /* VoidExpression */:
- return emitVoidExpression(node);
- case 220 /* AwaitExpression */:
- return emitAwaitExpression(node);
- case 221 /* PrefixUnaryExpression */:
- return emitPrefixUnaryExpression(node);
- case 222 /* PostfixUnaryExpression */:
- return emitPostfixUnaryExpression(node);
- case 223 /* BinaryExpression */:
- return emitBinaryExpression(node);
- case 224 /* ConditionalExpression */:
- return emitConditionalExpression(node);
- case 225 /* TemplateExpression */:
- return emitTemplateExpression(node);
- case 226 /* YieldExpression */:
- return emitYieldExpression(node);
- case 227 /* SpreadElement */:
- return emitSpreadElement(node);
- case 228 /* ClassExpression */:
- return emitClassExpression(node);
- case 229 /* OmittedExpression */:
- return;
- case 231 /* AsExpression */:
- return emitAsExpression(node);
- case 232 /* NonNullExpression */:
- return emitNonNullExpression(node);
- case 230 /* ExpressionWithTypeArguments */:
- return emitExpressionWithTypeArguments(node);
- case 235 /* SatisfiesExpression */:
- return emitSatisfiesExpression(node);
- case 233 /* MetaProperty */:
- return emitMetaProperty(node);
- case 234 /* SyntheticExpression */:
- return Debug.fail("SyntheticExpression should never be printed.");
- case 279 /* MissingDeclaration */:
- return;
- case 281 /* JsxElement */:
- return emitJsxElement(node);
- case 282 /* JsxSelfClosingElement */:
- return emitJsxSelfClosingElement(node);
- case 285 /* JsxFragment */:
- return emitJsxFragment(node);
- case 354 /* SyntaxList */:
- return Debug.fail("SyntaxList should not be printed");
- case 355 /* NotEmittedStatement */:
- return;
- case 356 /* PartiallyEmittedExpression */:
- return emitPartiallyEmittedExpression(node);
- case 357 /* CommaListExpression */:
- return emitCommaList(node);
- case 358 /* MergeDeclarationMarker */:
- case 359 /* EndOfDeclarationMarker */:
- return;
- case 360 /* SyntheticReferenceExpression */:
- return Debug.fail("SyntheticReferenceExpression should not be printed");
- }
- }
- if (isKeyword(node.kind))
- return writeTokenNode(node, writeKeyword);
- if (isTokenKind(node.kind))
- return writeTokenNode(node, writePunctuation);
- Debug.fail(`Unhandled SyntaxKind: ${Debug.formatSyntaxKind(node.kind)}.`);
- }
- function emitMappedTypeParameter(node) {
- emit(node.name);
- writeSpace();
- writeKeyword("in");
- writeSpace();
- emit(node.constraint);
- }
- function pipelineEmitWithSubstitution(hint, node) {
- const pipelinePhase = getNextPipelinePhase(1 /* Substitution */, hint, node);
- Debug.assertIsDefined(lastSubstitution);
- node = lastSubstitution;
- lastSubstitution = void 0;
- pipelinePhase(hint, node);
- }
- function getHelpersFromBundledSourceFiles(bundle) {
- let result;
- if (moduleKind === 0 /* None */ || printerOptions.noEmitHelpers) {
- return void 0;
- }
- const bundledHelpers2 = /* @__PURE__ */ new Map();
- for (const sourceFile of bundle.sourceFiles) {
- const shouldSkip = getExternalHelpersModuleName(sourceFile) !== void 0;
- const helpers = getSortedEmitHelpers(sourceFile);
- if (!helpers)
- continue;
- for (const helper of helpers) {
- if (!helper.scoped && !shouldSkip && !bundledHelpers2.get(helper.name)) {
- bundledHelpers2.set(helper.name, true);
- (result || (result = [])).push(helper.name);
- }
- }
- }
- return result;
- }
- function emitHelpers(node) {
- let helpersEmitted = false;
- const bundle = node.kind === 309 /* Bundle */ ? node : void 0;
- if (bundle && moduleKind === 0 /* None */) {
- return;
- }
- const numPrepends = bundle ? bundle.prepends.length : 0;
- const numNodes = bundle ? bundle.sourceFiles.length + numPrepends : 1;
- for (let i = 0; i < numNodes; i++) {
- const currentNode = bundle ? i < numPrepends ? bundle.prepends[i] : bundle.sourceFiles[i - numPrepends] : node;
- const sourceFile = isSourceFile(currentNode) ? currentNode : isUnparsedSource(currentNode) ? void 0 : currentSourceFile;
- const shouldSkip = printerOptions.noEmitHelpers || !!sourceFile && hasRecordedExternalHelpers(sourceFile);
- const shouldBundle = (isSourceFile(currentNode) || isUnparsedSource(currentNode)) && !isOwnFileEmit;
- const helpers = isUnparsedSource(currentNode) ? currentNode.helpers : getSortedEmitHelpers(currentNode);
- if (helpers) {
- for (const helper of helpers) {
- if (!helper.scoped) {
- if (shouldSkip)
- continue;
- if (shouldBundle) {
- if (bundledHelpers.get(helper.name)) {
- continue;
- }
- bundledHelpers.set(helper.name, true);
- }
- } else if (bundle) {
- continue;
- }
- const pos = getTextPosWithWriteLine();
- if (typeof helper.text === "string") {
- writeLines(helper.text);
- } else {
- writeLines(helper.text(makeFileLevelOptimisticUniqueName));
- }
- if (bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "emitHelpers" /* EmitHelpers */, data: helper.name });
- helpersEmitted = true;
- }
- }
- }
- return helpersEmitted;
- }
- function getSortedEmitHelpers(node) {
- const helpers = getEmitHelpers(node);
- return helpers && stableSort(helpers, compareEmitHelpers);
- }
- function emitNumericOrBigIntLiteral(node) {
- emitLiteral(
- node,
- /*jsxAttributeEscape*/
- false
- );
- }
- function emitLiteral(node, jsxAttributeEscape) {
- const text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape);
- if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 10 /* StringLiteral */ || isTemplateLiteralKind(node.kind))) {
- writeLiteral(text);
- } else {
- writeStringLiteral(text);
- }
- }
- function emitUnparsedSourceOrPrepend(unparsed) {
- for (const text of unparsed.texts) {
- writeLine();
- emit(text);
- }
- }
- function writeUnparsedNode(unparsed) {
- writer.rawWrite(unparsed.parent.text.substring(unparsed.pos, unparsed.end));
- }
- function emitUnparsedTextLike(unparsed) {
- const pos = getTextPosWithWriteLine();
- writeUnparsedNode(unparsed);
- if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(
- pos,
- writer.getTextPos(),
- unparsed.kind === 305 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */
- );
- }
- }
- function emitUnparsedSyntheticReference(unparsed) {
- const pos = getTextPosWithWriteLine();
- writeUnparsedNode(unparsed);
- if (bundleFileInfo) {
- const section = clone(unparsed.section);
- section.pos = pos;
- section.end = writer.getTextPos();
- bundleFileInfo.sections.push(section);
- }
- }
- function emitSnippetNode(hint, node, snippet) {
- switch (snippet.kind) {
- case 1 /* Placeholder */:
- emitPlaceholder(hint, node, snippet);
- break;
- case 0 /* TabStop */:
- emitTabStop(hint, node, snippet);
- break;
- }
- }
- function emitPlaceholder(hint, node, snippet) {
- nonEscapingWrite(`\${${snippet.order}:`);
- pipelineEmitWithHintWorker(
- hint,
- node,
- /*allowSnippets*/
- false
- );
- nonEscapingWrite(`}`);
- }
- function emitTabStop(hint, node, snippet) {
- Debug.assert(
- node.kind === 239 /* EmptyStatement */,
- `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.`
- );
- Debug.assert(
- hint !== 5 /* EmbeddedStatement */,
- `A tab stop cannot be attached to an embedded statement.`
- );
- nonEscapingWrite(`$${snippet.order}`);
- }
- function emitIdentifier(node) {
- const writeText = node.symbol ? writeSymbol : write;
- writeText(getTextOfNode2(
- node,
- /*includeTrivia*/
- false
- ), node.symbol);
- emitList(node, getIdentifierTypeArguments(node), 53776 /* TypeParameters */);
- }
- function emitPrivateIdentifier(node) {
- write(getTextOfNode2(
- node,
- /*includeTrivia*/
- false
- ));
- }
- function emitQualifiedName(node) {
- emitEntityName(node.left);
- writePunctuation(".");
- emit(node.right);
- }
- function emitEntityName(node) {
- if (node.kind === 79 /* Identifier */) {
- emitExpression(node);
- } else {
- emit(node);
- }
- }
- function emitComputedPropertyName(node) {
- const savedPrivateNameTempFlags = privateNameTempFlags;
- const savedReservedMemberNames = reservedPrivateNames;
- popPrivateNameGenerationScope();
- writePunctuation("[");
- emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfComputedPropertyName);
- writePunctuation("]");
- pushPrivateNameGenerationScope(savedPrivateNameTempFlags, savedReservedMemberNames);
- }
- function emitTypeParameter(node) {
- emitModifierList(node, node.modifiers);
- emit(node.name);
- if (node.constraint) {
- writeSpace();
- writeKeyword("extends");
- writeSpace();
- emit(node.constraint);
- }
- if (node.default) {
- writeSpace();
- writeOperator("=");
- writeSpace();
- emit(node.default);
- }
- }
- function emitParameter(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- true
- );
- emit(node.dotDotDotToken);
- emitNodeWithWriter(node.name, writeParameter);
- emit(node.questionToken);
- if (node.parent && node.parent.kind === 320 /* JSDocFunctionType */ && !node.name) {
- emit(node.type);
- } else {
- emitTypeAnnotation(node.type);
- }
- emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name ? node.name.end : node.modifiers ? node.modifiers.end : node.pos, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitDecorator(decorator) {
- writePunctuation("@");
- emitExpression(decorator.expression, parenthesizer.parenthesizeLeftSideOfAccess);
- }
- function emitPropertySignature(node) {
- emitModifierList(node, node.modifiers);
- emitNodeWithWriter(node.name, writeProperty);
- emit(node.questionToken);
- emitTypeAnnotation(node.type);
- writeTrailingSemicolon();
- }
- function emitPropertyDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- true
- );
- emit(node.name);
- emit(node.questionToken);
- emit(node.exclamationToken);
- emitTypeAnnotation(node.type);
- emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node);
- writeTrailingSemicolon();
- }
- function emitMethodSignature(node) {
- pushNameGenerationScope(node);
- emitModifierList(node, node.modifiers);
- emit(node.name);
- emit(node.questionToken);
- emitTypeParameters(node, node.typeParameters);
- emitParameters(node, node.parameters);
- emitTypeAnnotation(node.type);
- writeTrailingSemicolon();
- popNameGenerationScope(node);
- }
- function emitMethodDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- true
- );
- emit(node.asteriskToken);
- emit(node.name);
- emit(node.questionToken);
- emitSignatureAndBody(node, emitSignatureHead);
- }
- function emitClassStaticBlockDeclaration(node) {
- writeKeyword("static");
- emitBlockFunctionBody(node.body);
- }
- function emitConstructor(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- writeKeyword("constructor");
- emitSignatureAndBody(node, emitSignatureHead);
- }
- function emitAccessorDeclaration(node) {
- const pos = emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- true
- );
- const token = node.kind === 174 /* GetAccessor */ ? 137 /* GetKeyword */ : 151 /* SetKeyword */;
- emitTokenWithComment(token, pos, writeKeyword, node);
- writeSpace();
- emit(node.name);
- emitSignatureAndBody(node, emitSignatureHead);
- }
- function emitCallSignature(node) {
- pushNameGenerationScope(node);
- emitTypeParameters(node, node.typeParameters);
- emitParameters(node, node.parameters);
- emitTypeAnnotation(node.type);
- writeTrailingSemicolon();
- popNameGenerationScope(node);
- }
- function emitConstructSignature(node) {
- pushNameGenerationScope(node);
- writeKeyword("new");
- writeSpace();
- emitTypeParameters(node, node.typeParameters);
- emitParameters(node, node.parameters);
- emitTypeAnnotation(node.type);
- writeTrailingSemicolon();
- popNameGenerationScope(node);
- }
- function emitIndexSignature(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- emitParametersForIndexSignature(node, node.parameters);
- emitTypeAnnotation(node.type);
- writeTrailingSemicolon();
- }
- function emitTemplateTypeSpan(node) {
- emit(node.type);
- emit(node.literal);
- }
- function emitSemicolonClassElement() {
- writeTrailingSemicolon();
- }
- function emitTypePredicate(node) {
- if (node.assertsModifier) {
- emit(node.assertsModifier);
- writeSpace();
- }
- emit(node.parameterName);
- if (node.type) {
- writeSpace();
- writeKeyword("is");
- writeSpace();
- emit(node.type);
- }
- }
- function emitTypeReference(node) {
- emit(node.typeName);
- emitTypeArguments(node, node.typeArguments);
- }
- function emitFunctionType(node) {
- pushNameGenerationScope(node);
- emitTypeParameters(node, node.typeParameters);
- emitParametersForArrow(node, node.parameters);
- writeSpace();
- writePunctuation("=>");
- writeSpace();
- emit(node.type);
- popNameGenerationScope(node);
- }
- function emitJSDocFunctionType(node) {
- writeKeyword("function");
- emitParameters(node, node.parameters);
- writePunctuation(":");
- emit(node.type);
- }
- function emitJSDocNullableType(node) {
- writePunctuation("?");
- emit(node.type);
- }
- function emitJSDocNonNullableType(node) {
- writePunctuation("!");
- emit(node.type);
- }
- function emitJSDocOptionalType(node) {
- emit(node.type);
- writePunctuation("=");
- }
- function emitConstructorType(node) {
- pushNameGenerationScope(node);
- emitModifierList(node, node.modifiers);
- writeKeyword("new");
- writeSpace();
- emitTypeParameters(node, node.typeParameters);
- emitParameters(node, node.parameters);
- writeSpace();
- writePunctuation("=>");
- writeSpace();
- emit(node.type);
- popNameGenerationScope(node);
- }
- function emitTypeQuery(node) {
- writeKeyword("typeof");
- writeSpace();
- emit(node.exprName);
- emitTypeArguments(node, node.typeArguments);
- }
- function emitTypeLiteral(node) {
- pushPrivateNameGenerationScope(
- TempFlags.Auto,
- /*newReservedMemberNames*/
- void 0
- );
- writePunctuation("{");
- const flags = getEmitFlags(node) & 1 /* SingleLine */ ? 768 /* SingleLineTypeLiteralMembers */ : 32897 /* MultiLineTypeLiteralMembers */;
- emitList(node, node.members, flags | 524288 /* NoSpaceIfEmpty */);
- writePunctuation("}");
- popPrivateNameGenerationScope();
- }
- function emitArrayType(node) {
- emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
- writePunctuation("[");
- writePunctuation("]");
- }
- function emitRestOrJSDocVariadicType(node) {
- writePunctuation("...");
- emit(node.type);
- }
- function emitTupleType(node) {
- emitTokenWithComment(22 /* OpenBracketToken */, node.pos, writePunctuation, node);
- const flags = getEmitFlags(node) & 1 /* SingleLine */ ? 528 /* SingleLineTupleTypeElements */ : 657 /* MultiLineTupleTypeElements */;
- emitList(node, node.elements, flags | 524288 /* NoSpaceIfEmpty */, parenthesizer.parenthesizeElementTypeOfTupleType);
- emitTokenWithComment(23 /* CloseBracketToken */, node.elements.end, writePunctuation, node);
- }
- function emitNamedTupleMember(node) {
- emit(node.dotDotDotToken);
- emit(node.name);
- emit(node.questionToken);
- emitTokenWithComment(58 /* ColonToken */, node.name.end, writePunctuation, node);
- writeSpace();
- emit(node.type);
- }
- function emitOptionalType(node) {
- emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType);
- writePunctuation("?");
- }
- function emitUnionType(node) {
- emitList(node, node.types, 516 /* UnionTypeConstituents */, parenthesizer.parenthesizeConstituentTypeOfUnionType);
- }
- function emitIntersectionType(node) {
- emitList(node, node.types, 520 /* IntersectionTypeConstituents */, parenthesizer.parenthesizeConstituentTypeOfIntersectionType);
- }
- function emitConditionalType(node) {
- emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType);
- writeSpace();
- writeKeyword("extends");
- writeSpace();
- emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType);
- writeSpace();
- writePunctuation("?");
- writeSpace();
- emit(node.trueType);
- writeSpace();
- writePunctuation(":");
- writeSpace();
- emit(node.falseType);
- }
- function emitInferType(node) {
- writeKeyword("infer");
- writeSpace();
- emit(node.typeParameter);
- }
- function emitParenthesizedType(node) {
- writePunctuation("(");
- emit(node.type);
- writePunctuation(")");
- }
- function emitThisType() {
- writeKeyword("this");
- }
- function emitTypeOperator(node) {
- writeTokenText(node.operator, writeKeyword);
- writeSpace();
- const parenthesizerRule = node.operator === 146 /* ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator;
- emit(node.type, parenthesizerRule);
- }
- function emitIndexedAccessType(node) {
- emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType);
- writePunctuation("[");
- emit(node.indexType);
- writePunctuation("]");
- }
- function emitMappedType(node) {
- const emitFlags = getEmitFlags(node);
- writePunctuation("{");
- if (emitFlags & 1 /* SingleLine */) {
- writeSpace();
- } else {
- writeLine();
- increaseIndent();
- }
- if (node.readonlyToken) {
- emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 146 /* ReadonlyKeyword */) {
- writeKeyword("readonly");
- }
- writeSpace();
- }
- writePunctuation("[");
- pipelineEmit(3 /* MappedTypeParameter */, node.typeParameter);
- if (node.nameType) {
- writeSpace();
- writeKeyword("as");
- writeSpace();
- emit(node.nameType);
- }
- writePunctuation("]");
- if (node.questionToken) {
- emit(node.questionToken);
- if (node.questionToken.kind !== 57 /* QuestionToken */) {
- writePunctuation("?");
- }
- }
- writePunctuation(":");
- writeSpace();
- emit(node.type);
- writeTrailingSemicolon();
- if (emitFlags & 1 /* SingleLine */) {
- writeSpace();
- } else {
- writeLine();
- decreaseIndent();
- }
- emitList(node, node.members, 2 /* PreserveLines */);
- writePunctuation("}");
- }
- function emitLiteralType(node) {
- emitExpression(node.literal);
- }
- function emitTemplateType(node) {
- emit(node.head);
- emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
- }
- function emitImportTypeNode(node) {
- if (node.isTypeOf) {
- writeKeyword("typeof");
- writeSpace();
- }
- writeKeyword("import");
- writePunctuation("(");
- emit(node.argument);
- if (node.assertions) {
- writePunctuation(",");
- writeSpace();
- writePunctuation("{");
- writeSpace();
- writeKeyword("assert");
- writePunctuation(":");
- writeSpace();
- const elements = node.assertions.assertClause.elements;
- emitList(node.assertions.assertClause, elements, 526226 /* ImportClauseEntries */);
- writeSpace();
- writePunctuation("}");
- }
- writePunctuation(")");
- if (node.qualifier) {
- writePunctuation(".");
- emit(node.qualifier);
- }
- emitTypeArguments(node, node.typeArguments);
- }
- function emitObjectBindingPattern(node) {
- writePunctuation("{");
- emitList(node, node.elements, 525136 /* ObjectBindingPatternElements */);
- writePunctuation("}");
- }
- function emitArrayBindingPattern(node) {
- writePunctuation("[");
- emitList(node, node.elements, 524880 /* ArrayBindingPatternElements */);
- writePunctuation("]");
- }
- function emitBindingElement(node) {
- emit(node.dotDotDotToken);
- if (node.propertyName) {
- emit(node.propertyName);
- writePunctuation(":");
- writeSpace();
- }
- emit(node.name);
- emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitArrayLiteralExpression(node) {
- const elements = node.elements;
- const preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
- emitExpressionList(node, elements, 8914 /* ArrayLiteralExpressionElements */ | preferNewLine, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitObjectLiteralExpression(node) {
- pushPrivateNameGenerationScope(
- TempFlags.Auto,
- /*newReservedMemberNames*/
- void 0
- );
- forEach(node.properties, generateMemberNames);
- const indentedFlag = getEmitFlags(node) & 131072 /* Indented */;
- if (indentedFlag) {
- increaseIndent();
- }
- const preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
- const allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
- emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
- if (indentedFlag) {
- decreaseIndent();
- }
- popPrivateNameGenerationScope();
- }
- function emitPropertyAccessExpression(node) {
- emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
- const token = node.questionDotToken || setTextRangePosEnd(factory.createToken(24 /* DotToken */), node.expression.end, node.name.pos);
- const linesBeforeDot = getLinesBetweenNodes(node, node.expression, token);
- const linesAfterDot = getLinesBetweenNodes(node, token, node.name);
- writeLinesAndIndent(
- linesBeforeDot,
- /*writeSpaceIfNotIndenting*/
- false
- );
- const shouldEmitDotDot = token.kind !== 28 /* QuestionDotToken */ && mayNeedDotDotForPropertyAccess(node.expression) && !writer.hasTrailingComment() && !writer.hasTrailingWhitespace();
- if (shouldEmitDotDot) {
- writePunctuation(".");
- }
- if (node.questionDotToken) {
- emit(token);
- } else {
- emitTokenWithComment(token.kind, node.expression.end, writePunctuation, node);
- }
- writeLinesAndIndent(
- linesAfterDot,
- /*writeSpaceIfNotIndenting*/
- false
- );
- emit(node.name);
- decreaseIndentIf(linesBeforeDot, linesAfterDot);
- }
- function mayNeedDotDotForPropertyAccess(expression) {
- expression = skipPartiallyEmittedExpressions(expression);
- if (isNumericLiteral(expression)) {
- const text = getLiteralTextOfNode(
- expression,
- /*neverAsciiEscape*/
- true,
- /*jsxAttributeEscape*/
- false
- );
- return !expression.numericLiteralFlags && !stringContains(text, tokenToString(24 /* DotToken */));
- } else if (isAccessExpression(expression)) {
- const constantValue = getConstantValue(expression);
- return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue;
- }
- }
- function emitElementAccessExpression(node) {
- emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
- emit(node.questionDotToken);
- emitTokenWithComment(22 /* OpenBracketToken */, node.expression.end, writePunctuation, node);
- emitExpression(node.argumentExpression);
- emitTokenWithComment(23 /* CloseBracketToken */, node.argumentExpression.end, writePunctuation, node);
- }
- function emitCallExpression(node) {
- const indirectCall = getInternalEmitFlags(node) & 16 /* IndirectCall */;
- if (indirectCall) {
- writePunctuation("(");
- writeLiteral("0");
- writePunctuation(",");
- writeSpace();
- }
- emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
- if (indirectCall) {
- writePunctuation(")");
- }
- emit(node.questionDotToken);
- emitTypeArguments(node, node.typeArguments);
- emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitNewExpression(node) {
- emitTokenWithComment(103 /* NewKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfNew);
- emitTypeArguments(node, node.typeArguments);
- emitExpressionList(node, node.arguments, 18960 /* NewExpressionArguments */, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitTaggedTemplateExpression(node) {
- const indirectCall = getInternalEmitFlags(node) & 16 /* IndirectCall */;
- if (indirectCall) {
- writePunctuation("(");
- writeLiteral("0");
- writePunctuation(",");
- writeSpace();
- }
- emitExpression(node.tag, parenthesizer.parenthesizeLeftSideOfAccess);
- if (indirectCall) {
- writePunctuation(")");
- }
- emitTypeArguments(node, node.typeArguments);
- writeSpace();
- emitExpression(node.template);
- }
- function emitTypeAssertionExpression(node) {
- writePunctuation("<");
- emit(node.type);
- writePunctuation(">");
- emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
- }
- function emitParenthesizedExpression(node) {
- const openParenPos = emitTokenWithComment(20 /* OpenParenToken */, node.pos, writePunctuation, node);
- const indented = writeLineSeparatorsAndIndentBefore(node.expression, node);
- emitExpression(
- node.expression,
- /*parenthesizerRules*/
- void 0
- );
- writeLineSeparatorsAfter(node.expression, node);
- decreaseIndentIf(indented);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression ? node.expression.end : openParenPos, writePunctuation, node);
- }
- function emitFunctionExpression(node) {
- generateNameIfNeeded(node.name);
- emitFunctionDeclarationOrExpression(node);
- }
- function emitArrowFunction(node) {
- emitModifierList(node, node.modifiers);
- emitSignatureAndBody(node, emitArrowFunctionHead);
- }
- function emitArrowFunctionHead(node) {
- emitTypeParameters(node, node.typeParameters);
- emitParametersForArrow(node, node.parameters);
- emitTypeAnnotation(node.type);
- writeSpace();
- emit(node.equalsGreaterThanToken);
- }
- function emitDeleteExpression(node) {
- emitTokenWithComment(89 /* DeleteKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
- }
- function emitTypeOfExpression(node) {
- emitTokenWithComment(112 /* TypeOfKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
- }
- function emitVoidExpression(node) {
- emitTokenWithComment(114 /* VoidKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
- }
- function emitAwaitExpression(node) {
- emitTokenWithComment(133 /* AwaitKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary);
- }
- function emitPrefixUnaryExpression(node) {
- writeTokenText(node.operator, writeOperator);
- if (shouldEmitWhitespaceBeforeOperand(node)) {
- writeSpace();
- }
- emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPrefixUnary);
- }
- function shouldEmitWhitespaceBeforeOperand(node) {
- const operand = node.operand;
- return operand.kind === 221 /* PrefixUnaryExpression */ && (node.operator === 39 /* PlusToken */ && (operand.operator === 39 /* PlusToken */ || operand.operator === 45 /* PlusPlusToken */) || node.operator === 40 /* MinusToken */ && (operand.operator === 40 /* MinusToken */ || operand.operator === 46 /* MinusMinusToken */));
- }
- function emitPostfixUnaryExpression(node) {
- emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPostfixUnary);
- writeTokenText(node.operator, writeOperator);
- }
- function createEmitBinaryExpression() {
- return createBinaryExpressionTrampoline(
- onEnter,
- onLeft,
- onOperator,
- onRight,
- onExit,
- /*foldState*/
- void 0
- );
- function onEnter(node, state) {
- if (state) {
- state.stackIndex++;
- state.preserveSourceNewlinesStack[state.stackIndex] = preserveSourceNewlines;
- state.containerPosStack[state.stackIndex] = containerPos;
- state.containerEndStack[state.stackIndex] = containerEnd;
- state.declarationListContainerEndStack[state.stackIndex] = declarationListContainerEnd;
- const emitComments2 = state.shouldEmitCommentsStack[state.stackIndex] = shouldEmitComments(node);
- const emitSourceMaps = state.shouldEmitSourceMapsStack[state.stackIndex] = shouldEmitSourceMaps(node);
- onBeforeEmitNode == null ? void 0 : onBeforeEmitNode(node);
- if (emitComments2)
- emitCommentsBeforeNode(node);
- if (emitSourceMaps)
- emitSourceMapsBeforeNode(node);
- beforeEmitNode(node);
- } else {
- state = {
- stackIndex: 0,
- preserveSourceNewlinesStack: [void 0],
- containerPosStack: [-1],
- containerEndStack: [-1],
- declarationListContainerEndStack: [-1],
- shouldEmitCommentsStack: [false],
- shouldEmitSourceMapsStack: [false]
- };
- }
- return state;
- }
- function onLeft(next, _workArea, parent) {
- return maybeEmitExpression(next, parent, "left");
- }
- function onOperator(operatorToken, _state, node) {
- const isCommaOperator = operatorToken.kind !== 27 /* CommaToken */;
- const linesBeforeOperator = getLinesBetweenNodes(node, node.left, operatorToken);
- const linesAfterOperator = getLinesBetweenNodes(node, operatorToken, node.right);
- writeLinesAndIndent(linesBeforeOperator, isCommaOperator);
- emitLeadingCommentsOfPosition(operatorToken.pos);
- writeTokenNode(operatorToken, operatorToken.kind === 101 /* InKeyword */ ? writeKeyword : writeOperator);
- emitTrailingCommentsOfPosition(
- operatorToken.end,
- /*prefixSpace*/
- true
- );
- writeLinesAndIndent(
- linesAfterOperator,
- /*writeSpaceIfNotIndenting*/
- true
- );
- }
- function onRight(next, _workArea, parent) {
- return maybeEmitExpression(next, parent, "right");
- }
- function onExit(node, state) {
- const linesBeforeOperator = getLinesBetweenNodes(node, node.left, node.operatorToken);
- const linesAfterOperator = getLinesBetweenNodes(node, node.operatorToken, node.right);
- decreaseIndentIf(linesBeforeOperator, linesAfterOperator);
- if (state.stackIndex > 0) {
- const savedPreserveSourceNewlines = state.preserveSourceNewlinesStack[state.stackIndex];
- const savedContainerPos = state.containerPosStack[state.stackIndex];
- const savedContainerEnd = state.containerEndStack[state.stackIndex];
- const savedDeclarationListContainerEnd = state.declarationListContainerEndStack[state.stackIndex];
- const shouldEmitComments2 = state.shouldEmitCommentsStack[state.stackIndex];
- const shouldEmitSourceMaps2 = state.shouldEmitSourceMapsStack[state.stackIndex];
- afterEmitNode(savedPreserveSourceNewlines);
- if (shouldEmitSourceMaps2)
- emitSourceMapsAfterNode(node);
- if (shouldEmitComments2)
- emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
- onAfterEmitNode == null ? void 0 : onAfterEmitNode(node);
- state.stackIndex--;
- }
- }
- function maybeEmitExpression(next, parent, side) {
- const parenthesizerRule = side === "left" ? parenthesizer.getParenthesizeLeftSideOfBinaryForOperator(parent.operatorToken.kind) : parenthesizer.getParenthesizeRightSideOfBinaryForOperator(parent.operatorToken.kind);
- let pipelinePhase = getPipelinePhase(0 /* Notification */, 1 /* Expression */, next);
- if (pipelinePhase === pipelineEmitWithSubstitution) {
- Debug.assertIsDefined(lastSubstitution);
- next = parenthesizerRule(cast(lastSubstitution, isExpression));
- pipelinePhase = getNextPipelinePhase(1 /* Substitution */, 1 /* Expression */, next);
- lastSubstitution = void 0;
- }
- if (pipelinePhase === pipelineEmitWithComments || pipelinePhase === pipelineEmitWithSourceMaps || pipelinePhase === pipelineEmitWithHint) {
- if (isBinaryExpression(next)) {
- return next;
- }
- }
- currentParenthesizerRule = parenthesizerRule;
- pipelinePhase(1 /* Expression */, next);
- }
- }
- function emitConditionalExpression(node) {
- const linesBeforeQuestion = getLinesBetweenNodes(node, node.condition, node.questionToken);
- const linesAfterQuestion = getLinesBetweenNodes(node, node.questionToken, node.whenTrue);
- const linesBeforeColon = getLinesBetweenNodes(node, node.whenTrue, node.colonToken);
- const linesAfterColon = getLinesBetweenNodes(node, node.colonToken, node.whenFalse);
- emitExpression(node.condition, parenthesizer.parenthesizeConditionOfConditionalExpression);
- writeLinesAndIndent(
- linesBeforeQuestion,
- /*writeSpaceIfNotIndenting*/
- true
- );
- emit(node.questionToken);
- writeLinesAndIndent(
- linesAfterQuestion,
- /*writeSpaceIfNotIndenting*/
- true
- );
- emitExpression(node.whenTrue, parenthesizer.parenthesizeBranchOfConditionalExpression);
- decreaseIndentIf(linesBeforeQuestion, linesAfterQuestion);
- writeLinesAndIndent(
- linesBeforeColon,
- /*writeSpaceIfNotIndenting*/
- true
- );
- emit(node.colonToken);
- writeLinesAndIndent(
- linesAfterColon,
- /*writeSpaceIfNotIndenting*/
- true
- );
- emitExpression(node.whenFalse, parenthesizer.parenthesizeBranchOfConditionalExpression);
- decreaseIndentIf(linesBeforeColon, linesAfterColon);
- }
- function emitTemplateExpression(node) {
- emit(node.head);
- emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
- }
- function emitYieldExpression(node) {
- emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
- emit(node.asteriskToken);
- emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
- }
- function emitSpreadElement(node) {
- emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
- emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitClassExpression(node) {
- generateNameIfNeeded(node.name);
- emitClassDeclarationOrExpression(node);
- }
- function emitExpressionWithTypeArguments(node) {
- emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
- emitTypeArguments(node, node.typeArguments);
- }
- function emitAsExpression(node) {
- emitExpression(
- node.expression,
- /*parenthesizerRules*/
- void 0
- );
- if (node.type) {
- writeSpace();
- writeKeyword("as");
- writeSpace();
- emit(node.type);
- }
- }
- function emitNonNullExpression(node) {
- emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess);
- writeOperator("!");
- }
- function emitSatisfiesExpression(node) {
- emitExpression(
- node.expression,
- /*parenthesizerRules*/
- void 0
- );
- if (node.type) {
- writeSpace();
- writeKeyword("satisfies");
- writeSpace();
- emit(node.type);
- }
- }
- function emitMetaProperty(node) {
- writeToken(node.keywordToken, node.pos, writePunctuation);
- writePunctuation(".");
- emit(node.name);
- }
- function emitTemplateSpan(node) {
- emitExpression(node.expression);
- emit(node.literal);
- }
- function emitBlock(node) {
- emitBlockStatements(
- node,
- /*forceSingleLine*/
- !node.multiLine && isEmptyBlock(node)
- );
- }
- function emitBlockStatements(node, forceSingleLine) {
- emitTokenWithComment(
- 18 /* OpenBraceToken */,
- node.pos,
- writePunctuation,
- /*contextNode*/
- node
- );
- const format = forceSingleLine || getEmitFlags(node) & 1 /* SingleLine */ ? 768 /* SingleLineBlockStatements */ : 129 /* MultiLineBlockStatements */;
- emitList(node, node.statements, format);
- emitTokenWithComment(
- 19 /* CloseBraceToken */,
- node.statements.end,
- writePunctuation,
- /*contextNode*/
- node,
- /*indentLeading*/
- !!(format & 1 /* MultiLine */)
- );
- }
- function emitVariableStatement(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- emit(node.declarationList);
- writeTrailingSemicolon();
- }
- function emitEmptyStatement(isEmbeddedStatement) {
- if (isEmbeddedStatement) {
- writePunctuation(";");
- } else {
- writeTrailingSemicolon();
- }
- }
- function emitExpressionStatement(node) {
- emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
- if (!currentSourceFile || !isJsonSourceFile(currentSourceFile) || nodeIsSynthesized(node.expression)) {
- writeTrailingSemicolon();
- }
- }
- function emitIfStatement(node) {
- const openParenPos = emitTokenWithComment(99 /* IfKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emitExpression(node.expression);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
- emitEmbeddedStatement(node, node.thenStatement);
- if (node.elseStatement) {
- writeLineOrSpace(node, node.thenStatement, node.elseStatement);
- emitTokenWithComment(91 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 242 /* IfStatement */) {
- writeSpace();
- emit(node.elseStatement);
- } else {
- emitEmbeddedStatement(node, node.elseStatement);
- }
- }
- }
- function emitWhileClause(node, startPos) {
- const openParenPos = emitTokenWithComment(115 /* WhileKeyword */, startPos, writeKeyword, node);
- writeSpace();
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emitExpression(node.expression);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
- }
- function emitDoStatement(node) {
- emitTokenWithComment(90 /* DoKeyword */, node.pos, writeKeyword, node);
- emitEmbeddedStatement(node, node.statement);
- if (isBlock(node.statement) && !preserveSourceNewlines) {
- writeSpace();
- } else {
- writeLineOrSpace(node, node.statement, node.expression);
- }
- emitWhileClause(node, node.statement.end);
- writeTrailingSemicolon();
- }
- function emitWhileStatement(node) {
- emitWhileClause(node, node.pos);
- emitEmbeddedStatement(node, node.statement);
- }
- function emitForStatement(node) {
- const openParenPos = emitTokenWithComment(97 /* ForKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- let pos = emitTokenWithComment(
- 20 /* OpenParenToken */,
- openParenPos,
- writePunctuation,
- /*contextNode*/
- node
- );
- emitForBinding(node.initializer);
- pos = emitTokenWithComment(26 /* SemicolonToken */, node.initializer ? node.initializer.end : pos, writePunctuation, node);
- emitExpressionWithLeadingSpace(node.condition);
- pos = emitTokenWithComment(26 /* SemicolonToken */, node.condition ? node.condition.end : pos, writePunctuation, node);
- emitExpressionWithLeadingSpace(node.incrementor);
- emitTokenWithComment(21 /* CloseParenToken */, node.incrementor ? node.incrementor.end : pos, writePunctuation, node);
- emitEmbeddedStatement(node, node.statement);
- }
- function emitForInStatement(node) {
- const openParenPos = emitTokenWithComment(97 /* ForKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emitForBinding(node.initializer);
- writeSpace();
- emitTokenWithComment(101 /* InKeyword */, node.initializer.end, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
- emitEmbeddedStatement(node, node.statement);
- }
- function emitForOfStatement(node) {
- const openParenPos = emitTokenWithComment(97 /* ForKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitWithTrailingSpace(node.awaitModifier);
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emitForBinding(node.initializer);
- writeSpace();
- emitTokenWithComment(162 /* OfKeyword */, node.initializer.end, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
- emitEmbeddedStatement(node, node.statement);
- }
- function emitForBinding(node) {
- if (node !== void 0) {
- if (node.kind === 258 /* VariableDeclarationList */) {
- emit(node);
- } else {
- emitExpression(node);
- }
- }
- }
- function emitContinueStatement(node) {
- emitTokenWithComment(86 /* ContinueKeyword */, node.pos, writeKeyword, node);
- emitWithLeadingSpace(node.label);
- writeTrailingSemicolon();
- }
- function emitBreakStatement(node) {
- emitTokenWithComment(81 /* BreakKeyword */, node.pos, writeKeyword, node);
- emitWithLeadingSpace(node.label);
- writeTrailingSemicolon();
- }
- function emitTokenWithComment(token, pos, writer2, contextNode, indentLeading) {
- const node = getParseTreeNode(contextNode);
- const isSimilarNode = node && node.kind === contextNode.kind;
- const startPos = pos;
- if (isSimilarNode && currentSourceFile) {
- pos = skipTrivia(currentSourceFile.text, pos);
- }
- if (isSimilarNode && contextNode.pos !== startPos) {
- const needsIndent = indentLeading && currentSourceFile && !positionsAreOnSameLine(startPos, pos, currentSourceFile);
- if (needsIndent) {
- increaseIndent();
- }
- emitLeadingCommentsOfPosition(startPos);
- if (needsIndent) {
- decreaseIndent();
- }
- }
- pos = writeTokenText(token, writer2, pos);
- if (isSimilarNode && contextNode.end !== pos) {
- const isJsxExprContext = contextNode.kind === 291 /* JsxExpression */;
- emitTrailingCommentsOfPosition(
- pos,
- /*prefixSpace*/
- !isJsxExprContext,
- /*forceNoNewline*/
- isJsxExprContext
- );
- }
- return pos;
- }
- function commentWillEmitNewLine(node) {
- return node.kind === 2 /* SingleLineCommentTrivia */ || !!node.hasTrailingNewLine;
- }
- function willEmitLeadingNewLine(node) {
- if (!currentSourceFile)
- return false;
- if (some(getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine))
- return true;
- if (some(getSyntheticLeadingComments(node), commentWillEmitNewLine))
- return true;
- if (isPartiallyEmittedExpression(node)) {
- if (node.pos !== node.expression.pos) {
- if (some(getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine))
- return true;
- }
- return willEmitLeadingNewLine(node.expression);
- }
- return false;
- }
- function parenthesizeExpressionForNoAsi(node) {
- if (!commentsDisabled && isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
- const parseNode = getParseTreeNode(node);
- if (parseNode && isParenthesizedExpression(parseNode)) {
- const parens = factory.createParenthesizedExpression(node.expression);
- setOriginalNode(parens, node);
- setTextRange(parens, parseNode);
- return parens;
- }
- return factory.createParenthesizedExpression(node);
- }
- return node;
- }
- function parenthesizeExpressionForNoAsiAndDisallowedComma(node) {
- return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node));
- }
- function emitReturnStatement(node) {
- emitTokenWithComment(
- 105 /* ReturnKeyword */,
- node.pos,
- writeKeyword,
- /*contextNode*/
- node
- );
- emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
- writeTrailingSemicolon();
- }
- function emitWithStatement(node) {
- const openParenPos = emitTokenWithComment(116 /* WithKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emitExpression(node.expression);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
- emitEmbeddedStatement(node, node.statement);
- }
- function emitSwitchStatement(node) {
- const openParenPos = emitTokenWithComment(107 /* SwitchKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emitExpression(node.expression);
- emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
- writeSpace();
- emit(node.caseBlock);
- }
- function emitLabeledStatement(node) {
- emit(node.label);
- emitTokenWithComment(58 /* ColonToken */, node.label.end, writePunctuation, node);
- writeSpace();
- emit(node.statement);
- }
- function emitThrowStatement(node) {
- emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
- emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
- writeTrailingSemicolon();
- }
- function emitTryStatement(node) {
- emitTokenWithComment(111 /* TryKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emit(node.tryBlock);
- if (node.catchClause) {
- writeLineOrSpace(node, node.tryBlock, node.catchClause);
- emit(node.catchClause);
- }
- if (node.finallyBlock) {
- writeLineOrSpace(node, node.catchClause || node.tryBlock, node.finallyBlock);
- emitTokenWithComment(96 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
- writeSpace();
- emit(node.finallyBlock);
- }
- }
- function emitDebuggerStatement(node) {
- writeToken(87 /* DebuggerKeyword */, node.pos, writeKeyword);
- writeTrailingSemicolon();
- }
- function emitVariableDeclaration(node) {
- var _a2, _b, _c, _d, _e;
- emit(node.name);
- emit(node.exclamationToken);
- emitTypeAnnotation(node.type);
- emitInitializer(node.initializer, (_e = (_d = (_a2 = node.type) == null ? void 0 : _a2.end) != null ? _d : (_c = (_b = node.name.emitNode) == null ? void 0 : _b.typeNode) == null ? void 0 : _c.end) != null ? _e : node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitVariableDeclarationList(node) {
- writeKeyword(isLet(node) ? "let" : isVarConst(node) ? "const" : "var");
- writeSpace();
- emitList(node, node.declarations, 528 /* VariableDeclarationList */);
- }
- function emitFunctionDeclaration(node) {
- emitFunctionDeclarationOrExpression(node);
- }
- function emitFunctionDeclarationOrExpression(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- writeKeyword("function");
- emit(node.asteriskToken);
- writeSpace();
- emitIdentifierName(node.name);
- emitSignatureAndBody(node, emitSignatureHead);
- }
- function emitSignatureAndBody(node, emitSignatureHead2) {
- const body = node.body;
- if (body) {
- if (isBlock(body)) {
- const indentedFlag = getEmitFlags(node) & 131072 /* Indented */;
- if (indentedFlag) {
- increaseIndent();
- }
- pushNameGenerationScope(node);
- forEach(node.parameters, generateNames);
- generateNames(node.body);
- emitSignatureHead2(node);
- emitBlockFunctionBody(body);
- popNameGenerationScope(node);
- if (indentedFlag) {
- decreaseIndent();
- }
- } else {
- emitSignatureHead2(node);
- writeSpace();
- emitExpression(body, parenthesizer.parenthesizeConciseBodyOfArrowFunction);
- }
- } else {
- emitSignatureHead2(node);
- writeTrailingSemicolon();
- }
- }
- function emitSignatureHead(node) {
- emitTypeParameters(node, node.typeParameters);
- emitParameters(node, node.parameters);
- emitTypeAnnotation(node.type);
- }
- function shouldEmitBlockFunctionBodyOnSingleLine(body) {
- if (getEmitFlags(body) & 1 /* SingleLine */) {
- return true;
- }
- if (body.multiLine) {
- return false;
- }
- if (!nodeIsSynthesized(body) && currentSourceFile && !rangeIsOnSingleLine(body, currentSourceFile)) {
- return false;
- }
- if (getLeadingLineTerminatorCount(body, firstOrUndefined(body.statements), 2 /* PreserveLines */) || getClosingLineTerminatorCount(body, lastOrUndefined(body.statements), 2 /* PreserveLines */, body.statements)) {
- return false;
- }
- let previousStatement;
- for (const statement of body.statements) {
- if (getSeparatingLineTerminatorCount(previousStatement, statement, 2 /* PreserveLines */) > 0) {
- return false;
- }
- previousStatement = statement;
- }
- return true;
- }
- function emitBlockFunctionBody(body) {
- onBeforeEmitNode == null ? void 0 : onBeforeEmitNode(body);
- writeSpace();
- writePunctuation("{");
- increaseIndent();
- const emitBlockFunctionBody2 = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine : emitBlockFunctionBodyWorker;
- emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody2);
- decreaseIndent();
- writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
- onAfterEmitNode == null ? void 0 : onAfterEmitNode(body);
- }
- function emitBlockFunctionBodyOnSingleLine(body) {
- emitBlockFunctionBodyWorker(
- body,
- /*emitBlockFunctionBodyOnSingleLine*/
- true
- );
- }
- function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine2) {
- const statementOffset = emitPrologueDirectives(body.statements);
- const pos = writer.getTextPos();
- emitHelpers(body);
- if (statementOffset === 0 && pos === writer.getTextPos() && emitBlockFunctionBodyOnSingleLine2) {
- decreaseIndent();
- emitList(body, body.statements, 768 /* SingleLineFunctionBodyStatements */);
- increaseIndent();
- } else {
- emitList(
- body,
- body.statements,
- 1 /* MultiLineFunctionBodyStatements */,
- /*parenthesizerRule*/
- void 0,
- statementOffset
- );
- }
- }
- function emitClassDeclaration(node) {
- emitClassDeclarationOrExpression(node);
- }
- function emitClassDeclarationOrExpression(node) {
- pushPrivateNameGenerationScope(
- TempFlags.Auto,
- /*newReservedMemberNames*/
- void 0
- );
- forEach(node.members, generateMemberNames);
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- true
- );
- emitTokenWithComment(84 /* ClassKeyword */, moveRangePastModifiers(node).pos, writeKeyword, node);
- if (node.name) {
- writeSpace();
- emitIdentifierName(node.name);
- }
- const indentedFlag = getEmitFlags(node) & 131072 /* Indented */;
- if (indentedFlag) {
- increaseIndent();
- }
- emitTypeParameters(node, node.typeParameters);
- emitList(node, node.heritageClauses, 0 /* ClassHeritageClauses */);
- writeSpace();
- writePunctuation("{");
- emitList(node, node.members, 129 /* ClassMembers */);
- writePunctuation("}");
- if (indentedFlag) {
- decreaseIndent();
- }
- popPrivateNameGenerationScope();
- }
- function emitInterfaceDeclaration(node) {
- pushPrivateNameGenerationScope(
- TempFlags.Auto,
- /*newReservedMemberNames*/
- void 0
- );
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- writeKeyword("interface");
- writeSpace();
- emit(node.name);
- emitTypeParameters(node, node.typeParameters);
- emitList(node, node.heritageClauses, 512 /* HeritageClauses */);
- writeSpace();
- writePunctuation("{");
- emitList(node, node.members, 129 /* InterfaceMembers */);
- writePunctuation("}");
- popPrivateNameGenerationScope();
- }
- function emitTypeAliasDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- writeKeyword("type");
- writeSpace();
- emit(node.name);
- emitTypeParameters(node, node.typeParameters);
- writeSpace();
- writePunctuation("=");
- writeSpace();
- emit(node.type);
- writeTrailingSemicolon();
- }
- function emitEnumDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- writeKeyword("enum");
- writeSpace();
- emit(node.name);
- writeSpace();
- writePunctuation("{");
- emitList(node, node.members, 145 /* EnumMembers */);
- writePunctuation("}");
- }
- function emitModuleDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- if (~node.flags & 1024 /* GlobalAugmentation */) {
- writeKeyword(node.flags & 16 /* Namespace */ ? "namespace" : "module");
- writeSpace();
- }
- emit(node.name);
- let body = node.body;
- if (!body)
- return writeTrailingSemicolon();
- while (body && isModuleDeclaration(body)) {
- writePunctuation(".");
- emit(body.name);
- body = body.body;
- }
- writeSpace();
- emit(body);
- }
- function emitModuleBlock(node) {
- pushNameGenerationScope(node);
- forEach(node.statements, generateNames);
- emitBlockStatements(
- node,
- /*forceSingleLine*/
- isEmptyBlock(node)
- );
- popNameGenerationScope(node);
- }
- function emitCaseBlock(node) {
- emitTokenWithComment(18 /* OpenBraceToken */, node.pos, writePunctuation, node);
- emitList(node, node.clauses, 129 /* CaseBlockClauses */);
- emitTokenWithComment(
- 19 /* CloseBraceToken */,
- node.clauses.end,
- writePunctuation,
- node,
- /*indentLeading*/
- true
- );
- }
- function emitImportEqualsDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- emitTokenWithComment(100 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
- writeSpace();
- if (node.isTypeOnly) {
- emitTokenWithComment(154 /* TypeKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- }
- emit(node.name);
- writeSpace();
- emitTokenWithComment(63 /* EqualsToken */, node.name.end, writePunctuation, node);
- writeSpace();
- emitModuleReference(node.moduleReference);
- writeTrailingSemicolon();
- }
- function emitModuleReference(node) {
- if (node.kind === 79 /* Identifier */) {
- emitExpression(node);
- } else {
- emit(node);
- }
- }
- function emitImportDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- emitTokenWithComment(100 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
- writeSpace();
- if (node.importClause) {
- emit(node.importClause);
- writeSpace();
- emitTokenWithComment(158 /* FromKeyword */, node.importClause.end, writeKeyword, node);
- writeSpace();
- }
- emitExpression(node.moduleSpecifier);
- if (node.assertClause) {
- emitWithLeadingSpace(node.assertClause);
- }
- writeTrailingSemicolon();
- }
- function emitImportClause(node) {
- if (node.isTypeOnly) {
- emitTokenWithComment(154 /* TypeKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- }
- emit(node.name);
- if (node.name && node.namedBindings) {
- emitTokenWithComment(27 /* CommaToken */, node.name.end, writePunctuation, node);
- writeSpace();
- }
- emit(node.namedBindings);
- }
- function emitNamespaceImport(node) {
- const asPos = emitTokenWithComment(41 /* AsteriskToken */, node.pos, writePunctuation, node);
- writeSpace();
- emitTokenWithComment(128 /* AsKeyword */, asPos, writeKeyword, node);
- writeSpace();
- emit(node.name);
- }
- function emitNamedImports(node) {
- emitNamedImportsOrExports(node);
- }
- function emitImportSpecifier(node) {
- emitImportOrExportSpecifier(node);
- }
- function emitExportAssignment(node) {
- const nextPos = emitTokenWithComment(93 /* ExportKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- if (node.isExportEquals) {
- emitTokenWithComment(63 /* EqualsToken */, nextPos, writeOperator, node);
- } else {
- emitTokenWithComment(88 /* DefaultKeyword */, nextPos, writeKeyword, node);
- }
- writeSpace();
- emitExpression(node.expression, node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(63 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault);
- writeTrailingSemicolon();
- }
- function emitExportDeclaration(node) {
- emitDecoratorsAndModifiers(
- node,
- node.modifiers,
- /*allowDecorators*/
- false
- );
- let nextPos = emitTokenWithComment(93 /* ExportKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- if (node.isTypeOnly) {
- nextPos = emitTokenWithComment(154 /* TypeKeyword */, nextPos, writeKeyword, node);
- writeSpace();
- }
- if (node.exportClause) {
- emit(node.exportClause);
- } else {
- nextPos = emitTokenWithComment(41 /* AsteriskToken */, nextPos, writePunctuation, node);
- }
- if (node.moduleSpecifier) {
- writeSpace();
- const fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(158 /* FromKeyword */, fromPos, writeKeyword, node);
- writeSpace();
- emitExpression(node.moduleSpecifier);
- }
- if (node.assertClause) {
- emitWithLeadingSpace(node.assertClause);
- }
- writeTrailingSemicolon();
- }
- function emitAssertClause(node) {
- emitTokenWithComment(130 /* AssertKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- const elements = node.elements;
- emitList(node, elements, 526226 /* ImportClauseEntries */);
- }
- function emitAssertEntry(node) {
- emit(node.name);
- writePunctuation(":");
- writeSpace();
- const value = node.value;
- if ((getEmitFlags(value) & 1024 /* NoLeadingComments */) === 0) {
- const commentRange = getCommentRange(value);
- emitTrailingCommentsOfPosition(commentRange.pos);
- }
- emit(value);
- }
- function emitNamespaceExportDeclaration(node) {
- let nextPos = emitTokenWithComment(93 /* ExportKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- nextPos = emitTokenWithComment(128 /* AsKeyword */, nextPos, writeKeyword, node);
- writeSpace();
- nextPos = emitTokenWithComment(143 /* NamespaceKeyword */, nextPos, writeKeyword, node);
- writeSpace();
- emit(node.name);
- writeTrailingSemicolon();
- }
- function emitNamespaceExport(node) {
- const asPos = emitTokenWithComment(41 /* AsteriskToken */, node.pos, writePunctuation, node);
- writeSpace();
- emitTokenWithComment(128 /* AsKeyword */, asPos, writeKeyword, node);
- writeSpace();
- emit(node.name);
- }
- function emitNamedExports(node) {
- emitNamedImportsOrExports(node);
- }
- function emitExportSpecifier(node) {
- emitImportOrExportSpecifier(node);
- }
- function emitNamedImportsOrExports(node) {
- writePunctuation("{");
- emitList(node, node.elements, 525136 /* NamedImportsOrExportsElements */);
- writePunctuation("}");
- }
- function emitImportOrExportSpecifier(node) {
- if (node.isTypeOnly) {
- writeKeyword("type");
- writeSpace();
- }
- if (node.propertyName) {
- emit(node.propertyName);
- writeSpace();
- emitTokenWithComment(128 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
- writeSpace();
- }
- emit(node.name);
- }
- function emitExternalModuleReference(node) {
- writeKeyword("require");
- writePunctuation("(");
- emitExpression(node.expression);
- writePunctuation(")");
- }
- function emitJsxElement(node) {
- emit(node.openingElement);
- emitList(node, node.children, 262144 /* JsxElementOrFragmentChildren */);
- emit(node.closingElement);
- }
- function emitJsxSelfClosingElement(node) {
- writePunctuation("<");
- emitJsxTagName(node.tagName);
- emitTypeArguments(node, node.typeArguments);
- writeSpace();
- emit(node.attributes);
- writePunctuation("/>");
- }
- function emitJsxFragment(node) {
- emit(node.openingFragment);
- emitList(node, node.children, 262144 /* JsxElementOrFragmentChildren */);
- emit(node.closingFragment);
- }
- function emitJsxOpeningElementOrFragment(node) {
- writePunctuation("<");
- if (isJsxOpeningElement(node)) {
- const indented = writeLineSeparatorsAndIndentBefore(node.tagName, node);
- emitJsxTagName(node.tagName);
- emitTypeArguments(node, node.typeArguments);
- if (node.attributes.properties && node.attributes.properties.length > 0) {
- writeSpace();
- }
- emit(node.attributes);
- writeLineSeparatorsAfter(node.attributes, node);
- decreaseIndentIf(indented);
- }
- writePunctuation(">");
- }
- function emitJsxText(node) {
- writer.writeLiteral(node.text);
- }
- function emitJsxClosingElementOrFragment(node) {
- writePunctuation("");
- if (isJsxClosingElement(node)) {
- emitJsxTagName(node.tagName);
- }
- writePunctuation(">");
- }
- function emitJsxAttributes(node) {
- emitList(node, node.properties, 262656 /* JsxElementAttributes */);
- }
- function emitJsxAttribute(node) {
- emit(node.name);
- emitNodeWithPrefix("=", writePunctuation, node.initializer, emitJsxAttributeValue);
- }
- function emitJsxSpreadAttribute(node) {
- writePunctuation("{...");
- emitExpression(node.expression);
- writePunctuation("}");
- }
- function hasTrailingCommentsAtPosition(pos) {
- let result = false;
- forEachTrailingCommentRange((currentSourceFile == null ? void 0 : currentSourceFile.text) || "", pos + 1, () => result = true);
- return result;
- }
- function hasLeadingCommentsAtPosition(pos) {
- let result = false;
- forEachLeadingCommentRange((currentSourceFile == null ? void 0 : currentSourceFile.text) || "", pos + 1, () => result = true);
- return result;
- }
- function hasCommentsAtPosition(pos) {
- return hasTrailingCommentsAtPosition(pos) || hasLeadingCommentsAtPosition(pos);
- }
- function emitJsxExpression(node) {
- var _a2;
- if (node.expression || !commentsDisabled && !nodeIsSynthesized(node) && hasCommentsAtPosition(node.pos)) {
- const isMultiline = currentSourceFile && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(currentSourceFile, node.pos).line !== getLineAndCharacterOfPosition(currentSourceFile, node.end).line;
- if (isMultiline) {
- writer.increaseIndent();
- }
- const end = emitTokenWithComment(18 /* OpenBraceToken */, node.pos, writePunctuation, node);
- emit(node.dotDotDotToken);
- emitExpression(node.expression);
- emitTokenWithComment(19 /* CloseBraceToken */, ((_a2 = node.expression) == null ? void 0 : _a2.end) || end, writePunctuation, node);
- if (isMultiline) {
- writer.decreaseIndent();
- }
- }
- }
- function emitJsxTagName(node) {
- if (node.kind === 79 /* Identifier */) {
- emitExpression(node);
- } else {
- emit(node);
- }
- }
- function emitCaseClause(node) {
- emitTokenWithComment(82 /* CaseKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
- emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
- }
- function emitDefaultClause(node) {
- const pos = emitTokenWithComment(88 /* DefaultKeyword */, node.pos, writeKeyword, node);
- emitCaseOrDefaultClauseRest(node, node.statements, pos);
- }
- function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
- const emitAsSingleStatement = statements.length === 1 && // treat synthesized nodes as located on the same line for emit purposes
- (!currentSourceFile || nodeIsSynthesized(parentNode) || nodeIsSynthesized(statements[0]) || rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
- let format = 163969 /* CaseOrDefaultClauseStatements */;
- if (emitAsSingleStatement) {
- writeToken(58 /* ColonToken */, colonPos, writePunctuation, parentNode);
- writeSpace();
- format &= ~(1 /* MultiLine */ | 128 /* Indented */);
- } else {
- emitTokenWithComment(58 /* ColonToken */, colonPos, writePunctuation, parentNode);
- }
- emitList(parentNode, statements, format);
- }
- function emitHeritageClause(node) {
- writeSpace();
- writeTokenText(node.token, writeKeyword);
- writeSpace();
- emitList(node, node.types, 528 /* HeritageClauseTypes */);
- }
- function emitCatchClause(node) {
- const openParenPos = emitTokenWithComment(83 /* CatchKeyword */, node.pos, writeKeyword, node);
- writeSpace();
- if (node.variableDeclaration) {
- emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
- emit(node.variableDeclaration);
- emitTokenWithComment(21 /* CloseParenToken */, node.variableDeclaration.end, writePunctuation, node);
- writeSpace();
- }
- emit(node.block);
- }
- function emitPropertyAssignment(node) {
- emit(node.name);
- writePunctuation(":");
- writeSpace();
- const initializer = node.initializer;
- if ((getEmitFlags(initializer) & 1024 /* NoLeadingComments */) === 0) {
- const commentRange = getCommentRange(initializer);
- emitTrailingCommentsOfPosition(commentRange.pos);
- }
- emitExpression(initializer, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitShorthandPropertyAssignment(node) {
- emit(node.name);
- if (node.objectAssignmentInitializer) {
- writeSpace();
- writePunctuation("=");
- writeSpace();
- emitExpression(node.objectAssignmentInitializer, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- }
- function emitSpreadAssignment(node) {
- if (node.expression) {
- emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
- emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- }
- function emitEnumMember(node) {
- emit(node.name);
- emitInitializer(node.initializer, node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma);
- }
- function emitJSDoc(node) {
- write("/**");
- if (node.comment) {
- const text = getTextOfJSDocComment(node.comment);
- if (text) {
- const lines = text.split(/\r\n?|\n/g);
- for (const line of lines) {
- writeLine();
- writeSpace();
- writePunctuation("*");
- writeSpace();
- write(line);
- }
- }
- }
- if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 347 /* JSDocTypeTag */ && !node.comment) {
- writeSpace();
- emit(node.tags[0]);
- } else {
- emitList(node, node.tags, 33 /* JSDocComment */);
- }
- }
- writeSpace();
- write("*/");
- }
- function emitJSDocSimpleTypedTag(tag) {
- emitJSDocTagName(tag.tagName);
- emitJSDocTypeExpression(tag.typeExpression);
- emitJSDocComment(tag.comment);
- }
- function emitJSDocSeeTag(tag) {
- emitJSDocTagName(tag.tagName);
- emit(tag.name);
- emitJSDocComment(tag.comment);
- }
- function emitJSDocNameReference(node) {
- writeSpace();
- writePunctuation("{");
- emit(node.name);
- writePunctuation("}");
- }
- function emitJSDocHeritageTag(tag) {
- emitJSDocTagName(tag.tagName);
- writeSpace();
- writePunctuation("{");
- emit(tag.class);
- writePunctuation("}");
- emitJSDocComment(tag.comment);
- }
- function emitJSDocTemplateTag(tag) {
- emitJSDocTagName(tag.tagName);
- emitJSDocTypeExpression(tag.constraint);
- writeSpace();
- emitList(tag, tag.typeParameters, 528 /* CommaListElements */);
- emitJSDocComment(tag.comment);
- }
- function emitJSDocTypedefTag(tag) {
- emitJSDocTagName(tag.tagName);
- if (tag.typeExpression) {
- if (tag.typeExpression.kind === 312 /* JSDocTypeExpression */) {
- emitJSDocTypeExpression(tag.typeExpression);
- } else {
- writeSpace();
- writePunctuation("{");
- write("Object");
- if (tag.typeExpression.isArrayType) {
- writePunctuation("[");
- writePunctuation("]");
- }
- writePunctuation("}");
- }
- }
- if (tag.fullName) {
- writeSpace();
- emit(tag.fullName);
- }
- emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 325 /* JSDocTypeLiteral */) {
- emitJSDocTypeLiteral(tag.typeExpression);
- }
- }
- function emitJSDocCallbackTag(tag) {
- emitJSDocTagName(tag.tagName);
- if (tag.name) {
- writeSpace();
- emit(tag.name);
- }
- emitJSDocComment(tag.comment);
- emitJSDocSignature(tag.typeExpression);
- }
- function emitJSDocOverloadTag(tag) {
- emitJSDocComment(tag.comment);
- emitJSDocSignature(tag.typeExpression);
- }
- function emitJSDocSimpleTag(tag) {
- emitJSDocTagName(tag.tagName);
- emitJSDocComment(tag.comment);
- }
- function emitJSDocTypeLiteral(lit) {
- emitList(lit, factory.createNodeArray(lit.jsDocPropertyTags), 33 /* JSDocComment */);
- }
- function emitJSDocSignature(sig) {
- if (sig.typeParameters) {
- emitList(sig, factory.createNodeArray(sig.typeParameters), 33 /* JSDocComment */);
- }
- if (sig.parameters) {
- emitList(sig, factory.createNodeArray(sig.parameters), 33 /* JSDocComment */);
- }
- if (sig.type) {
- writeLine();
- writeSpace();
- writePunctuation("*");
- writeSpace();
- emit(sig.type);
- }
- }
- function emitJSDocPropertyLikeTag(param) {
- emitJSDocTagName(param.tagName);
- emitJSDocTypeExpression(param.typeExpression);
- writeSpace();
- if (param.isBracketed) {
- writePunctuation("[");
- }
- emit(param.name);
- if (param.isBracketed) {
- writePunctuation("]");
- }
- emitJSDocComment(param.comment);
- }
- function emitJSDocTagName(tagName) {
- writePunctuation("@");
- emit(tagName);
- }
- function emitJSDocComment(comment) {
- const text = getTextOfJSDocComment(comment);
- if (text) {
- writeSpace();
- write(text);
- }
- }
- function emitJSDocTypeExpression(typeExpression) {
- if (typeExpression) {
- writeSpace();
- writePunctuation("{");
- emit(typeExpression.type);
- writePunctuation("}");
- }
- }
- function emitSourceFile(node) {
- writeLine();
- const statements = node.statements;
- const shouldEmitDetachedComment = statements.length === 0 || !isPrologueDirective(statements[0]) || nodeIsSynthesized(statements[0]);
- if (shouldEmitDetachedComment) {
- emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
- return;
- }
- emitSourceFileWorker(node);
- }
- function emitSyntheticTripleSlashReferencesIfNeeded(node) {
- emitTripleSlashDirectives(!!node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []);
- for (const prepend of node.prepends) {
- if (isUnparsedSource(prepend) && prepend.syntheticReferences) {
- for (const ref of prepend.syntheticReferences) {
- emit(ref);
- writeLine();
- }
- }
- }
- }
- function emitTripleSlashDirectivesIfNeeded(node) {
- if (node.isDeclarationFile)
- emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives);
- }
- function emitTripleSlashDirectives(hasNoDefaultLib, files, types, libs2) {
- if (hasNoDefaultLib) {
- const pos = writer.getTextPos();
- writeComment(`/// `);
- if (bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "no-default-lib" /* NoDefaultLib */ });
- writeLine();
- }
- if (currentSourceFile && currentSourceFile.moduleName) {
- writeComment(`/// `);
- writeLine();
- }
- if (currentSourceFile && currentSourceFile.amdDependencies) {
- for (const dep of currentSourceFile.amdDependencies) {
- if (dep.name) {
- writeComment(`/// `);
- } else {
- writeComment(`/// `);
- }
- writeLine();
- }
- }
- for (const directive of files) {
- const pos = writer.getTextPos();
- writeComment(`/// `);
- if (bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
- writeLine();
- }
- for (const directive of types) {
- const pos = writer.getTextPos();
- const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}"` : "";
- writeComment(`/// `);
- if (bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: !directive.resolutionMode ? "type" /* Type */ : directive.resolutionMode === 99 /* ESNext */ ? "type-import" /* TypeResolutionModeImport */ : "type-require" /* TypeResolutionModeRequire */, data: directive.fileName });
- writeLine();
- }
- for (const directive of libs2) {
- const pos = writer.getTextPos();
- writeComment(`/// `);
- if (bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "lib" /* Lib */, data: directive.fileName });
- writeLine();
- }
- }
- function emitSourceFileWorker(node) {
- const statements = node.statements;
- pushNameGenerationScope(node);
- forEach(node.statements, generateNames);
- emitHelpers(node);
- const index = findIndex(statements, (statement) => !isPrologueDirective(statement));
- emitTripleSlashDirectivesIfNeeded(node);
- emitList(
- node,
- statements,
- 1 /* MultiLine */,
- /*parenthesizerRule*/
- void 0,
- index === -1 ? statements.length : index
- );
- popNameGenerationScope(node);
- }
- function emitPartiallyEmittedExpression(node) {
- const emitFlags = getEmitFlags(node);
- if (!(emitFlags & 1024 /* NoLeadingComments */) && node.pos !== node.expression.pos) {
- emitTrailingCommentsOfPosition(node.expression.pos);
- }
- emitExpression(node.expression);
- if (!(emitFlags & 2048 /* NoTrailingComments */) && node.end !== node.expression.end) {
- emitLeadingCommentsOfPosition(node.expression.end);
- }
- }
- function emitCommaList(node) {
- emitExpressionList(
- node,
- node.elements,
- 528 /* CommaListElements */,
- /*parenthesizerRule*/
- void 0
- );
- }
- function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
- let needsToSetSourceFile = !!sourceFile;
- for (let i = 0; i < statements.length; i++) {
- const statement = statements[i];
- if (isPrologueDirective(statement)) {
- const shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true;
- if (shouldEmitPrologueDirective) {
- if (needsToSetSourceFile) {
- needsToSetSourceFile = false;
- setSourceFile(sourceFile);
- }
- writeLine();
- const pos = writer.getTextPos();
- emit(statement);
- if (recordBundleFileSection && bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: statement.expression.text });
- if (seenPrologueDirectives) {
- seenPrologueDirectives.add(statement.expression.text);
- }
- }
- } else {
- return i;
- }
- }
- return statements.length;
- }
- function emitUnparsedPrologues(prologues, seenPrologueDirectives) {
- for (const prologue of prologues) {
- if (!seenPrologueDirectives.has(prologue.data)) {
- writeLine();
- const pos = writer.getTextPos();
- emit(prologue);
- if (bundleFileInfo)
- bundleFileInfo.sections.push({ pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: prologue.data });
- if (seenPrologueDirectives) {
- seenPrologueDirectives.add(prologue.data);
- }
- }
- }
- }
- function emitPrologueDirectivesIfNeeded(sourceFileOrBundle) {
- if (isSourceFile(sourceFileOrBundle)) {
- emitPrologueDirectives(sourceFileOrBundle.statements, sourceFileOrBundle);
- } else {
- const seenPrologueDirectives = /* @__PURE__ */ new Set();
- for (const prepend of sourceFileOrBundle.prepends) {
- emitUnparsedPrologues(prepend.prologues, seenPrologueDirectives);
- }
- for (const sourceFile of sourceFileOrBundle.sourceFiles) {
- emitPrologueDirectives(
- sourceFile.statements,
- sourceFile,
- seenPrologueDirectives,
- /*recordBundleFileSection*/
- true
- );
- }
- setSourceFile(void 0);
- }
- }
- function getPrologueDirectivesFromBundledSourceFiles(bundle) {
- const seenPrologueDirectives = /* @__PURE__ */ new Set();
- let prologues;
- for (let index = 0; index < bundle.sourceFiles.length; index++) {
- const sourceFile = bundle.sourceFiles[index];
- let directives;
- let end = 0;
- for (const statement of sourceFile.statements) {
- if (!isPrologueDirective(statement))
- break;
- if (seenPrologueDirectives.has(statement.expression.text))
- continue;
- seenPrologueDirectives.add(statement.expression.text);
- (directives || (directives = [])).push({
- pos: statement.pos,
- end: statement.end,
- expression: {
- pos: statement.expression.pos,
- end: statement.expression.end,
- text: statement.expression.text
- }
- });
- end = end < statement.end ? statement.end : end;
- }
- if (directives)
- (prologues || (prologues = [])).push({ file: index, text: sourceFile.text.substring(0, end), directives });
- }
- return prologues;
- }
- function emitShebangIfNeeded(sourceFileOrBundle) {
- if (isSourceFile(sourceFileOrBundle) || isUnparsedSource(sourceFileOrBundle)) {
- const shebang = getShebang(sourceFileOrBundle.text);
- if (shebang) {
- writeComment(shebang);
- writeLine();
- return true;
- }
- } else {
- for (const prepend of sourceFileOrBundle.prepends) {
- Debug.assertNode(prepend, isUnparsedSource);
- if (emitShebangIfNeeded(prepend)) {
- return true;
- }
- }
- for (const sourceFile of sourceFileOrBundle.sourceFiles) {
- if (emitShebangIfNeeded(sourceFile)) {
- return true;
- }
- }
- }
- }
- function emitNodeWithWriter(node, writer2) {
- if (!node)
- return;
- const savedWrite = write;
- write = writer2;
- emit(node);
- write = savedWrite;
- }
- function emitDecoratorsAndModifiers(node, modifiers, allowDecorators) {
- if (modifiers == null ? void 0 : modifiers.length) {
- if (every(modifiers, isModifier)) {
- return emitModifierList(node, modifiers);
- }
- if (every(modifiers, isDecorator)) {
- if (allowDecorators) {
- return emitDecoratorList(node, modifiers);
- }
- return node.pos;
- }
- onBeforeEmitNodeArray == null ? void 0 : onBeforeEmitNodeArray(modifiers);
- let lastMode;
- let mode;
- let start = 0;
- let pos = 0;
- let lastModifier;
- while (start < modifiers.length) {
- while (pos < modifiers.length) {
- lastModifier = modifiers[pos];
- mode = isDecorator(lastModifier) ? "decorators" : "modifiers";
- if (lastMode === void 0) {
- lastMode = mode;
- } else if (mode !== lastMode) {
- break;
- }
- pos++;
- }
- const textRange = { pos: -1, end: -1 };
- if (start === 0)
- textRange.pos = modifiers.pos;
- if (pos === modifiers.length - 1)
- textRange.end = modifiers.end;
- if (lastMode === "modifiers" || allowDecorators) {
- emitNodeListItems(
- emit,
- node,
- modifiers,
- lastMode === "modifiers" ? 2359808 /* Modifiers */ : 2146305 /* Decorators */,
- /*parenthesizerRule*/
- void 0,
- start,
- pos - start,
- /*hasTrailingComma*/
- false,
- textRange
- );
- }
- start = pos;
- lastMode = mode;
- pos++;
- }
- onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(modifiers);
- if (lastModifier && !positionIsSynthesized(lastModifier.end)) {
- return lastModifier.end;
- }
- }
- return node.pos;
- }
- function emitModifierList(node, modifiers) {
- emitList(node, modifiers, 2359808 /* Modifiers */);
- const lastModifier = lastOrUndefined(modifiers);
- return lastModifier && !positionIsSynthesized(lastModifier.end) ? lastModifier.end : node.pos;
- }
- function emitTypeAnnotation(node) {
- if (node) {
- writePunctuation(":");
- writeSpace();
- emit(node);
- }
- }
- function emitInitializer(node, equalCommentStartPos, container, parenthesizerRule) {
- if (node) {
- writeSpace();
- emitTokenWithComment(63 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
- writeSpace();
- emitExpression(node, parenthesizerRule);
- }
- }
- function emitNodeWithPrefix(prefix, prefixWriter, node, emit2) {
- if (node) {
- prefixWriter(prefix);
- emit2(node);
- }
- }
- function emitWithLeadingSpace(node) {
- if (node) {
- writeSpace();
- emit(node);
- }
- }
- function emitExpressionWithLeadingSpace(node, parenthesizerRule) {
- if (node) {
- writeSpace();
- emitExpression(node, parenthesizerRule);
- }
- }
- function emitWithTrailingSpace(node) {
- if (node) {
- emit(node);
- writeSpace();
- }
- }
- function emitEmbeddedStatement(parent, node) {
- if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */) {
- writeSpace();
- emit(node);
- } else {
- writeLine();
- increaseIndent();
- if (isEmptyStatement(node)) {
- pipelineEmit(5 /* EmbeddedStatement */, node);
- } else {
- emit(node);
- }
- decreaseIndent();
- }
- }
- function emitDecoratorList(parentNode, decorators) {
- emitList(parentNode, decorators, 2146305 /* Decorators */);
- const lastDecorator = lastOrUndefined(decorators);
- return lastDecorator && !positionIsSynthesized(lastDecorator.end) ? lastDecorator.end : parentNode.pos;
- }
- function emitTypeArguments(parentNode, typeArguments) {
- emitList(parentNode, typeArguments, 53776 /* TypeArguments */, typeArgumentParenthesizerRuleSelector);
- }
- function emitTypeParameters(parentNode, typeParameters) {
- if (isFunctionLike(parentNode) && parentNode.typeArguments) {
- return emitTypeArguments(parentNode, parentNode.typeArguments);
- }
- emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
- }
- function emitParameters(parentNode, parameters) {
- emitList(parentNode, parameters, 2576 /* Parameters */);
- }
- function canEmitSimpleArrowHead(parentNode, parameters) {
- const parameter = singleOrUndefined(parameters);
- return parameter && parameter.pos === parentNode.pos && isArrowFunction(parentNode) && !parentNode.type && !some(parentNode.modifiers) && !some(parentNode.typeParameters) && !some(parameter.modifiers) && !parameter.dotDotDotToken && !parameter.questionToken && !parameter.type && !parameter.initializer && isIdentifier(parameter.name);
- }
- function emitParametersForArrow(parentNode, parameters) {
- if (canEmitSimpleArrowHead(parentNode, parameters)) {
- emitList(parentNode, parameters, 2576 /* Parameters */ & ~2048 /* Parenthesis */);
- } else {
- emitParameters(parentNode, parameters);
- }
- }
- function emitParametersForIndexSignature(parentNode, parameters) {
- emitList(parentNode, parameters, 8848 /* IndexSignatureParameters */);
- }
- function writeDelimiter(format) {
- switch (format & 60 /* DelimitersMask */) {
- case 0 /* None */:
- break;
- case 16 /* CommaDelimited */:
- writePunctuation(",");
- break;
- case 4 /* BarDelimited */:
- writeSpace();
- writePunctuation("|");
- break;
- case 32 /* AsteriskDelimited */:
- writeSpace();
- writePunctuation("*");
- writeSpace();
- break;
- case 8 /* AmpersandDelimited */:
- writeSpace();
- writePunctuation("&");
- break;
- }
- }
- function emitList(parentNode, children, format, parenthesizerRule, start, count) {
- emitNodeList(
- emit,
- parentNode,
- children,
- format | (parentNode && getEmitFlags(parentNode) & 2 /* MultiLine */ ? 65536 /* PreferNewLine */ : 0),
- parenthesizerRule,
- start,
- count
- );
- }
- function emitExpressionList(parentNode, children, format, parenthesizerRule, start, count) {
- emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count);
- }
- function emitNodeList(emit2, parentNode, children, format, parenthesizerRule, start = 0, count = children ? children.length - start : 0) {
- const isUndefined = children === void 0;
- if (isUndefined && format & 16384 /* OptionalIfUndefined */) {
- return;
- }
- const isEmpty = children === void 0 || start >= children.length || count === 0;
- if (isEmpty && format & 32768 /* OptionalIfEmpty */) {
- onBeforeEmitNodeArray == null ? void 0 : onBeforeEmitNodeArray(children);
- onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
- return;
- }
- if (format & 15360 /* BracketsMask */) {
- writePunctuation(getOpeningBracket(format));
- if (isEmpty && children) {
- emitTrailingCommentsOfPosition(
- children.pos,
- /*prefixSpace*/
- true
- );
- }
- }
- onBeforeEmitNodeArray == null ? void 0 : onBeforeEmitNodeArray(children);
- if (isEmpty) {
- if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
- writeLine();
- } else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
- writeSpace();
- }
- } else {
- emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count, children.hasTrailingComma, children);
- }
- onAfterEmitNodeArray == null ? void 0 : onAfterEmitNodeArray(children);
- if (format & 15360 /* BracketsMask */) {
- if (isEmpty && children) {
- emitLeadingCommentsOfPosition(children.end);
- }
- writePunctuation(getClosingBracket(format));
- }
- }
- function emitNodeListItems(emit2, parentNode, children, format, parenthesizerRule, start, count, hasTrailingComma, childrenTextRange) {
- const mayEmitInterveningComments = (format & 262144 /* NoInterveningComments */) === 0;
- let shouldEmitInterveningComments = mayEmitInterveningComments;
- const leadingLineTerminatorCount = getLeadingLineTerminatorCount(parentNode, children[start], format);
- if (leadingLineTerminatorCount) {
- writeLine(leadingLineTerminatorCount);
- shouldEmitInterveningComments = false;
- } else if (format & 256 /* SpaceBetweenBraces */) {
- writeSpace();
- }
- if (format & 128 /* Indented */) {
- increaseIndent();
- }
- const emitListItem = getEmitListItem(emit2, parenthesizerRule);
- let previousSibling;
- let previousSourceFileTextKind;
- let shouldDecreaseIndentAfterEmit = false;
- for (let i = 0; i < count; i++) {
- const child = children[start + i];
- if (format & 32 /* AsteriskDelimited */) {
- writeLine();
- writeDelimiter(format);
- } else if (previousSibling) {
- if (format & 60 /* DelimitersMask */ && previousSibling.end !== (parentNode ? parentNode.end : -1)) {
- const previousSiblingEmitFlags = getEmitFlags(previousSibling);
- if (!(previousSiblingEmitFlags & 2048 /* NoTrailingComments */)) {
- emitLeadingCommentsOfPosition(previousSibling.end);
- }
- }
- writeDelimiter(format);
- recordBundleFileInternalSectionEnd(previousSourceFileTextKind);
- const separatingLineTerminatorCount = getSeparatingLineTerminatorCount(previousSibling, child, format);
- if (separatingLineTerminatorCount > 0) {
- if ((format & (3 /* LinesMask */ | 128 /* Indented */)) === 0 /* SingleLine */) {
- increaseIndent();
- shouldDecreaseIndentAfterEmit = true;
- }
- writeLine(separatingLineTerminatorCount);
- shouldEmitInterveningComments = false;
- } else if (previousSibling && format & 512 /* SpaceBetweenSiblings */) {
- writeSpace();
- }
- }
- previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
- if (shouldEmitInterveningComments) {
- const commentRange = getCommentRange(child);
- emitTrailingCommentsOfPosition(commentRange.pos);
- } else {
- shouldEmitInterveningComments = mayEmitInterveningComments;
- }
- nextListElementPos = child.pos;
- emitListItem(child, emit2, parenthesizerRule, i);
- if (shouldDecreaseIndentAfterEmit) {
- decreaseIndent();
- shouldDecreaseIndentAfterEmit = false;
- }
- previousSibling = child;
- }
- const emitFlags = previousSibling ? getEmitFlags(previousSibling) : 0;
- const skipTrailingComments = commentsDisabled || !!(emitFlags & 2048 /* NoTrailingComments */);
- const emitTrailingComma = hasTrailingComma && format & 64 /* AllowTrailingComma */ && format & 16 /* CommaDelimited */;
- if (emitTrailingComma) {
- if (previousSibling && !skipTrailingComments) {
- emitTokenWithComment(27 /* CommaToken */, previousSibling.end, writePunctuation, previousSibling);
- } else {
- writePunctuation(",");
- }
- }
- if (previousSibling && (parentNode ? parentNode.end : -1) !== previousSibling.end && format & 60 /* DelimitersMask */ && !skipTrailingComments) {
- emitLeadingCommentsOfPosition(emitTrailingComma && (childrenTextRange == null ? void 0 : childrenTextRange.end) ? childrenTextRange.end : previousSibling.end);
- }
- if (format & 128 /* Indented */) {
- decreaseIndent();
- }
- recordBundleFileInternalSectionEnd(previousSourceFileTextKind);
- const closingLineTerminatorCount = getClosingLineTerminatorCount(parentNode, children[start + count - 1], format, childrenTextRange);
- if (closingLineTerminatorCount) {
- writeLine(closingLineTerminatorCount);
- } else if (format & (2097152 /* SpaceAfterList */ | 256 /* SpaceBetweenBraces */)) {
- writeSpace();
- }
- }
- function writeLiteral(s) {
- writer.writeLiteral(s);
- }
- function writeStringLiteral(s) {
- writer.writeStringLiteral(s);
- }
- function writeBase(s) {
- writer.write(s);
- }
- function writeSymbol(s, sym) {
- writer.writeSymbol(s, sym);
- }
- function writePunctuation(s) {
- writer.writePunctuation(s);
- }
- function writeTrailingSemicolon() {
- writer.writeTrailingSemicolon(";");
- }
- function writeKeyword(s) {
- writer.writeKeyword(s);
- }
- function writeOperator(s) {
- writer.writeOperator(s);
- }
- function writeParameter(s) {
- writer.writeParameter(s);
- }
- function writeComment(s) {
- writer.writeComment(s);
- }
- function writeSpace() {
- writer.writeSpace(" ");
- }
- function writeProperty(s) {
- writer.writeProperty(s);
- }
- function nonEscapingWrite(s) {
- if (writer.nonEscapingWrite) {
- writer.nonEscapingWrite(s);
- } else {
- writer.write(s);
- }
- }
- function writeLine(count = 1) {
- for (let i = 0; i < count; i++) {
- writer.writeLine(i > 0);
- }
- }
- function increaseIndent() {
- writer.increaseIndent();
- }
- function decreaseIndent() {
- writer.decreaseIndent();
- }
- function writeToken(token, pos, writer2, contextNode) {
- return !sourceMapsDisabled ? emitTokenWithSourceMap(contextNode, token, writer2, pos, writeTokenText) : writeTokenText(token, writer2, pos);
- }
- function writeTokenNode(node, writer2) {
- if (onBeforeEmitToken) {
- onBeforeEmitToken(node);
- }
- writer2(tokenToString(node.kind));
- if (onAfterEmitToken) {
- onAfterEmitToken(node);
- }
- }
- function writeTokenText(token, writer2, pos) {
- const tokenString = tokenToString(token);
- writer2(tokenString);
- return pos < 0 ? pos : pos + tokenString.length;
- }
- function writeLineOrSpace(parentNode, prevChildNode, nextChildNode) {
- if (getEmitFlags(parentNode) & 1 /* SingleLine */) {
- writeSpace();
- } else if (preserveSourceNewlines) {
- const lines = getLinesBetweenNodes(parentNode, prevChildNode, nextChildNode);
- if (lines) {
- writeLine(lines);
- } else {
- writeSpace();
- }
- } else {
- writeLine();
- }
- }
- function writeLines(text) {
- const lines = text.split(/\r\n?|\n/g);
- const indentation = guessIndentation(lines);
- for (const lineText of lines) {
- const line = indentation ? lineText.slice(indentation) : lineText;
- if (line.length) {
- writeLine();
- write(line);
- }
- }
- }
- function writeLinesAndIndent(lineCount, writeSpaceIfNotIndenting) {
- if (lineCount) {
- increaseIndent();
- writeLine(lineCount);
- } else if (writeSpaceIfNotIndenting) {
- writeSpace();
- }
- }
- function decreaseIndentIf(value1, value2) {
- if (value1) {
- decreaseIndent();
- }
- if (value2) {
- decreaseIndent();
- }
- }
- function getLeadingLineTerminatorCount(parentNode, firstChild, format) {
- if (format & 2 /* PreserveLines */ || preserveSourceNewlines) {
- if (format & 65536 /* PreferNewLine */) {
- return 1;
- }
- if (firstChild === void 0) {
- return !parentNode || currentSourceFile && rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
- }
- if (firstChild.pos === nextListElementPos) {
- return 0;
- }
- if (firstChild.kind === 11 /* JsxText */) {
- return 0;
- }
- if (currentSourceFile && parentNode && !positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(firstChild) && (!firstChild.parent || getOriginalNode(firstChild.parent) === getOriginalNode(parentNode))) {
- if (preserveSourceNewlines) {
- return getEffectiveLines(
- (includeComments) => getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(
- firstChild.pos,
- parentNode.pos,
- currentSourceFile,
- includeComments
- )
- );
- }
- return rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile) ? 0 : 1;
- }
- if (synthesizedNodeStartsOnNewLine(firstChild, format)) {
- return 1;
- }
- }
- return format & 1 /* MultiLine */ ? 1 : 0;
- }
- function getSeparatingLineTerminatorCount(previousNode, nextNode, format) {
- if (format & 2 /* PreserveLines */ || preserveSourceNewlines) {
- if (previousNode === void 0 || nextNode === void 0) {
- return 0;
- }
- if (nextNode.kind === 11 /* JsxText */) {
- return 0;
- } else if (currentSourceFile && !nodeIsSynthesized(previousNode) && !nodeIsSynthesized(nextNode)) {
- if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
- return getEffectiveLines(
- (includeComments) => getLinesBetweenRangeEndAndRangeStart(
- previousNode,
- nextNode,
- currentSourceFile,
- includeComments
- )
- );
- } else if (!preserveSourceNewlines && originalNodesHaveSameParent(previousNode, nextNode)) {
- return rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile) ? 0 : 1;
- }
- return format & 65536 /* PreferNewLine */ ? 1 : 0;
- } else if (synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format)) {
- return 1;
- }
- } else if (getStartsOnNewLine(nextNode)) {
- return 1;
- }
- return format & 1 /* MultiLine */ ? 1 : 0;
- }
- function getClosingLineTerminatorCount(parentNode, lastChild, format, childrenTextRange) {
- if (format & 2 /* PreserveLines */ || preserveSourceNewlines) {
- if (format & 65536 /* PreferNewLine */) {
- return 1;
- }
- if (lastChild === void 0) {
- return !parentNode || currentSourceFile && rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
- }
- if (currentSourceFile && parentNode && !positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
- if (preserveSourceNewlines) {
- const end = childrenTextRange && !positionIsSynthesized(childrenTextRange.end) ? childrenTextRange.end : lastChild.end;
- return getEffectiveLines(
- (includeComments) => getLinesBetweenPositionAndNextNonWhitespaceCharacter(
- end,
- parentNode.end,
- currentSourceFile,
- includeComments
- )
- );
- }
- return rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile) ? 0 : 1;
- }
- if (synthesizedNodeStartsOnNewLine(lastChild, format)) {
- return 1;
- }
- }
- if (format & 1 /* MultiLine */ && !(format & 131072 /* NoTrailingNewLine */)) {
- return 1;
- }
- return 0;
- }
- function getEffectiveLines(getLineDifference) {
- Debug.assert(!!preserveSourceNewlines);
- const lines = getLineDifference(
- /*includeComments*/
- true
- );
- if (lines === 0) {
- return getLineDifference(
- /*includeComments*/
- false
- );
- }
- return lines;
- }
- function writeLineSeparatorsAndIndentBefore(node, parent) {
- const leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, node, 0 /* None */);
- if (leadingNewlines) {
- writeLinesAndIndent(
- leadingNewlines,
- /*writeSpaceIfNotIndenting*/
- false
- );
- }
- return !!leadingNewlines;
- }
- function writeLineSeparatorsAfter(node, parent) {
- const trailingNewlines = preserveSourceNewlines && getClosingLineTerminatorCount(
- parent,
- node,
- 0 /* None */,
- /*childrenTextRange*/
- void 0
- );
- if (trailingNewlines) {
- writeLine(trailingNewlines);
- }
- }
- function synthesizedNodeStartsOnNewLine(node, format) {
- if (nodeIsSynthesized(node)) {
- const startsOnNewLine = getStartsOnNewLine(node);
- if (startsOnNewLine === void 0) {
- return (format & 65536 /* PreferNewLine */) !== 0;
- }
- return startsOnNewLine;
- }
- return (format & 65536 /* PreferNewLine */) !== 0;
- }
- function getLinesBetweenNodes(parent, node1, node2) {
- if (getEmitFlags(parent) & 262144 /* NoIndentation */) {
- return 0;
- }
- parent = skipSynthesizedParentheses(parent);
- node1 = skipSynthesizedParentheses(node1);
- node2 = skipSynthesizedParentheses(node2);
- if (getStartsOnNewLine(node2)) {
- return 1;
- }
- if (currentSourceFile && !nodeIsSynthesized(parent) && !nodeIsSynthesized(node1) && !nodeIsSynthesized(node2)) {
- if (preserveSourceNewlines) {
- return getEffectiveLines(
- (includeComments) => getLinesBetweenRangeEndAndRangeStart(
- node1,
- node2,
- currentSourceFile,
- includeComments
- )
- );
- }
- return rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile) ? 0 : 1;
- }
- return 0;
- }
- function isEmptyBlock(block) {
- return block.statements.length === 0 && (!currentSourceFile || rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
- }
- function skipSynthesizedParentheses(node) {
- while (node.kind === 214 /* ParenthesizedExpression */ && nodeIsSynthesized(node)) {
- node = node.expression;
- }
- return node;
- }
- function getTextOfNode2(node, includeTrivia) {
- if (isGeneratedIdentifier(node) || isGeneratedPrivateIdentifier(node)) {
- return generateName(node);
- }
- if (isStringLiteral(node) && node.textSourceNode) {
- return getTextOfNode2(node.textSourceNode, includeTrivia);
- }
- const sourceFile = currentSourceFile;
- const canUseSourceFile = !!sourceFile && !!node.parent && !nodeIsSynthesized(node);
- if (isMemberName(node)) {
- if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
- return idText(node);
- }
- } else {
- Debug.assertNode(node, isLiteralExpression);
- if (!canUseSourceFile) {
- return node.text;
- }
- }
- return getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
- }
- function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
- if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
- const textSourceNode = node.textSourceNode;
- if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
- const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
- return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
- } else {
- return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
- }
- }
- const flags = (neverAsciiEscape ? 1 /* NeverAsciiEscape */ : 0) | (jsxAttributeEscape ? 2 /* JsxAttributeEscape */ : 0) | (printerOptions.terminateUnterminatedLiterals ? 4 /* TerminateUnterminatedLiterals */ : 0) | (printerOptions.target && printerOptions.target === 99 /* ESNext */ ? 8 /* AllowNumericSeparator */ : 0);
- return getLiteralText(node, currentSourceFile, flags);
- }
- function pushNameGenerationScope(node) {
- if (node && getEmitFlags(node) & 1048576 /* ReuseTempVariableScope */) {
- return;
- }
- tempFlagsStack.push(tempFlags);
- tempFlags = TempFlags.Auto;
- formattedNameTempFlagsStack.push(formattedNameTempFlags);
- formattedNameTempFlags = void 0;
- reservedNamesStack.push(reservedNames);
- }
- function popNameGenerationScope(node) {
- if (node && getEmitFlags(node) & 1048576 /* ReuseTempVariableScope */) {
- return;
- }
- tempFlags = tempFlagsStack.pop();
- formattedNameTempFlags = formattedNameTempFlagsStack.pop();
- reservedNames = reservedNamesStack.pop();
- }
- function reserveNameInNestedScopes(name) {
- if (!reservedNames || reservedNames === lastOrUndefined(reservedNamesStack)) {
- reservedNames = /* @__PURE__ */ new Set();
- }
- reservedNames.add(name);
- }
- function pushPrivateNameGenerationScope(newPrivateNameTempFlags, newReservedMemberNames) {
- privateNameTempFlagsStack.push(privateNameTempFlags);
- privateNameTempFlags = newPrivateNameTempFlags;
- reservedPrivateNamesStack.push(reservedNames);
- reservedPrivateNames = newReservedMemberNames;
- }
- function popPrivateNameGenerationScope() {
- privateNameTempFlags = privateNameTempFlagsStack.pop();
- reservedPrivateNames = reservedPrivateNamesStack.pop();
- }
- function reservePrivateNameInNestedScopes(name) {
- if (!reservedPrivateNames || reservedPrivateNames === lastOrUndefined(reservedPrivateNamesStack)) {
- reservedPrivateNames = /* @__PURE__ */ new Set();
- }
- reservedPrivateNames.add(name);
- }
- function generateNames(node) {
- if (!node)
- return;
- switch (node.kind) {
- case 238 /* Block */:
- forEach(node.statements, generateNames);
- break;
- case 253 /* LabeledStatement */:
- case 251 /* WithStatement */:
- case 243 /* DoStatement */:
- case 244 /* WhileStatement */:
- generateNames(node.statement);
- break;
- case 242 /* IfStatement */:
- generateNames(node.thenStatement);
- generateNames(node.elseStatement);
- break;
- case 245 /* ForStatement */:
- case 247 /* ForOfStatement */:
- case 246 /* ForInStatement */:
- generateNames(node.initializer);
- generateNames(node.statement);
- break;
- case 252 /* SwitchStatement */:
- generateNames(node.caseBlock);
- break;
- case 266 /* CaseBlock */:
- forEach(node.clauses, generateNames);
- break;
- case 292 /* CaseClause */:
- case 293 /* DefaultClause */:
- forEach(node.statements, generateNames);
- break;
- case 255 /* TryStatement */:
- generateNames(node.tryBlock);
- generateNames(node.catchClause);
- generateNames(node.finallyBlock);
- break;
- case 295 /* CatchClause */:
- generateNames(node.variableDeclaration);
- generateNames(node.block);
- break;
- case 240 /* VariableStatement */:
- generateNames(node.declarationList);
- break;
- case 258 /* VariableDeclarationList */:
- forEach(node.declarations, generateNames);
- break;
- case 257 /* VariableDeclaration */:
- case 166 /* Parameter */:
- case 205 /* BindingElement */:
- case 260 /* ClassDeclaration */:
- generateNameIfNeeded(node.name);
- break;
- case 259 /* FunctionDeclaration */:
- generateNameIfNeeded(node.name);
- if (getEmitFlags(node) & 1048576 /* ReuseTempVariableScope */) {
- forEach(node.parameters, generateNames);
- generateNames(node.body);
- }
- break;
- case 203 /* ObjectBindingPattern */:
- case 204 /* ArrayBindingPattern */:
- forEach(node.elements, generateNames);
- break;
- case 269 /* ImportDeclaration */:
- generateNames(node.importClause);
- break;
- case 270 /* ImportClause */:
- generateNameIfNeeded(node.name);
- generateNames(node.namedBindings);
- break;
- case 271 /* NamespaceImport */:
- generateNameIfNeeded(node.name);
- break;
- case 277 /* NamespaceExport */:
- generateNameIfNeeded(node.name);
- break;
- case 272 /* NamedImports */:
- forEach(node.elements, generateNames);
- break;
- case 273 /* ImportSpecifier */:
- generateNameIfNeeded(node.propertyName || node.name);
- break;
- }
- }
- function generateMemberNames(node) {
- if (!node)
- return;
- switch (node.kind) {
- case 299 /* PropertyAssignment */:
- case 300 /* ShorthandPropertyAssignment */:
- case 169 /* PropertyDeclaration */:
- case 171 /* MethodDeclaration */:
- case 174 /* GetAccessor */:
- case 175 /* SetAccessor */:
- generateNameIfNeeded(node.name);
- break;
- }
- }
- function generateNameIfNeeded(name) {
- if (name) {
- if (isGeneratedIdentifier(name) || isGeneratedPrivateIdentifier(name)) {
- generateName(name);
- } else if (isBindingPattern(name)) {
- generateNames(name);
- }
- }
- }
- function generateName(name) {
- const autoGenerate = name.emitNode.autoGenerate;
- if ((autoGenerate.flags & 7 /* KindMask */) === 4 /* Node */) {
- return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), autoGenerate.flags, autoGenerate.prefix, autoGenerate.suffix);
- } else {
- const autoGenerateId = autoGenerate.id;
- return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name));
- }
- }
- function generateNameCached(node, privateName, flags, prefix, suffix) {
- const nodeId = getNodeId(node);
- const cache = privateName ? nodeIdToGeneratedPrivateName : nodeIdToGeneratedName;
- return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
- }
- function isUniqueName(name, privateName) {
- return isFileLevelUniqueName2(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
- }
- function isReservedName(name, privateName) {
- return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name));
- }
- function isFileLevelUniqueName2(name, _isPrivate) {
- return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true;
- }
- function isUniqueLocalName(name, container) {
- for (let node = container; node && isNodeDescendantOf(node, container); node = node.nextContainer) {
- if (canHaveLocals(node) && node.locals) {
- const local = node.locals.get(escapeLeadingUnderscores(name));
- if (local && local.flags & (111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */)) {
- return false;
- }
- }
- }
- return true;
- }
- function getTempFlags(formattedNameKey) {
- var _a2;
- switch (formattedNameKey) {
- case "":
- return tempFlags;
- case "#":
- return privateNameTempFlags;
- default:
- return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : TempFlags.Auto;
- }
- }
- function setTempFlags(formattedNameKey, flags) {
- switch (formattedNameKey) {
- case "":
- tempFlags = flags;
- break;
- case "#":
- privateNameTempFlags = flags;
- break;
- default:
- formattedNameTempFlags != null ? formattedNameTempFlags : formattedNameTempFlags = /* @__PURE__ */ new Map();
- formattedNameTempFlags.set(formattedNameKey, flags);
- break;
- }
- }
- function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) {
- if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* hash */) {
- prefix = prefix.slice(1);
- }
- const key = formatGeneratedName(privateName, prefix, "", suffix);
- let tempFlags2 = getTempFlags(key);
- if (flags && !(tempFlags2 & flags)) {
- const name = flags === TempFlags._i ? "_i" : "_n";
- const fullName = formatGeneratedName(privateName, prefix, name, suffix);
- if (isUniqueName(fullName, privateName)) {
- tempFlags2 |= flags;
- if (privateName) {
- reservePrivateNameInNestedScopes(fullName);
- } else if (reservedInNestedScopes) {
- reserveNameInNestedScopes(fullName);
- }
- setTempFlags(key, tempFlags2);
- return fullName;
- }
- }
- while (true) {
- const count = tempFlags2 & TempFlags.CountMask;
- tempFlags2++;
- if (count !== 8 && count !== 13) {
- const name = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
- const fullName = formatGeneratedName(privateName, prefix, name, suffix);
- if (isUniqueName(fullName, privateName)) {
- if (privateName) {
- reservePrivateNameInNestedScopes(fullName);
- } else if (reservedInNestedScopes) {
- reserveNameInNestedScopes(fullName);
- }
- setTempFlags(key, tempFlags2);
- return fullName;
- }
- }
- }
- }
- function makeUniqueName(baseName, checkFn = isUniqueName, optimistic, scoped, privateName, prefix, suffix) {
- if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* hash */) {
- baseName = baseName.slice(1);
- }
- if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* hash */) {
- prefix = prefix.slice(1);
- }
- if (optimistic) {
- const fullName = formatGeneratedName(privateName, prefix, baseName, suffix);
- if (checkFn(fullName, privateName)) {
- if (privateName) {
- reservePrivateNameInNestedScopes(fullName);
- } else if (scoped) {
- reserveNameInNestedScopes(fullName);
- } else {
- generatedNames.add(fullName);
- }
- return fullName;
- }
- }
- if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) {
- baseName += "_";
- }
- let i = 1;
- while (true) {
- const fullName = formatGeneratedName(privateName, prefix, baseName + i, suffix);
- if (checkFn(fullName, privateName)) {
- if (privateName) {
- reservePrivateNameInNestedScopes(fullName);
- } else if (scoped) {
- reserveNameInNestedScopes(fullName);
- } else {
- generatedNames.add(fullName);
- }
- return fullName;
- }
- i++;
- }
- }
- function makeFileLevelOptimisticUniqueName(name) {
- return makeUniqueName(
- name,
- isFileLevelUniqueName2,
- /*optimistic*/
- true,
- /*scoped*/
- false,
- /*privateName*/
- false,
- /*prefix*/
- "",
- /*suffix*/
- ""
- );
- }
- function generateNameForModuleOrEnum(node) {
- const name = getTextOfNode2(node.name);
- return isUniqueLocalName(name, tryCast(node, canHaveLocals)) ? name : makeUniqueName(
- name,
- isUniqueName,
- /*optimistic*/
- false,
- /*scoped*/
- false,
- /*privateName*/
- false,
- /*prefix*/
- "",
- /*suffix*/
- ""
- );
- }
- function generateNameForImportOrExportDeclaration(node) {
- const expr = getExternalModuleName(node);
- const baseName = isStringLiteral(expr) ? makeIdentifierFromModuleName(expr.text) : "module";
- return makeUniqueName(
- baseName,
- isUniqueName,
- /*optimistic*/
- false,
- /*scoped*/
- false,
- /*privateName*/
- false,
- /*prefix*/
- "",
- /*suffix*/
- ""
- );
- }
- function generateNameForExportDefault() {
- return makeUniqueName(
- "default",
- isUniqueName,
- /*optimistic*/
- false,
- /*scoped*/
- false,
- /*privateName*/
- false,
- /*prefix*/
- "",
- /*suffix*/
- ""
- );
- }
- function generateNameForClassExpression() {
- return makeUniqueName(
- "class",
- isUniqueName,
- /*optimistic*/
- false,
- /*scoped*/
- false,
- /*privateName*/
- false,
- /*prefix*/
- "",
- /*suffix*/
- ""
- );
- }
- function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) {
- if (isIdentifier(node.name)) {
- return generateNameCached(node.name, privateName);
- }
- return makeTempVariableName(
- TempFlags.Auto,
- /*reservedInNestedScopes*/
- false,
- privateName,
- prefix,
- suffix
- );
- }
- function generateNameForNode(node, privateName, flags, prefix, suffix) {
- switch (node.kind) {
- case 79 /* Identifier */:
- case 80 /* PrivateIdentifier */:
- return makeUniqueName(
- getTextOfNode2(node),
- isUniqueName,
- !!(flags & 16 /* Optimistic */),
- !!(flags & 8 /* ReservedInNestedScopes */),
- privateName,
- prefix,
- suffix
- );
- case 264 /* ModuleDeclaration */:
- case 263 /* EnumDeclaration */:
- Debug.assert(!prefix && !suffix && !privateName);
- return generateNameForModuleOrEnum(node);
- case 269 /* ImportDeclaration */:
- case 275 /* ExportDeclaration */:
- Debug.assert(!prefix && !suffix && !privateName);
- return generateNameForImportOrExportDeclaration(node);
- case 259 /* FunctionDeclaration */:
- case 260 /* ClassDeclaration */: {
- Debug.assert(!prefix && !suffix && !privateName);
- const name = node.name;
- if (name && !isGeneratedIdentifier(name)) {
- return generateNameForNode(
- name,
- /*privateName*/
- false,
- flags,
- prefix,
- suffix
- );
- }
- return generateNameForExportDefault();
- }
- case 274 /* ExportAssignment */:
- Debug.assert(!prefix && !suffix && !privateName);
- return generateNameForExportDefault();
- case 228 /* ClassExpression */:
- Debug.assert(!prefix && !suffix && !privateName);
- return generateNameForClassExpression();
- case 171 /* MethodDeclaration */:
- case 174 /* GetAccessor */:
- case 175 /* SetAccessor */:
- return generateNameForMethodOrAccessor(node, privateName, prefix, suffix);
- case 164 /* ComputedPropertyName */:
- return makeTempVariableName(
- TempFlags.Auto,
- /*reserveInNestedScopes*/
- true,
- privateName,
- prefix,
- suffix
- );
- default:
- return makeTempVariableName(
- TempFlags.Auto,
- /*reserveInNestedScopes*/
- false,
- privateName,
- prefix,
- suffix
- );
- }
- }
- function makeName(name) {
- const autoGenerate = name.emitNode.autoGenerate;
- const prefix = formatGeneratedNamePart(autoGenerate.prefix, generateName);
- const suffix = formatGeneratedNamePart(autoGenerate.suffix);
- switch (autoGenerate.flags & 7 /* KindMask */) {
- case 1 /* Auto */:
- return makeTempVariableName(TempFlags.Auto, !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), prefix, suffix);
- case 2 /* Loop */:
- Debug.assertNode(name, isIdentifier);
- return makeTempVariableName(
- TempFlags._i,
- !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
- /*privateName*/
- false,
- prefix,
- suffix
- );
- case 3 /* Unique */:
- return makeUniqueName(
- idText(name),
- autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName,
- !!(autoGenerate.flags & 16 /* Optimistic */),
- !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */),
- isPrivateIdentifier(name),
- prefix,
- suffix
- );
- }
- return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(
- autoGenerate.flags & 7 /* KindMask */,
- GeneratedIdentifierFlags,
- /*isFlags*/
- true
- )}.`);
- }
- function pipelineEmitWithComments(hint, node) {
- const pipelinePhase = getNextPipelinePhase(2 /* Comments */, hint, node);
- const savedContainerPos = containerPos;
- const savedContainerEnd = containerEnd;
- const savedDeclarationListContainerEnd = declarationListContainerEnd;
- emitCommentsBeforeNode(node);
- pipelinePhase(hint, node);
- emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
- }
- function emitCommentsBeforeNode(node) {
- const emitFlags = getEmitFlags(node);
- const commentRange = getCommentRange(node);
- emitLeadingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end);
- if (emitFlags & 4096 /* NoNestedComments */) {
- commentsDisabled = true;
- }
- }
- function emitCommentsAfterNode(node, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) {
- const emitFlags = getEmitFlags(node);
- const commentRange = getCommentRange(node);
- if (emitFlags & 4096 /* NoNestedComments */) {
- commentsDisabled = false;
- }
- emitTrailingCommentsOfNode(node, emitFlags, commentRange.pos, commentRange.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
- const typeNode = getTypeNode(node);
- if (typeNode) {
- emitTrailingCommentsOfNode(node, emitFlags, typeNode.pos, typeNode.end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd);
- }
- }
- function emitLeadingCommentsOfNode(node, emitFlags, pos, end) {
- enterComment();
- hasWrittenComment = false;
- const skipLeadingComments = pos < 0 || (emitFlags & 1024 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
- const skipTrailingComments = end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0 || node.kind === 11 /* JsxText */;
- if ((pos > 0 || end > 0) && pos !== end) {
- if (!skipLeadingComments) {
- emitLeadingComments(
- pos,
- /*isEmittedNode*/
- node.kind !== 355 /* NotEmittedStatement */
- );
- }
- if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) {
- containerPos = pos;
- }
- if (!skipTrailingComments || end >= 0 && (emitFlags & 2048 /* NoTrailingComments */) !== 0) {
- containerEnd = end;
- if (node.kind === 258 /* VariableDeclarationList */) {
- declarationListContainerEnd = end;
- }
- }
- }
- forEach(getSyntheticLeadingComments(node), emitLeadingSynthesizedComment);
- exitComment();
- }
- function emitTrailingCommentsOfNode(node, emitFlags, pos, end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) {
- enterComment();
- const skipTrailingComments = end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0 || node.kind === 11 /* JsxText */;
- forEach(getSyntheticTrailingComments(node), emitTrailingSynthesizedComment);
- if ((pos > 0 || end > 0) && pos !== end) {
- containerPos = savedContainerPos;
- containerEnd = savedContainerEnd;
- declarationListContainerEnd = savedDeclarationListContainerEnd;
- if (!skipTrailingComments && node.kind !== 355 /* NotEmittedStatement */) {
- emitTrailingComments(end);
- }
- }
- exitComment();
- }
- function emitLeadingSynthesizedComment(comment) {
- if (comment.hasLeadingNewline || comment.kind === 2 /* SingleLineCommentTrivia */) {
- writer.writeLine();
- }
- writeSynthesizedComment(comment);
- if (comment.hasTrailingNewLine || comment.kind === 2 /* SingleLineCommentTrivia */) {
- writer.writeLine();
- } else {
- writer.writeSpace(" ");
- }
- }
- function emitTrailingSynthesizedComment(comment) {
- if (!writer.isAtStartOfLine()) {
- writer.writeSpace(" ");
- }
- writeSynthesizedComment(comment);
- if (comment.hasTrailingNewLine) {
- writer.writeLine();
- }
- }
- function writeSynthesizedComment(comment) {
- const text = formatSynthesizedComment(comment);
- const lineMap = comment.kind === 3 /* MultiLineCommentTrivia */ ? computeLineStarts(text) : void 0;
- writeCommentRange(text, lineMap, writer, 0, text.length, newLine);
- }
- function formatSynthesizedComment(comment) {
- return comment.kind === 3 /* MultiLineCommentTrivia */ ? `/*${comment.text}*/` : `//${comment.text}`;
- }
- function emitBodyWithDetachedComments(node, detachedRange, emitCallback) {
- enterComment();
- const { pos, end } = detachedRange;
- const emitFlags = getEmitFlags(node);
- const skipLeadingComments = pos < 0 || (emitFlags & 1024 /* NoLeadingComments */) !== 0;
- const skipTrailingComments = commentsDisabled || end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0;
- if (!skipLeadingComments) {
- emitDetachedCommentsAndUpdateCommentsInfo(detachedRange);
- }
- exitComment();
- if (emitFlags & 4096 /* NoNestedComments */ && !commentsDisabled) {
- commentsDisabled = true;
- emitCallback(node);
- commentsDisabled = false;
- } else {
- emitCallback(node);
- }
- enterComment();
- if (!skipTrailingComments) {
- emitLeadingComments(
- detachedRange.end,
- /*isEmittedNode*/
- true
- );
- if (hasWrittenComment && !writer.isAtStartOfLine()) {
- writer.writeLine();
- }
- }
- exitComment();
- }
- function originalNodesHaveSameParent(nodeA, nodeB) {
- nodeA = getOriginalNode(nodeA);
- return nodeA.parent && nodeA.parent === getOriginalNode(nodeB).parent;
- }
- function siblingNodePositionsAreComparable(previousNode, nextNode) {
- if (nextNode.pos < previousNode.end) {
- return false;
- }
- previousNode = getOriginalNode(previousNode);
- nextNode = getOriginalNode(nextNode);
- const parent = previousNode.parent;
- if (!parent || parent !== nextNode.parent) {
- return false;
- }
- const parentNodeArray = getContainingNodeArray(previousNode);
- const prevNodeIndex = parentNodeArray == null ? void 0 : parentNodeArray.indexOf(previousNode);
- return prevNodeIndex !== void 0 && prevNodeIndex > -1 && parentNodeArray.indexOf(nextNode) === prevNodeIndex + 1;
- }
- function emitLeadingComments(pos, isEmittedNode) {
- hasWrittenComment = false;
- if (isEmittedNode) {
- if (pos === 0 && (currentSourceFile == null ? void 0 : currentSourceFile.isDeclarationFile)) {
- forEachLeadingCommentToEmit(pos, emitNonTripleSlashLeadingComment);
- } else {
- forEachLeadingCommentToEmit(pos, emitLeadingComment);
- }
- } else if (pos === 0) {
- forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment);
- }
- }
- function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
- if (isTripleSlashComment(commentPos, commentEnd)) {
- emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);
- }
- }
- function emitNonTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
- if (!isTripleSlashComment(commentPos, commentEnd)) {
- emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos);
- }
- }
- function shouldWriteComment(text, pos) {
- if (printerOptions.onlyPrintJsDocStyle) {
- return isJSDocLikeText(text, pos) || isPinnedComment(text, pos);
- }
- return true;
- }
- function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
- if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
- return;
- if (!hasWrittenComment) {
- emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
- hasWrittenComment = true;
- }
- emitPos(commentPos);
- writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
- emitPos(commentEnd);
- if (hasTrailingNewLine) {
- writer.writeLine();
- } else if (kind === 3 /* MultiLineCommentTrivia */) {
- writer.writeSpace(" ");
- }
- }
- function emitLeadingCommentsOfPosition(pos) {
- if (commentsDisabled || pos === -1) {
- return;
- }
- emitLeadingComments(
- pos,
- /*isEmittedNode*/
- true
- );
- }
- function emitTrailingComments(pos) {
- forEachTrailingCommentToEmit(pos, emitTrailingComment);
- }
- function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
- if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
- return;
- if (!writer.isAtStartOfLine()) {
- writer.writeSpace(" ");
- }
- emitPos(commentPos);
- writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
- emitPos(commentEnd);
- if (hasTrailingNewLine) {
- writer.writeLine();
- }
- }
- function emitTrailingCommentsOfPosition(pos, prefixSpace, forceNoNewline) {
- if (commentsDisabled) {
- return;
- }
- enterComment();
- forEachTrailingCommentToEmit(pos, prefixSpace ? emitTrailingComment : forceNoNewline ? emitTrailingCommentOfPositionNoNewline : emitTrailingCommentOfPosition);
- exitComment();
- }
- function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
- if (!currentSourceFile)
- return;
- emitPos(commentPos);
- writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
- emitPos(commentEnd);
- if (kind === 2 /* SingleLineCommentTrivia */) {
- writer.writeLine();
- }
- }
- function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
- if (!currentSourceFile)
- return;
- emitPos(commentPos);
- writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
- emitPos(commentEnd);
- if (hasTrailingNewLine) {
- writer.writeLine();
- } else {
- writer.writeSpace(" ");
- }
- }
- function forEachLeadingCommentToEmit(pos, cb) {
- if (currentSourceFile && (containerPos === -1 || pos !== containerPos)) {
- if (hasDetachedComments(pos)) {
- forEachLeadingCommentWithoutDetachedComments(cb);
- } else {
- forEachLeadingCommentRange(
- currentSourceFile.text,
- pos,
- cb,
- /*state*/
- pos
- );
- }
- }
- }
- function forEachTrailingCommentToEmit(end, cb) {
- if (currentSourceFile && (containerEnd === -1 || end !== containerEnd && end !== declarationListContainerEnd)) {
- forEachTrailingCommentRange(currentSourceFile.text, end, cb);
- }
- }
- function hasDetachedComments(pos) {
- return detachedCommentsInfo !== void 0 && last(detachedCommentsInfo).nodePos === pos;
- }
- function forEachLeadingCommentWithoutDetachedComments(cb) {
- if (!currentSourceFile)
- return;
- const pos = last(detachedCommentsInfo).detachedCommentEndPos;
- if (detachedCommentsInfo.length - 1) {
- detachedCommentsInfo.pop();
- } else {
- detachedCommentsInfo = void 0;
- }
- forEachLeadingCommentRange(
- currentSourceFile.text,
- pos,
- cb,
- /*state*/
- pos
- );
- }
- function emitDetachedCommentsAndUpdateCommentsInfo(range) {
- const currentDetachedCommentInfo = currentSourceFile && emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
- if (currentDetachedCommentInfo) {
- if (detachedCommentsInfo) {
- detachedCommentsInfo.push(currentDetachedCommentInfo);
- } else {
- detachedCommentsInfo = [currentDetachedCommentInfo];
- }
- }
- }
- function emitComment(text, lineMap, writer2, commentPos, commentEnd, newLine2) {
- if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
- return;
- emitPos(commentPos);
- writeCommentRange(text, lineMap, writer2, commentPos, commentEnd, newLine2);
- emitPos(commentEnd);
- }
- function isTripleSlashComment(commentPos, commentEnd) {
- return !!currentSourceFile && isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
- }
- function getParsedSourceMap(node) {
- if (node.parsedSourceMap === void 0 && node.sourceMapText !== void 0) {
- node.parsedSourceMap = tryParseRawSourceMap(node.sourceMapText) || false;
- }
- return node.parsedSourceMap || void 0;
- }
- function pipelineEmitWithSourceMaps(hint, node) {
- const pipelinePhase = getNextPipelinePhase(3 /* SourceMaps */, hint, node);
- emitSourceMapsBeforeNode(node);
- pipelinePhase(hint, node);
- emitSourceMapsAfterNode(node);
- }
- function emitSourceMapsBeforeNode(node) {
- const emitFlags = getEmitFlags(node);
- const sourceMapRange = getSourceMapRange(node);
- if (isUnparsedNode(node)) {
- Debug.assertIsDefined(node.parent, "UnparsedNodes must have parent pointers");
- const parsed = getParsedSourceMap(node.parent);
- if (parsed && sourceMapGenerator) {
- sourceMapGenerator.appendSourceMap(
- writer.getLine(),
- writer.getColumn(),
- parsed,
- node.parent.sourceMapPath,
- node.parent.getLineAndCharacterOfPosition(node.pos),
- node.parent.getLineAndCharacterOfPosition(node.end)
- );
- }
- } else {
- const source = sourceMapRange.source || sourceMapSource;
- if (node.kind !== 355 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
- emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
- }
- if (emitFlags & 128 /* NoNestedSourceMaps */) {
- sourceMapsDisabled = true;
- }
- }
- }
- function emitSourceMapsAfterNode(node) {
- const emitFlags = getEmitFlags(node);
- const sourceMapRange = getSourceMapRange(node);
- if (!isUnparsedNode(node)) {
- if (emitFlags & 128 /* NoNestedSourceMaps */) {
- sourceMapsDisabled = false;
- }
- if (node.kind !== 355 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
- emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
- }
- }
- }
- function skipSourceTrivia(source, pos) {
- return source.skipTrivia ? source.skipTrivia(pos) : skipTrivia(source.text, pos);
- }
- function emitPos(pos) {
- if (sourceMapsDisabled || positionIsSynthesized(pos) || isJsonSourceMapSource(sourceMapSource)) {
- return;
- }
- const { line: sourceLine, character: sourceCharacter } = getLineAndCharacterOfPosition(sourceMapSource, pos);
- sourceMapGenerator.addMapping(
- writer.getLine(),
- writer.getColumn(),
- sourceMapSourceIndex,
- sourceLine,
- sourceCharacter,
- /*nameIndex*/
- void 0
- );
- }
- function emitSourcePos(source, pos) {
- if (source !== sourceMapSource) {
- const savedSourceMapSource = sourceMapSource;
- const savedSourceMapSourceIndex = sourceMapSourceIndex;
- setSourceMapSource(source);
- emitPos(pos);
- resetSourceMapSource(savedSourceMapSource, savedSourceMapSourceIndex);
- } else {
- emitPos(pos);
- }
- }
- function emitTokenWithSourceMap(node, token, writer2, tokenPos, emitCallback) {
- if (sourceMapsDisabled || node && isInJsonFile(node)) {
- return emitCallback(token, writer2, tokenPos);
- }
- const emitNode = node && node.emitNode;
- const emitFlags = emitNode && emitNode.flags || 0 /* None */;
- const range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token];
- const source = range && range.source || sourceMapSource;
- tokenPos = skipSourceTrivia(source, range ? range.pos : tokenPos);
- if ((emitFlags & 256 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) {
- emitSourcePos(source, tokenPos);
- }
- tokenPos = emitCallback(token, writer2, tokenPos);
- if (range)
- tokenPos = range.end;
- if ((emitFlags & 512 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) {
- emitSourcePos(source, tokenPos);
- }
- return tokenPos;
- }
- function setSourceMapSource(source) {
- if (sourceMapsDisabled) {
- return;
- }
- sourceMapSource = source;
- if (source === mostRecentlyAddedSourceMapSource) {
- sourceMapSourceIndex = mostRecentlyAddedSourceMapSourceIndex;
- return;
- }
- if (isJsonSourceMapSource(source)) {
- return;
- }
- sourceMapSourceIndex = sourceMapGenerator.addSource(source.fileName);
- if (printerOptions.inlineSources) {
- sourceMapGenerator.setSourceContent(sourceMapSourceIndex, source.text);
- }
- mostRecentlyAddedSourceMapSource = source;
- mostRecentlyAddedSourceMapSourceIndex = sourceMapSourceIndex;
- }
- function resetSourceMapSource(source, sourceIndex) {
- sourceMapSource = source;
- sourceMapSourceIndex = sourceIndex;
- }
- function isJsonSourceMapSource(sourceFile) {
- return fileExtensionIs(sourceFile.fileName, ".json" /* Json */);
- }
-}
-function createBracketsMap() {
- const brackets2 = [];
- brackets2[1024 /* Braces */] = ["{", "}"];
- brackets2[2048 /* Parenthesis */] = ["(", ")"];
- brackets2[4096 /* AngleBrackets */] = ["<", ">"];
- brackets2[8192 /* SquareBrackets */] = ["[", "]"];
- return brackets2;
-}
-function getOpeningBracket(format) {
- return brackets[format & 15360 /* BracketsMask */][0];
-}
-function getClosingBracket(format) {
- return brackets[format & 15360 /* BracketsMask */][1];
-}
-var TempFlags = /* @__PURE__ */ ((TempFlags2) => {
- TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
- TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
- TempFlags2[TempFlags2["_i"] = 268435456] = "_i";
- return TempFlags2;
-})(TempFlags || {});
-function emitListItemNoParenthesizer(node, emit, _parenthesizerRule, _index) {
- emit(node);
-}
-function emitListItemWithParenthesizerRuleSelector(node, emit, parenthesizerRuleSelector, index) {
- emit(node, parenthesizerRuleSelector.select(index));
-}
-function emitListItemWithParenthesizerRule(node, emit, parenthesizerRule, _index) {
- emit(node, parenthesizerRule);
-}
-function getEmitListItem(emit, parenthesizerRule) {
- return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
-}
-
-// src/compiler/watchUtilities.ts
-function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
- setSysLog(watchLogLevel === 2 /* Verbose */ ? log2 : noop);
- const plainInvokeFactory = {
- watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
- watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1 /* Recursive */) !== 0, options)
- };
- const triggerInvokingFactory = watchLogLevel !== 0 /* None */ ? {
- watchFile: createTriggerLoggingAddWatch("watchFile"),
- watchDirectory: createTriggerLoggingAddWatch("watchDirectory")
- } : void 0;
- const factory2 = watchLogLevel === 2 /* Verbose */ ? {
- watchFile: createFileWatcherWithLogging,
- watchDirectory: createDirectoryWatcherWithLogging
- } : triggerInvokingFactory || plainInvokeFactory;
- const excludeWatcherFactory = watchLogLevel === 2 /* Verbose */ ? createExcludeWatcherWithLogging : returnNoopFileWatcher;
- return {
- watchFile: createExcludeHandlingAddWatch("watchFile"),
- watchDirectory: createExcludeHandlingAddWatch("watchDirectory")
- };
- function createExcludeHandlingAddWatch(key) {
- return (file, cb, flags, options, detailInfo1, detailInfo2) => {
- var _a2;
- return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a2 = host.getCurrentDirectory) == null ? void 0 : _a2.call(host)) || "") ? factory2[key].call(
- /*thisArgs*/
- void 0,
- file,
- cb,
- flags,
- options,
- detailInfo1,
- detailInfo2
- ) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
- };
- }
- function useCaseSensitiveFileNames() {
- return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
- }
- function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
- log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
- return {
- close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
- };
- }
- function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
- log2(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
- const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
- return {
- close: () => {
- log2(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
- watcher.close();
- }
- };
- }
- function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
- const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
- log2(watchInfo);
- const start = timestamp();
- const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
- const elapsed = timestamp() - start;
- log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
- return {
- close: () => {
- const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
- log2(watchInfo2);
- const start2 = timestamp();
- watcher.close();
- const elapsed2 = timestamp() - start2;
- log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
- }
- };
- }
- function createTriggerLoggingAddWatch(key) {
- return (file, cb, flags, options, detailInfo1, detailInfo2) => plainInvokeFactory[key].call(
- /*thisArgs*/
- void 0,
- file,
- (...args) => {
- const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
- log2(triggerredInfo);
- const start = timestamp();
- cb.call(
- /*thisArg*/
- void 0,
- ...args
- );
- const elapsed = timestamp() - start;
- log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
- },
- flags,
- options,
- detailInfo1,
- detailInfo2
- );
- }
- function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
- return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
- }
-}
-function getFallbackOptions(options) {
- const fallbackPolling = options == null ? void 0 : options.fallbackPolling;
- return {
- watchFile: fallbackPolling !== void 0 ? fallbackPolling : 1 /* PriorityPollingInterval */
- };
-}
-function closeFileWatcherOf(objWithWatcher) {
- objWithWatcher.watcher.close();
-}
-
-// src/compiler/program.ts
-function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) {
- let commonPathComponents;
- const failed = forEach(fileNames, (sourceFile) => {
- const sourcePathComponents = getNormalizedPathComponents(sourceFile, currentDirectory);
- sourcePathComponents.pop();
- if (!commonPathComponents) {
- commonPathComponents = sourcePathComponents;
- return;
- }
- const n = Math.min(commonPathComponents.length, sourcePathComponents.length);
- for (let i = 0; i < n; i++) {
- if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) {
- if (i === 0) {
- return true;
- }
- commonPathComponents.length = i;
- break;
- }
- }
- if (sourcePathComponents.length < commonPathComponents.length) {
- commonPathComponents.length = sourcePathComponents.length;
- }
- });
- if (failed) {
- return "";
- }
- if (!commonPathComponents) {
- return currentDirectory;
- }
- return getPathFromPathComponents(commonPathComponents);
-}
-var plainJSErrors = /* @__PURE__ */ new Set([
- // binder errors
- Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
- Diagnostics.A_module_cannot_have_multiple_default_exports.code,
- Diagnostics.Another_export_default_is_here.code,
- Diagnostics.The_first_export_default_is_here.code,
- Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
- Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
- Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
- Diagnostics.constructor_is_a_reserved_word.code,
- Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
- 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.code,
- Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
- Diagnostics.Invalid_use_of_0_in_strict_mode.code,
- Diagnostics.A_label_is_not_allowed_here.code,
- Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
- Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
- // grammar errors
- Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
- Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
- Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
- Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
- Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
- Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
- Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
- Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
- Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
- Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
- Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
- Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
- Diagnostics.A_get_accessor_cannot_have_parameters.code,
- Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
- Diagnostics.A_rest_element_cannot_have_a_property_name.code,
- Diagnostics.A_rest_element_cannot_have_an_initializer.code,
- Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
- Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
- Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
- Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
- Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
- Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
- Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
- Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
- Diagnostics.An_export_declaration_cannot_have_modifiers.code,
- Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
- Diagnostics.An_import_declaration_cannot_have_modifiers.code,
- Diagnostics.An_object_member_cannot_be_declared_optional.code,
- Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
- Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
- Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
- Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
- Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
- Diagnostics.Classes_can_only_extend_a_single_class.code,
- Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
- Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
- Diagnostics.Duplicate_label_0.code,
- Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
- Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
- Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
- Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
- Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
- Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
- Diagnostics.Jump_target_cannot_cross_function_boundary.code,
- Diagnostics.Line_terminator_not_permitted_before_arrow.code,
- Diagnostics.Modifiers_cannot_appear_here.code,
- Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
- Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
- Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
- Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
- Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
- Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
- Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
- Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
- Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
- Diagnostics.Trailing_comma_not_allowed.code,
- Diagnostics.Variable_declaration_list_cannot_be_empty.code,
- Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
- Diagnostics._0_expected.code,
- Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
- Diagnostics._0_list_cannot_be_empty.code,
- Diagnostics._0_modifier_already_seen.code,
- Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
- Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
- Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
- Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
- Diagnostics._0_modifier_cannot_be_used_here.code,
- Diagnostics._0_modifier_must_precede_1_modifier.code,
- Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
- Diagnostics.const_declarations_must_be_initialized.code,
- Diagnostics.extends_clause_already_seen.code,
- Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
- Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
- Diagnostics.Class_constructor_may_not_be_a_generator.code,
- Diagnostics.Class_constructor_may_not_be_an_accessor.code,
- Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
-]);
-
-// src/compiler/builderState.ts
-var BuilderState;
-((BuilderState2) => {
- function createManyToManyPathMap() {
- function create2(forward, reverse, deleted) {
- const map2 = {
- getKeys: (v) => reverse.get(v),
- getValues: (k) => forward.get(k),
- keys: () => forward.keys(),
- deleteKey: (k) => {
- (deleted || (deleted = /* @__PURE__ */ new Set())).add(k);
- const set = forward.get(k);
- if (!set) {
- return false;
- }
- set.forEach((v) => deleteFromMultimap(reverse, v, k));
- forward.delete(k);
- return true;
- },
- set: (k, vSet) => {
- deleted == null ? void 0 : deleted.delete(k);
- const existingVSet = forward.get(k);
- forward.set(k, vSet);
- existingVSet == null ? void 0 : existingVSet.forEach((v) => {
- if (!vSet.has(v)) {
- deleteFromMultimap(reverse, v, k);
- }
- });
- vSet.forEach((v) => {
- if (!(existingVSet == null ? void 0 : existingVSet.has(v))) {
- addToMultimap(reverse, v, k);
- }
- });
- return map2;
- }
- };
- return map2;
- }
- return create2(
- /* @__PURE__ */ new Map(),
- /* @__PURE__ */ new Map(),
- /*deleted*/
- void 0
- );
- }
- BuilderState2.createManyToManyPathMap = createManyToManyPathMap;
- function addToMultimap(map2, k, v) {
- let set = map2.get(k);
- if (!set) {
- set = /* @__PURE__ */ new Set();
- map2.set(k, set);
- }
- set.add(v);
- }
- function deleteFromMultimap(map2, k, v) {
- const set = map2.get(k);
- if (set == null ? void 0 : set.delete(v)) {
- if (!set.size) {
- map2.delete(k);
- }
- return true;
- }
- return false;
- }
- function getReferencedFilesFromImportedModuleSymbol(symbol) {
- return mapDefined(symbol.declarations, (declaration) => {
- var _a2;
- return (_a2 = getSourceFileOfNode(declaration)) == null ? void 0 : _a2.resolvedPath;
- });
- }
- function getReferencedFilesFromImportLiteral(checker, importName) {
- const symbol = checker.getSymbolAtLocation(importName);
- return symbol && getReferencedFilesFromImportedModuleSymbol(symbol);
- }
- function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) {
- return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
+ function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) {
+ return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
}
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
let referencedFiles;
@@ -40392,7 +34808,7 @@ var BuilderState;
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
}
const compilerOptions = programOfThisState.getCompilerOptions();
- if (compilerOptions && (compilerOptions.isolatedModules || outFile(compilerOptions))) {
+ if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
return [sourceFileWithUpdatedShape];
}
const seenFileNamesMap = /* @__PURE__ */ new Map();
@@ -40455,10 +34871,6 @@ var screenStartingMessageCodes = [
var noopFileWatcher = { close: noop };
var returnNoopFileWatcher = () => noopFileWatcher;
-// src/compiler/tsbuildPublic.ts
-var minimumDate = new Date(-864e13);
-var maximumDate = new Date(864e13);
-
// src/jsTyping/_namespaces/ts.JsTyping.ts
var ts_JsTyping_exports = {};
__export(ts_JsTyping_exports, {
@@ -40805,7 +35217,7 @@ function findArgument(argumentName) {
return index >= 0 && index < sys.args.length - 1 ? sys.args[index + 1] : void 0;
}
function nowString() {
- const d = new Date();
+ const d = /* @__PURE__ */ new Date();
return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`;
}
@@ -41326,47 +35738,45 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
}
this.typesRegistry = loadTypesRegistryFile(getTypesRegistryFileLocation(globalTypingsCacheLocation2), this.installTypingHost, this.log);
}
- listen() {
- process.on("message", (req) => {
- if (this.delayedInitializationError) {
- this.sendResponse(this.delayedInitializationError);
- this.delayedInitializationError = void 0;
+ handleRequest(req) {
+ if (this.delayedInitializationError) {
+ this.sendResponse(this.delayedInitializationError);
+ this.delayedInitializationError = void 0;
+ }
+ switch (req.kind) {
+ case "discover":
+ this.install(req);
+ break;
+ case "closeProject":
+ this.closeProject(req);
+ break;
+ case "typesRegistry": {
+ const typesRegistry = {};
+ this.typesRegistry.forEach((value, key) => {
+ typesRegistry[key] = value;
+ });
+ const response = { kind: EventTypesRegistry, typesRegistry };
+ this.sendResponse(response);
+ break;
}
- switch (req.kind) {
- case "discover":
- this.install(req);
- break;
- case "closeProject":
- this.closeProject(req);
- break;
- case "typesRegistry": {
- const typesRegistry = {};
- this.typesRegistry.forEach((value, key) => {
- typesRegistry[key] = value;
+ case "installPackage": {
+ const { fileName, packageName, projectName, projectRootPath } = req;
+ const cwd = getDirectoryOfPackageJson(fileName, this.installTypingHost) || projectRootPath;
+ if (cwd) {
+ this.installWorker(-1, [packageName], cwd, (success) => {
+ const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
+ const response = { kind: ActionPackageInstalled, projectName, success, message };
+ this.sendResponse(response);
});
- const response = { kind: EventTypesRegistry, typesRegistry };
+ } else {
+ const response = { kind: ActionPackageInstalled, projectName, success: false, message: "Could not determine a project root path." };
this.sendResponse(response);
- break;
- }
- case "installPackage": {
- const { fileName, packageName, projectName, projectRootPath } = req;
- const cwd = getDirectoryOfPackageJson(fileName, this.installTypingHost) || projectRootPath;
- if (cwd) {
- this.installWorker(-1, [packageName], cwd, (success) => {
- const message = success ? `Package ${packageName} installed.` : `There was an error installing ${packageName}.`;
- const response = { kind: ActionPackageInstalled, projectName, success, message };
- this.sendResponse(response);
- });
- } else {
- const response = { kind: ActionPackageInstalled, projectName, success: false, message: "Could not determine a project root path." };
- this.sendResponse(response);
- }
- break;
}
- default:
- Debug.assertNever(req);
+ break;
}
- });
+ default:
+ Debug.assertNever(req);
+ }
}
sendResponse(response) {
if (this.log.isEnabled()) {
@@ -41432,17 +35842,20 @@ process.on("disconnect", () => {
}
process.exit(0);
});
-var installer = new NodeTypingsInstaller(
- globalTypingsCacheLocation,
- typingSafeListLocation,
- typesMapLocation,
- npmLocation,
- validateDefaultNpmLocation,
- /*throttleLimit*/
- 5,
- log
-);
-installer.listen();
+var installer;
+process.on("message", (req) => {
+ installer != null ? installer : installer = new NodeTypingsInstaller(
+ globalTypingsCacheLocation,
+ typingSafeListLocation,
+ typesMapLocation,
+ npmLocation,
+ validateDefaultNpmLocation,
+ /*throttleLimit*/
+ 5,
+ log
+ );
+ installer.handleRequest(req);
+});
function indent(newline, str) {
return str && str.length ? `${newline} ` + str.replace(/\r?\n/, `${newline} `) : "";
}
diff --git a/package.json b/package.json
index 0210cdaffa0b3..6a27fc8f38983 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
- "version": "5.0.0-beta",
+ "version": "5.0.1-rc",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts
index 3ff67b980a4cc..3468e21af6272 100644
--- a/src/compiler/corePublic.ts
+++ b/src/compiler/corePublic.ts
@@ -4,7 +4,7 @@ export const versionMajorMinor = "5.0";
// The following is baselined as a literal template type without intervention
/** The version of the TypeScript compiler release */
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
-export const version: string = `${versionMajorMinor}.0-beta`;
+export const version: string = `${versionMajorMinor}.1-rc`;
/**
* Type of objects whose values are all of the same type.