tslib.d.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. /******************************************************************************
  2. Copyright (c) Microsoft Corporation.
  3. Permission to use, copy, modify, and/or distribute this software for any
  4. purpose with or without fee is hereby granted.
  5. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  6. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  7. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  8. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  9. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  10. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  11. PERFORMANCE OF THIS SOFTWARE.
  12. ***************************************************************************** */
  13. /**
  14. * Used to shim class extends.
  15. *
  16. * @param d The derived class.
  17. * @param b The base class.
  18. */
  19. export declare function __extends(d: Function, b: Function): void;
  20. /**
  21. * Copy the values of all of the enumerable own properties from one or more source objects to a
  22. * target object. Returns the target object.
  23. *
  24. * @param t The target object to copy to.
  25. * @param sources One or more source objects from which to copy properties
  26. */
  27. export declare function __assign(t: any, ...sources: any[]): any;
  28. /**
  29. * Performs a rest spread on an object.
  30. *
  31. * @param t The source value.
  32. * @param propertyNames The property names excluded from the rest spread.
  33. */
  34. export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
  35. /**
  36. * Applies decorators to a target object
  37. *
  38. * @param decorators The set of decorators to apply.
  39. * @param target The target object.
  40. * @param key If specified, the own property to apply the decorators to.
  41. * @param desc The property descriptor, defaults to fetching the descriptor from the target object.
  42. * @experimental
  43. */
  44. export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
  45. /**
  46. * Creates an observing function decorator from a parameter decorator.
  47. *
  48. * @param paramIndex The parameter index to apply the decorator to.
  49. * @param decorator The parameter decorator to apply. Note that the return value is ignored.
  50. * @experimental
  51. */
  52. export declare function __param(paramIndex: number, decorator: Function): Function;
  53. /**
  54. * Applies decorators to a class or class member, following the native ECMAScript decorator specification.
  55. * @param ctor For non-field class members, the class constructor. Otherwise, `null`.
  56. * @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`.
  57. * @param decorators The decorators to apply
  58. * @param contextIn The `DecoratorContext` to clone for each decorator application.
  59. * @param initializers An array of field initializer mutation functions into which new initializers are written.
  60. * @param extraInitializers An array of extra initializer functions into which new initializers are written.
  61. */
  62. export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void;
  63. /**
  64. * Runs field initializers or extra initializers generated by `__esDecorate`.
  65. * @param thisArg The `this` argument to use.
  66. * @param initializers The array of initializers to evaluate.
  67. * @param value The initial value to pass to the initializers.
  68. */
  69. export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any;
  70. /**
  71. * Converts a computed property name into a `string` or `symbol` value.
  72. */
  73. export declare function __propKey(x: any): string | symbol;
  74. /**
  75. * Assigns the name of a function derived from the left-hand side of an assignment.
  76. * @param f The function to rename.
  77. * @param name The new name for the function.
  78. * @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name.
  79. */
  80. export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function;
  81. /**
  82. * Creates a decorator that sets metadata.
  83. *
  84. * @param metadataKey The metadata key
  85. * @param metadataValue The metadata value
  86. * @experimental
  87. */
  88. export declare function __metadata(metadataKey: any, metadataValue: any): Function;
  89. /**
  90. * Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
  91. *
  92. * @param thisArg The reference to use as the `this` value in the generator function
  93. * @param _arguments The optional arguments array
  94. * @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
  95. * @param generator The generator function
  96. */
  97. export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
  98. /**
  99. * Creates an Iterator object using the body as the implementation.
  100. *
  101. * @param thisArg The reference to use as the `this` value in the function
  102. * @param body The generator state-machine based implementation.
  103. *
  104. * @see [./docs/generator.md]
  105. */
  106. export declare function __generator(thisArg: any, body: Function): any;
  107. /**
  108. * Creates bindings for all enumerable properties of `m` on `exports`
  109. *
  110. * @param m The source object
  111. * @param o The `exports` object.
  112. */
  113. export declare function __exportStar(m: any, o: any): void;
  114. /**
  115. * Creates a value iterator from an `Iterable` or `ArrayLike` object.
  116. *
  117. * @param o The object.
  118. * @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
  119. */
  120. export declare function __values(o: any): any;
  121. /**
  122. * Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
  123. *
  124. * @param o The object to read from.
  125. * @param n The maximum number of arguments to read, defaults to `Infinity`.
  126. */
  127. export declare function __read(o: any, n?: number): any[];
  128. /**
  129. * Creates an array from iterable spread.
  130. *
  131. * @param args The Iterable objects to spread.
  132. * @deprecated since TypeScript 4.2 - Use `__spreadArray`
  133. */
  134. export declare function __spread(...args: any[][]): any[];
  135. /**
  136. * Creates an array from array spread.
  137. *
  138. * @param args The ArrayLikes to spread into the resulting array.
  139. * @deprecated since TypeScript 4.2 - Use `__spreadArray`
  140. */
  141. export declare function __spreadArrays(...args: any[][]): any[];
  142. /**
  143. * Spreads the `from` array into the `to` array.
  144. *
  145. * @param pack Replace empty elements with `undefined`.
  146. */
  147. export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
  148. /**
  149. * Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
  150. * and instead should be awaited and the resulting value passed back to the generator.
  151. *
  152. * @param v The value to await.
  153. */
  154. export declare function __await(v: any): any;
  155. /**
  156. * Converts a generator function into an async generator function, by using `yield __await`
  157. * in place of normal `await`.
  158. *
  159. * @param thisArg The reference to use as the `this` value in the generator function
  160. * @param _arguments The optional arguments array
  161. * @param generator The generator function
  162. */
  163. export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
  164. /**
  165. * Used to wrap a potentially async iterator in such a way so that it wraps the result
  166. * of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
  167. *
  168. * @param o The potentially async iterator.
  169. * @returns A synchronous iterator yielding `__await` instances on every odd invocation
  170. * and returning the awaited `IteratorResult` passed to `next` every even invocation.
  171. */
  172. export declare function __asyncDelegator(o: any): any;
  173. /**
  174. * Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
  175. *
  176. * @param o The object.
  177. * @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
  178. */
  179. export declare function __asyncValues(o: any): any;
  180. /**
  181. * Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
  182. *
  183. * @param cooked The cooked possibly-sparse array.
  184. * @param raw The raw string content.
  185. */
  186. export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
  187. /**
  188. * Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
  189. *
  190. * ```js
  191. * import Default, { Named, Other } from "mod";
  192. * // or
  193. * import { default as Default, Named, Other } from "mod";
  194. * ```
  195. *
  196. * @param mod The CommonJS module exports object.
  197. */
  198. export declare function __importStar<T>(mod: T): T;
  199. /**
  200. * Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
  201. *
  202. * ```js
  203. * import Default from "mod";
  204. * ```
  205. *
  206. * @param mod The CommonJS module exports object.
  207. */
  208. export declare function __importDefault<T>(mod: T): T | { default: T };
  209. /**
  210. * Emulates reading a private instance field.
  211. *
  212. * @param receiver The instance from which to read the private field.
  213. * @param state A WeakMap containing the private field value for an instance.
  214. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  215. *
  216. * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
  217. */
  218. export declare function __classPrivateFieldGet<T extends object, V>(
  219. receiver: T,
  220. state: { has(o: T): boolean, get(o: T): V | undefined },
  221. kind?: "f"
  222. ): V;
  223. /**
  224. * Emulates reading a private static field.
  225. *
  226. * @param receiver The object from which to read the private static field.
  227. * @param state The class constructor containing the definition of the static field.
  228. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  229. * @param f The descriptor that holds the static field value.
  230. *
  231. * @throws {TypeError} If `receiver` is not `state`.
  232. */
  233. export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
  234. receiver: T,
  235. state: T,
  236. kind: "f",
  237. f: { value: V }
  238. ): V;
  239. /**
  240. * Emulates evaluating a private instance "get" accessor.
  241. *
  242. * @param receiver The instance on which to evaluate the private "get" accessor.
  243. * @param state A WeakSet used to verify an instance supports the private "get" accessor.
  244. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  245. * @param f The "get" accessor function to evaluate.
  246. *
  247. * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
  248. */
  249. export declare function __classPrivateFieldGet<T extends object, V>(
  250. receiver: T,
  251. state: { has(o: T): boolean },
  252. kind: "a",
  253. f: () => V
  254. ): V;
  255. /**
  256. * Emulates evaluating a private static "get" accessor.
  257. *
  258. * @param receiver The object on which to evaluate the private static "get" accessor.
  259. * @param state The class constructor containing the definition of the static "get" accessor.
  260. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  261. * @param f The "get" accessor function to evaluate.
  262. *
  263. * @throws {TypeError} If `receiver` is not `state`.
  264. */
  265. export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
  266. receiver: T,
  267. state: T,
  268. kind: "a",
  269. f: () => V
  270. ): V;
  271. /**
  272. * Emulates reading a private instance method.
  273. *
  274. * @param receiver The instance from which to read a private method.
  275. * @param state A WeakSet used to verify an instance supports the private method.
  276. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  277. * @param f The function to return as the private instance method.
  278. *
  279. * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
  280. */
  281. export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
  282. receiver: T,
  283. state: { has(o: T): boolean },
  284. kind: "m",
  285. f: V
  286. ): V;
  287. /**
  288. * Emulates reading a private static method.
  289. *
  290. * @param receiver The object from which to read the private static method.
  291. * @param state The class constructor containing the definition of the static method.
  292. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  293. * @param f The function to return as the private static method.
  294. *
  295. * @throws {TypeError} If `receiver` is not `state`.
  296. */
  297. export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
  298. receiver: T,
  299. state: T,
  300. kind: "m",
  301. f: V
  302. ): V;
  303. /**
  304. * Emulates writing to a private instance field.
  305. *
  306. * @param receiver The instance on which to set a private field value.
  307. * @param state A WeakMap used to store the private field value for an instance.
  308. * @param value The value to store in the private field.
  309. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  310. *
  311. * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
  312. */
  313. export declare function __classPrivateFieldSet<T extends object, V>(
  314. receiver: T,
  315. state: { has(o: T): boolean, set(o: T, value: V): unknown },
  316. value: V,
  317. kind?: "f"
  318. ): V;
  319. /**
  320. * Emulates writing to a private static field.
  321. *
  322. * @param receiver The object on which to set the private static field.
  323. * @param state The class constructor containing the definition of the private static field.
  324. * @param value The value to store in the private field.
  325. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  326. * @param f The descriptor that holds the static field value.
  327. *
  328. * @throws {TypeError} If `receiver` is not `state`.
  329. */
  330. export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
  331. receiver: T,
  332. state: T,
  333. value: V,
  334. kind: "f",
  335. f: { value: V }
  336. ): V;
  337. /**
  338. * Emulates writing to a private instance "set" accessor.
  339. *
  340. * @param receiver The instance on which to evaluate the private instance "set" accessor.
  341. * @param state A WeakSet used to verify an instance supports the private "set" accessor.
  342. * @param value The value to store in the private accessor.
  343. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  344. * @param f The "set" accessor function to evaluate.
  345. *
  346. * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
  347. */
  348. export declare function __classPrivateFieldSet<T extends object, V>(
  349. receiver: T,
  350. state: { has(o: T): boolean },
  351. value: V,
  352. kind: "a",
  353. f: (v: V) => void
  354. ): V;
  355. /**
  356. * Emulates writing to a private static "set" accessor.
  357. *
  358. * @param receiver The object on which to evaluate the private static "set" accessor.
  359. * @param state The class constructor containing the definition of the static "set" accessor.
  360. * @param value The value to store in the private field.
  361. * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
  362. * @param f The "set" accessor function to evaluate.
  363. *
  364. * @throws {TypeError} If `receiver` is not `state`.
  365. */
  366. export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
  367. receiver: T,
  368. state: T,
  369. value: V,
  370. kind: "a",
  371. f: (v: V) => void
  372. ): V;
  373. /**
  374. * Checks for the existence of a private field/method/accessor.
  375. *
  376. * @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
  377. * @param receiver The object for which to test the presence of the private member.
  378. */
  379. export declare function __classPrivateFieldIn(
  380. state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
  381. receiver: unknown,
  382. ): boolean;
  383. /**
  384. * Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
  385. *
  386. * @param object The local `exports` object.
  387. * @param target The object to re-export from.
  388. * @param key The property key of `target` to re-export.
  389. * @param objectKey The property key to re-export as. Defaults to `key`.
  390. */
  391. export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
  392. /**
  393. * Adds a disposable resource to a resource-tracking environment object.
  394. * @param env A resource-tracking environment object.
  395. * @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`.
  396. * @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added.
  397. * @returns The {@link value} argument.
  398. *
  399. * @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not
  400. * defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method.
  401. */
  402. export declare function __addDisposableResource<T>(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T;
  403. /**
  404. * Disposes all resources in a resource-tracking environment object.
  405. * @param env A resource-tracking environment object.
  406. * @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`.
  407. *
  408. * @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the
  409. * error recorded in the resource-tracking environment object.
  410. * @seealso {@link __addDisposableResource}
  411. */
  412. export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any;
  413. /**
  414. * Transforms a relative import specifier ending in a non-declaration TypeScript file extension to its JavaScript file extension counterpart.
  415. * @param path The import specifier.
  416. * @param preserveJsx Causes '*.tsx' to transform to '*.jsx' instead of '*.js'. Should be true when `--jsx` is set to `preserve`.
  417. */
  418. export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean): string;