1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

feat(cli): update to TypeScript 4.5 (#12410)

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
Kitson Kelly 2021-12-10 09:12:21 +11:00 committed by GitHub
parent a3d024ac2e
commit 345f0fbe5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 15019 additions and 13011 deletions

View file

@ -9,7 +9,9 @@
"json": {
"deno": true
},
"includes": ["**/*.{ts,tsx,js,jsx,json,md,toml}"],
"includes": [
"**/*.{ts,tsx,js,jsx,json,md,toml}"
],
"excludes": [
".cargo_home",
".git",
@ -36,7 +38,7 @@
"tools/wpt/manifest.json"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.59.2.wasm",
"https://plugins.dprint.dev/typescript-0.60.0.wasm",
"https://plugins.dprint.dev/json-0.13.2.wasm",
"https://plugins.dprint.dev/markdown-0.11.3.wasm",
"https://plugins.dprint.dev/toml-0.5.3.wasm"

View file

@ -3,7 +3,6 @@
use deno_core::error::custom_error;
use deno_core::op_sync;
use deno_core::serde::Deserialize;
use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_core::JsRuntime;
@ -122,6 +121,7 @@ fn create_compiler_snapshot(
"es2020.string",
"es2020.symbol.wellknown",
"es2021",
"es2021.intl",
"es2021.promise",
"es2021.string",
"es2021.weakref",
@ -168,14 +168,19 @@ fn create_compiler_snapshot(
"op_cwd",
op_sync(move |_state, _args: Value, _: ()| Ok(json!("cache:///"))),
);
// As of TypeScript 4.5, it tries to detect the existence of substitute lib
// files, which we currently don't use, so we just return false.
js_runtime.register_op(
"op_exists",
op_sync(move |_state, _args: LoadArgs, _: ()| Ok(json!(false))),
);
// using the same op that is used in `tsc.rs` for loading modules and reading
// files, but a slightly different implementation at build time.
js_runtime.register_op(
"op_load",
op_sync(move |_state, args, _: ()| {
let v: LoadArgs = serde_json::from_value(args)?;
op_sync(move |_state, args: LoadArgs, _: ()| {
// we need a basic file to send to tsc to warm it up.
if v.specifier == build_specifier {
if args.specifier == build_specifier {
Ok(json!({
"data": r#"console.log("hello deno!");"#,
"hash": "1",
@ -184,7 +189,7 @@ fn create_compiler_snapshot(
}))
// specifiers come across as `asset:///lib.{lib_name}.d.ts` and we need to
// parse out just the name so we can lookup the asset.
} else if let Some(caps) = re_asset.captures(&v.specifier) {
} else if let Some(caps) = re_asset.captures(&args.specifier) {
if let Some(lib) = caps.get(1).map(|m| m.as_str()) {
// if it comes from an op crate, we were supplied with the path to the
// file.
@ -204,13 +209,13 @@ fn create_compiler_snapshot(
} else {
Err(custom_error(
"InvalidSpecifier",
format!("An invalid specifier was requested: {}", v.specifier),
format!("An invalid specifier was requested: {}", args.specifier),
))
}
} else {
Err(custom_error(
"InvalidSpecifier",
format!("An invalid specifier was requested: {}", v.specifier),
format!("An invalid specifier was requested: {}", args.specifier),
))
}
}),

2839
cli/dts/lib.dom.d.ts vendored

File diff suppressed because it is too large Load diff

View file

@ -78,17 +78,11 @@ interface FontFaceSet extends Set<FontFace> {
interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
/**
* Returns an array of key, value pairs for every entry in the list.
*/
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[string, FormDataEntryValue]>;
/**
* Returns a list of keys in the list.
*/
/** Returns a list of keys in the list. */
keys(): IterableIterator<string>;
/**
* Returns a list of values in the list.
*/
/** Returns a list of values in the list. */
values(): IterableIterator<FormDataEntryValue>;
}
@ -114,24 +108,16 @@ interface HTMLSelectElement {
interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all key/value pairs contained in this object.
*/
/** Returns an iterator allowing to go through all key/value pairs contained in this object. */
entries(): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
*/
/** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
keys(): IterableIterator<string>;
/**
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
*/
/** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
}
interface IDBDatabase {
/**
* Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
*/
/** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */
transaction(storeNames: string | Iterable<string>, mode?: IDBTransactionMode): IDBTransaction;
}
@ -169,39 +155,28 @@ interface NamedNodeMap {
}
interface Navigator {
/** Available only in secure contexts. */
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
vibrate(pattern: Iterable<number>): boolean;
}
interface NodeList {
[Symbol.iterator](): IterableIterator<Node>;
/**
* Returns an array of key, value pairs for every entry in the list.
*/
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[number, Node]>;
/**
* Returns an list of keys in the list.
*/
/** Returns an list of keys in the list. */
keys(): IterableIterator<number>;
/**
* Returns an list of values in the list.
*/
/** Returns an list of values in the list. */
values(): IterableIterator<Node>;
}
interface NodeListOf<TNode extends Node> {
[Symbol.iterator](): IterableIterator<TNode>;
/**
* Returns an array of key, value pairs for every entry in the list.
*/
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[number, TNode]>;
/**
* Returns an list of keys in the list.
*/
/** Returns an list of keys in the list. */
keys(): IterableIterator<number>;
/**
* Returns an list of values in the list.
*/
/** Returns an list of values in the list. */
values(): IterableIterator<TNode>;
}
@ -216,13 +191,6 @@ interface PluginArray {
interface RTCStatsReport extends ReadonlyMap<string, any> {
}
interface ReadableStream<R = any> {
[Symbol.iterator](): IterableIterator<any>;
entries(): IterableIterator<[number, any]>;
keys(): IterableIterator<number>;
values(): IterableIterator<any>;
}
interface SVGLengthList {
[Symbol.iterator](): IterableIterator<SVGLength>;
}
@ -283,17 +251,11 @@ interface TouchList {
interface URLSearchParams {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
* Returns an array of key, value pairs for every entry in the search params.
*/
/** Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[string, string]>;
/**
* Returns a list of keys in the search params.
*/
/** Returns a list of keys in the search params. */
keys(): IterableIterator<string>;
/**
* Returns a list of values in the search params.
*/
/** Returns a list of values in the search params. */
values(): IterableIterator<string>;
}

View file

@ -455,47 +455,87 @@ interface String {
/**
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value
* @deprecated A legacy feature for browser compatibility
* @param name
*/
anchor(name: string): string;
/** Returns a `<big>` HTML element */
/**
* Returns a `<big>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
big(): string;
/** Returns a `<blink>` HTML element */
/**
* Returns a `<blink>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
blink(): string;
/** Returns a `<b>` HTML element */
/**
* Returns a `<b>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
bold(): string;
/** Returns a `<tt>` HTML element */
/**
* Returns a `<tt>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
fixed(): string;
/** Returns a `<font>` HTML element and sets the color attribute value */
/**
* Returns a `<font>` HTML element and sets the color attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontcolor(color: string): string;
/** Returns a `<font>` HTML element and sets the size attribute value */
/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: number): string;
/** Returns a `<font>` HTML element and sets the size attribute value */
/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: string): string;
/** Returns an `<i>` HTML element */
/**
* Returns an `<i>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
italics(): string;
/** Returns an `<a>` HTML element and sets the href attribute value */
/**
* Returns an `<a>` HTML element and sets the href attribute value
* @deprecated A legacy feature for browser compatibility
*/
link(url: string): string;
/** Returns a `<small>` HTML element */
/**
* Returns a `<small>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
small(): string;
/** Returns a `<strike>` HTML element */
/**
* Returns a `<strike>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
strike(): string;
/** Returns a `<sub>` HTML element */
/**
* Returns a `<sub>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
sub(): string;
/** Returns a `<sup>` HTML element */
/**
* Returns a `<sup>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
sup(): string;
}

View file

@ -223,7 +223,7 @@ interface PromiseConstructor {
* @param values An iterable of Promises.
* @returns A new Promise.
*/
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
@ -231,15 +231,7 @@ interface PromiseConstructor {
* @param values An iterable of Promises.
* @returns A new Promise.
*/
race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An iterable of Promises.
* @returns A new Promise.
*/
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
}
interface String {

View file

@ -38,79 +38,7 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6, T7>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5, T6>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4, T5>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3, T4>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2, T3>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T1, T2>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: readonly (T | PromiseLike<T>)[]): Promise<T[]>;
all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
// see: lib.es2015.iterable.d.ts
// all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
@ -121,7 +49,7 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: readonly T[]): Promise<T extends PromiseLike<infer U> ? U : T>;
race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
// see: lib.es2015.iterable.d.ts
// race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;

View file

@ -25,13 +25,13 @@ declare namespace Intl {
type PluralRuleType = "cardinal" | "ordinal";
interface PluralRulesOptions {
localeMatcher?: "lookup" | "best fit";
type?: PluralRuleType;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
localeMatcher?: "lookup" | "best fit" | undefined;
type?: PluralRuleType | undefined;
minimumIntegerDigits?: number | undefined;
minimumFractionDigits?: number | undefined;
maximumFractionDigits?: number | undefined;
minimumSignificantDigits?: number | undefined;
maximumSignificantDigits?: number | undefined;
}
interface ResolvedPluralRulesOptions {
@ -53,9 +53,21 @@ declare namespace Intl {
const PluralRules: {
new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
(locales?: string | string[], options?: PluralRulesOptions): PluralRules;
supportedLocalesOf(
locales: string | string[],
options?: PluralRulesOptions,
): string[];
supportedLocalesOf(locales: string | string[], options?: { localeMatcher?: "lookup" | "best fit" }): string[];
};
// We can only have one definition for 'type' in TypeScript, and so you can learn where the keys come from here:
type ES2018NumberFormatPartType = "literal" | "nan" | "infinity" | "percent" | "integer" | "group" | "decimal" | "fraction" | "plusSign" | "minusSign" | "percentSign" | "currency" | "code" | "symbol" | "name";
type ES2020NumberFormatPartType = "compact" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "unit" | "unknown";
type NumberFormatPartTypes = ES2018NumberFormatPartType | ES2020NumberFormatPartType;
interface NumberFormatPart {
type: NumberFormatPartTypes;
value: string;
}
interface NumberFormat {
formatToParts(number?: number | bigint): NumberFormatPart[];
}
}

View file

@ -25,9 +25,15 @@ interface String {
/** Removes the leading white space and line terminator characters from a string. */
trimStart(): string;
/** Removes the leading white space and line terminator characters from a string. */
/**
* Removes the leading white space and line terminator characters from a string.
* @deprecated A legacy feature for browser compatibility. Use `trimStart` instead
*/
trimLeft(): string;
/** Removes the trailing white space and line terminator characters from a string. */
/**
* Removes the trailing white space and line terminator characters from a string.
* @deprecated A legacy feature for browser compatibility. Use `trimEnd` instead
*/
trimRight(): string;
}

View file

@ -24,7 +24,6 @@ declare namespace Intl {
* [Unicode BCP 47 Locale Identifiers](https://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) definition.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
*
*/
type UnicodeBCP47LocaleIdentifier = string;
@ -32,26 +31,29 @@ declare namespace Intl {
* Unit to use in the relative time internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-singularrelativetimeunit).
*/
type RelativeTimeFormatUnit =
| "year" | "years"
| "quarter" | "quarters"
| "month" | "months"
| "week" | "weeks"
| "day" | "days"
| "hour" | "hours"
| "minute" | "minutes"
| "second" | "seconds"
;
| "year"
| "years"
| "quarter"
| "quarters"
| "month"
| "months"
| "week"
| "weeks"
| "day"
| "days"
| "hour"
| "hours"
| "minute"
| "minutes"
| "second"
| "seconds";
/**
* The locale matching algorithm to use.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";
@ -59,8 +61,6 @@ declare namespace Intl {
* The format of output message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatNumeric = "always" | "auto";
@ -68,33 +68,37 @@ declare namespace Intl {
* The length of the internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatStyle = "long" | "short" | "narrow";
/**
* [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
*/
type BCP47LanguageTag = string;
/**
* An object with some or all of properties of `options` parameter
* of `Intl.RelativeTimeFormat` constructor.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
interface RelativeTimeFormatOptions {
/** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */
localeMatcher?: RelativeTimeFormatLocaleMatcher;
/** The format of output message. */
numeric?: RelativeTimeFormatNumeric;
/** The length of the internationalized message. */
style?: RelativeTimeFormatStyle;
}
/**
* An object with properties reflecting the locale
* and formatting options computed during initialization
* of the `Intel.RelativeTimeFormat` object
* of the `Intl.RelativeTimeFormat` object
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).
*
* [Specification](https://tc39.es/ecma402/#table-relativetimeformat-resolvedoptions-properties)
*/
interface ResolvedRelativeTimeFormatOptions {
locale: UnicodeBCP47LocaleIdentifier;
@ -108,8 +112,6 @@ declare namespace Intl {
* that can be used for custom locale-aware formatting.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
*
* [Specification](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts).
*/
interface RelativeTimeFormatPart {
type: string;
@ -126,6 +128,7 @@ declare namespace Intl {
*
* While this method automatically provides the correct plural forms,
* the grammatical form is otherwise as neutral as possible.
*
* It is the caller's responsibility to handle cut-off logic
* such as deciding between displaying "in 7 days" or "in 1 week".
* This API does not support relative dates involving compound units.
@ -133,68 +136,33 @@ declare namespace Intl {
*
* @param value - Numeric value to use in the internationalized relative time message
*
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)
* to use in the relative time internationalized message.
* Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,
* `"day"`, `"hour"`, `"minute"`, `"second"`.
* Plural forms are also permitted.
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
* @returns Internationalized relative time message as string
* @returns {string} Internationalized relative time message as string
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).
*
* [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.format).
*/
format(
value: number,
unit: RelativeTimeFormatUnit,
): string;
format(value: number, unit: RelativeTimeFormatUnit): string;
/**
* A version of the format method which it returns an array of objects
* which represent "parts" of the object,
* separating the formatted number into its constituent parts
* and separating it from other surrounding text.
* These objects have two properties:
* `type` a NumberFormat formatToParts type, and `value`,
* which is the String which is the component of the output.
* If a "part" came from NumberFormat,
* it will have a unit property which indicates the `unit` being formatted;
* literals which are part of the larger frame will not have this property.
* Returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.
*
* @param value - Numeric value to use in the internationalized relative time message
*
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)
* to use in the relative time internationalized message.
* Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,
* `"day"`, `"hour"`, `"minute"`, `"second"`.
* Plural forms are also permitted.
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit) to use in the relative time internationalized message.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
* @returns Array of [FormatRelativeTimeToParts](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts)
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).
*
* [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.formatToParts).
*/
formatToParts(
value: number,
unit: RelativeTimeFormatUnit,
): RelativeTimeFormatPart[];
formatToParts(value: number, unit: RelativeTimeFormatUnit): RelativeTimeFormatPart[];
/**
* Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.
*
* @returns A new object with properties reflecting the locale
* and formatting options computed during initialization
* of the `Intel.RelativeTimeFormat` object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).
*
* [Specification](https://tc39.es/ecma402/#sec-intl.relativetimeformat.prototype.resolvedoptions)
*/
resolvedOptions(): ResolvedRelativeTimeFormatOptions;
}
@ -203,41 +171,22 @@ declare namespace Intl {
* The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* object is a constructor for objects that enable language-sensitive relative time formatting.
*
* Part of [Intl object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)
* namespace and the [ECMAScript Internationalization API](https://www.ecma-international.org/publications/standards/Ecma-402.htm).
*
* [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).
*
* [Polyfills](https://github.com/tc39/proposal-intl-relative-time#polyfills).
*/
const RelativeTimeFormat: {
/**
* Constructor creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* objects
* Creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) objects
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of the formatting.
* An object with some or all of the following properties:
* - `localeMatcher` - The locale matching algorithm to use.
* Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
* For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
* - `numeric` - The format of output message.
* Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).
* The `"auto"` value allows to not always have to use numeric values in the output.
* - `style` - The length of the internationalized message. Possible values are:
* `"long"` (default, e.g., in 1 month),
* `"short"` (e.g., in 1 mo.)
* or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.
* with some or all of options of `RelativeTimeFormatOptions`.
*
* @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
*
* [Specification](https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor).
*/
new(
locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
@ -255,25 +204,12 @@ declare namespace Intl {
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of the formatting.
* An object with some or all of the following properties:
* - `localeMatcher` - The locale matching algorithm to use.
* Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
* For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
* - `numeric` - The format of output message.
* Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).
* The `"auto"` value allows to not always have to use numeric values in the output.
* - `style` - The length of the internationalized message. Possible values are:
* `"long"` (default, e.g., in 1 month),
* `"short"` (e.g., in 1 mo.)
* or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.
*
* @returns An array containing those of the provided locales
* that are supported in date and time formatting
* without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).
*
* [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.supportedLocalesOf).
*/
supportedLocalesOf(
locales?: UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[],
@ -282,28 +218,151 @@ declare namespace Intl {
};
interface NumberFormatOptions {
compactDisplay?: string;
notation?: string;
signDisplay?: string;
unit?: string;
unitDisplay?: string;
compactDisplay?: "short" | "long" | undefined;
notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
signDisplay?: "auto" | "never" | "always" | undefined;
unit?: string | undefined;
unitDisplay?: "short" | "long" | "narrow" | undefined;
}
interface ResolvedNumberFormatOptions {
compactDisplay?: string;
notation?: string;
signDisplay?: string;
compactDisplay?: "short" | "long";
notation?: "standard" | "scientific" | "engineering" | "compact";
signDisplay?: "auto" | "never" | "always";
unit?: string;
unitDisplay?: string;
unitDisplay?: "short" | "long" | "narrow";
}
interface DateTimeFormatOptions {
dateStyle?: "full" | "long" | "medium" | "short";
timeStyle?: "full" | "long" | "medium" | "short";
calendar?: string;
dayPeriod?: "narrow" | "short" | "long";
numberingSystem?: string;
hourCycle?: "h11" | "h12" | "h23" | "h24";
fractionalSecondDigits?: 0 | 1 | 2 | 3;
calendar?: string | undefined;
dayPeriod?: "narrow" | "short" | "long" | undefined;
numberingSystem?: string | undefined;
dateStyle?: "full" | "long" | "medium" | "short" | undefined;
timeStyle?: "full" | "long" | "medium" | "short" | undefined;
hourCycle?: "h11" | "h12" | "h23" | "h24" | undefined;
}
type LocaleHourCycleKey = "h12" | "h23" | "h11" | "h24";
type LocaleCollationCaseFirst = "upper" | "lower" | "false";
interface LocaleOptions {
/** A string containing the language, and the script and region if available. */
baseName?: string;
/** The part of the Locale that indicates the locale's calendar era. */
calendar?: string;
/** Flag that defines whether case is taken into account for the locale's collation rules. */
caseFirst?: LocaleCollationCaseFirst;
/** The collation type used for sorting */
collation?: string;
/** The time keeping format convention used by the locale. */
hourCycle?: LocaleHourCycleKey;
/** The primary language subtag associated with the locale. */
language?: string;
/** The numeral system used by the locale. */
numberingSystem?: string;
/** Flag that defines whether the locale has special collation handling for numeric characters. */
numeric?: boolean;
/** The region of the world (usually a country) associated with the locale. Possible values are region codes as defined by ISO 3166-1. */
region?: string;
/** The script used for writing the particular language used in the locale. Possible values are script codes as defined by ISO 15924. */
script?: string;
}
interface Locale extends LocaleOptions {
/** Gets the most likely values for the language, script, and region of the locale based on existing values. */
maximize(): Locale;
/** Attempts to remove information about the locale that would be added by calling `Locale.maximize()`. */
minimize(): Locale;
/** Returns the locale's full locale identifier string. */
toString(): BCP47LanguageTag;
}
/**
* Constructor creates [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale)
* objects
*
* @param tag - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646).
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale#Parameters) with some or all of options of the locale.
*
* @returns [Intl.Locale](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale).
*/
const Locale: {
new (tag?: BCP47LanguageTag, options?: LocaleOptions): Locale;
};
interface DisplayNamesOptions {
localeMatcher: RelativeTimeFormatLocaleMatcher;
style: RelativeTimeFormatStyle;
type: "language" | "region" | "script" | "currency";
fallback: "code" | "none";
}
interface DisplayNames {
/**
* Receives a code and returns a string based on the locale and options provided when instantiating
* [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
*
* @param code The `code` to provide depends on the `type` passed to display name during creation:
* - If the type is `"region"`, code should be either an [ISO-3166 two letters region code](https://www.iso.org/iso-3166-country-codes.html),
* or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).
* - If the type is `"script"`, code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).
* - If the type is `"language"`, code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )
* subsequence of the unicode_language_id grammar in [UTS 35's Unicode Language and Locale Identifiers grammar](https://unicode.org/reports/tr35/#Unicode_language_identifier).
* `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.
* - If the type is `"currency"`, code should be a [3-letter ISO 4217 currency code](https://www.iso.org/iso-4217-currency-codes.html).
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
*/
of(code: string): string;
/**
* Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
* [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
*/
resolvedOptions(): DisplayNamesOptions;
}
/**
* The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
* object enables the consistent translation of language, region and script display names.
*
* [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).
*/
const DisplayNames: {
prototype: DisplayNames;
/**
* @param locales A string with a BCP 47 language tag, or an array of such strings.
* For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* page.
*
* @param options An object for setting up a display name.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
*/
new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: Partial<DisplayNamesOptions>): DisplayNames;
/**
* Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.
*
* @param locales A string with a BCP 47 language tag, or an array of such strings.
* For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* page.
*
* @param options An object with a locale matcher.
*
* @returns An array of strings representing a subset of the given locale tags that are supported in display names without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
*/
supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: {localeMatcher: RelativeTimeFormatLocaleMatcher}): BCP47LanguageTag[];
};
}

View file

@ -37,8 +37,7 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
allSettled<T extends readonly unknown[] | readonly [unknown]>(values: T):
Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>;
allSettled<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>> }>;
/**
* Creates a Promise that is resolved with an array of results when all
@ -46,5 +45,5 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
allSettled<T>(values: Iterable<T>): Promise<PromiseSettledResult<T extends PromiseLike<infer U> ? U : T>[]>;
allSettled<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<Awaited<T>>[]>;
}

View file

@ -22,3 +22,4 @@ and limitations under the License.
/// <reference lib="es2021.promise" />
/// <reference lib="es2021.string" />
/// <reference lib="es2021.weakref" />
/// <reference lib="es2021.intl" />

44
cli/dts/lib.es2021.intl.d.ts vendored Normal file
View file

@ -0,0 +1,44 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatOptions {
formatMatcher?: "basic" | "best fit" | "best fit" | undefined;
dateStyle?: "full" | "long" | "medium" | "short" | undefined;
timeStyle?: "full" | "long" | "medium" | "short" | undefined;
dayPeriod?: "narrow" | "short" | "long" | undefined;
fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;
}
interface ResolvedDateTimeFormatOptions {
formatMatcher?: "basic" | "best fit" | "best fit";
dateStyle?: "full" | "long" | "medium" | "short";
timeStyle?: "full" | "long" | "medium" | "short";
hourCycle?: "h11" | "h12" | "h23" | "h24";
dayPeriod?: "narrow" | "short" | "long";
fractionalSecondDigits?: 0 | 1 | 2 | 3;
}
interface NumberFormat {
formatRange(startDate: number | bigint, endDate: number | bigint): string;
formatRangeToParts(startDate: number | bigint, endDate: number | bigint): NumberFormatPart[];
}
}

View file

@ -39,5 +39,12 @@ interface PromiseConstructor {
* @param values An array or iterable of Promises.
* @returns A new Promise.
*/
any<T>(values: (T | PromiseLike<T>)[] | Iterable<T | PromiseLike<T>>): Promise<T>
any<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
/**
* The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
* @param values An array or iterable of Promises.
* @returns A new Promise.
*/
any<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>
}

146
cli/dts/lib.es5.d.ts vendored
View file

@ -84,12 +84,14 @@ declare function encodeURIComponent(uriComponent: string | number | boolean): st
/**
* Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
* @deprecated A legacy feature for browser compatibility
* @param string A string value
*/
declare function escape(string: string): string;
/**
* Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
* @deprecated A legacy feature for browser compatibility
* @param string A string value
*/
declare function unescape(string: string): string;
@ -214,13 +216,13 @@ interface ObjectConstructor {
/**
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
* @param a Object on which to lock the attributes.
*/
freeze<T>(a: T[]): readonly T[];
/**
* Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
* @param o Object on which to lock the attributes.
* @param f Object on which to lock the attributes.
*/
freeze<T extends Function>(f: T): T;
@ -503,6 +505,7 @@ interface String {
// IE extensions
/**
* Gets a substring beginning at the specified location and having the specified length.
* @deprecated A legacy feature for browser compatibility
* @param from The starting position of the desired substring. The index of the first character in the string is zero.
* @param length The number of characters to include in the returned substring.
*/
@ -614,6 +617,23 @@ interface TemplateStringsArray extends ReadonlyArray<string> {
interface ImportMeta {
}
/**
* The type for the optional second argument to `import()`.
*
* If your host environment supports additional options, this type may be
* augmented via interface merging.
*/
interface ImportCallOptions {
assert?: ImportAssertions;
}
/**
* The type for the `assert` property of the optional second argument to `import()`.
*/
interface ImportAssertions {
[key: string]: string;
}
interface Math {
/** The mathematical constant e. This is Euler's number, the base of natural logarithms. */
readonly E: number;
@ -944,7 +964,8 @@ interface RegExp {
lastIndex: number;
// Non-standard extensions
compile(): this;
/** @deprecated A legacy feature for browser compatibility */
compile(pattern: string, flags?: string): this;
}
interface RegExpConstructor {
@ -955,16 +976,44 @@ interface RegExpConstructor {
readonly prototype: RegExp;
// Non-standard extensions
/** @deprecated A legacy feature for browser compatibility */
$1: string;
/** @deprecated A legacy feature for browser compatibility */
$2: string;
/** @deprecated A legacy feature for browser compatibility */
$3: string;
/** @deprecated A legacy feature for browser compatibility */
$4: string;
/** @deprecated A legacy feature for browser compatibility */
$5: string;
/** @deprecated A legacy feature for browser compatibility */
$6: string;
/** @deprecated A legacy feature for browser compatibility */
$7: string;
/** @deprecated A legacy feature for browser compatibility */
$8: string;
/** @deprecated A legacy feature for browser compatibility */
$9: string;
/** @deprecated A legacy feature for browser compatibility */
input: string;
/** @deprecated A legacy feature for browser compatibility */
$_: string;
/** @deprecated A legacy feature for browser compatibility */
lastMatch: string;
/** @deprecated A legacy feature for browser compatibility */
"$&": string;
/** @deprecated A legacy feature for browser compatibility */
lastParen: string;
/** @deprecated A legacy feature for browser compatibility */
"$+": string;
/** @deprecated A legacy feature for browser compatibility */
leftContext: string;
/** @deprecated A legacy feature for browser compatibility */
"$`": string;
/** @deprecated A legacy feature for browser compatibility */
rightContext: string;
/** @deprecated A legacy feature for browser compatibility */
"$'": string;
}
declare var RegExp: RegExpConstructor;
@ -1281,7 +1330,7 @@ interface Array<T> {
* Sorts an array in place.
* This method mutates the array and returns a reference to the same array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
@ -1460,6 +1509,17 @@ interface Promise<T> {
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
}
/**
* Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`.
*/
type Awaited<T> =
T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
F extends ((value: infer V) => any) ? // if the argument to `then` is callable, extracts the argument
Awaited<V> : // recursively unwrap the value
never : // the argument to `then` was not callable
T; // non-object or non-thenable
interface ArrayLike<T> {
readonly length: number;
readonly [n: number]: T;
@ -1966,7 +2026,7 @@ interface Int8Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -2248,7 +2308,7 @@ interface Uint8Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -2530,7 +2590,7 @@ interface Uint8ClampedArray {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -2810,7 +2870,7 @@ interface Int16Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -3093,7 +3153,7 @@ interface Uint16Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -3375,7 +3435,7 @@ interface Int32Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -3656,7 +3716,7 @@ interface Uint32Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -3938,7 +3998,7 @@ interface Float32Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -4221,7 +4281,7 @@ interface Float64Array {
* Sorts an array.
* @param compareFn Function used to determine the order of the elements. It is expected to return
* a negative value if first argument is less than second argument, zero if they're equal and a positive
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
* value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts
* [11,2,22,1].sort((a, b) => a - b)
* ```
@ -4283,12 +4343,12 @@ declare var Float64Array: Float64ArrayConstructor;
declare namespace Intl {
interface CollatorOptions {
usage?: string;
localeMatcher?: string;
numeric?: boolean;
caseFirst?: string;
sensitivity?: string;
ignorePunctuation?: boolean;
usage?: string | undefined;
localeMatcher?: string | undefined;
numeric?: boolean | undefined;
caseFirst?: string | undefined;
sensitivity?: string | undefined;
ignorePunctuation?: boolean | undefined;
}
interface ResolvedCollatorOptions {
@ -4312,17 +4372,17 @@ declare namespace Intl {
};
interface NumberFormatOptions {
localeMatcher?: string;
style?: string;
currency?: string;
currencyDisplay?: string;
currencySign?: string;
useGrouping?: boolean;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
localeMatcher?: string | undefined;
style?: string | undefined;
currency?: string | undefined;
currencyDisplay?: string | undefined;
currencySign?: string | undefined;
useGrouping?: boolean | undefined;
minimumIntegerDigits?: number | undefined;
minimumFractionDigits?: number | undefined;
maximumFractionDigits?: number | undefined;
minimumSignificantDigits?: number | undefined;
maximumSignificantDigits?: number | undefined;
}
interface ResolvedNumberFormatOptions {
@ -4350,19 +4410,19 @@ declare namespace Intl {
};
interface DateTimeFormatOptions {
localeMatcher?: "best fit" | "lookup";
weekday?: "long" | "short" | "narrow";
era?: "long" | "short" | "narrow";
year?: "numeric" | "2-digit";
month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
day?: "numeric" | "2-digit";
hour?: "numeric" | "2-digit";
minute?: "numeric" | "2-digit";
second?: "numeric" | "2-digit";
timeZoneName?: "long" | "short";
formatMatcher?: "best fit" | "basic";
hour12?: boolean;
timeZone?: string;
localeMatcher?: "best fit" | "lookup" | undefined;
weekday?: "long" | "short" | "narrow" | undefined;
era?: "long" | "short" | "narrow" | undefined;
year?: "numeric" | "2-digit" | undefined;
month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined;
day?: "numeric" | "2-digit" | undefined;
hour?: "numeric" | "2-digit" | undefined;
minute?: "numeric" | "2-digit" | undefined;
second?: "numeric" | "2-digit" | undefined;
timeZoneName?: "long" | "short" | undefined;
formatMatcher?: "best fit" | "basic" | undefined;
hour12?: boolean | undefined;
timeZone?: string | undefined;
}
interface ResolvedDateTimeFormatOptions {

View file

@ -19,14 +19,5 @@ and limitations under the License.
declare namespace Intl {
type NumberFormatPartTypes = "compact" | "currency" | "decimal" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "fraction" | "group" | "infinity" | "integer" | "literal" | "minusSign" | "nan" | "plusSign" | "percentSign" | "unit" | "unknown";
interface NumberFormatPart {
type: NumberFormatPartTypes;
value: string;
}
interface NumberFormat {
formatToParts(number?: number | bigint): NumberFormatPart[];
}
// Empty for now
}

View file

@ -1,43 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface AggregateError extends Error {
errors: any[]
}
interface AggregateErrorConstructor {
new(errors: Iterable<any>, message?: string): AggregateError;
(errors: Iterable<any>, message?: string): AggregateError;
readonly prototype: AggregateError;
}
declare var AggregateError: AggregateErrorConstructor;
/**
* Represents the completion of an asynchronous operation
*/
interface PromiseConstructor {
/**
* The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
* @param values An array or iterable of Promises.
* @returns A new Promise.
*/
any<T>(values: (T | PromiseLike<T>)[] | Iterable<T | PromiseLike<T>>): Promise<T>
}

View file

@ -24,18 +24,4 @@ interface String {
* @param index index to access.
*/
at(index: number): string | undefined;
/**
* Replace all instances of a substring in a string, using a regular expression or search string.
* @param searchValue A string to search for.
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
*/
replaceAll(searchValue: string | RegExp, replaceValue: string): string;
/**
* Replace all instances of a substring in a string, using a regular expression or search string.
* @param searchValue A string to search for.
* @param replacer A function that returns the replacement text.
*/
replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
}

View file

@ -1,75 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface WeakRef<T extends object> {
readonly [Symbol.toStringTag]: "WeakRef";
/**
* Returns the WeakRef instance's target object, or undefined if the target object has been
* reclaimed.
*/
deref(): T | undefined;
}
interface WeakRefConstructor {
readonly prototype: WeakRef<any>;
/**
* Creates a WeakRef instance for the given target object.
* @param target The target object for the WeakRef instance.
*/
new<T extends object>(target?: T): WeakRef<T>;
}
declare var WeakRef: WeakRefConstructor;
interface FinalizationRegistry {
readonly [Symbol.toStringTag]: "FinalizationRegistry";
/**
* Registers an object with the registry.
* @param target The target object to register.
* @param heldValue The value to pass to the finalizer for this object. This cannot be the
* target object.
* @param unregisterToken The token to pass to the unregister method to unregister the target
* object. If provided (and not undefined), this must be an object. If not provided, the target
* cannot be unregistered.
*/
register(target: object, heldValue: any, unregisterToken?: object): void;
/**
* Unregisters an object from the registry.
* @param unregisterToken The token that was used as the unregisterToken argument when calling
* register to register the target object.
*/
unregister(unregisterToken: object): void;
}
interface FinalizationRegistryConstructor {
readonly prototype: FinalizationRegistry;
/**
* Creates a finalization registry with an associated cleanup callback
* @param cleanupCallback The callback to call after an object in the registry has been reclaimed.
*/
new(cleanupCallback: (heldValue: any) => void): FinalizationRegistry;
}
declare var FinalizationRegistry: FinalizationRegistryConstructor;

File diff suppressed because it is too large Load diff

View file

@ -39,40 +39,26 @@ interface FontFaceSet extends Set<FontFace> {
interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
/**
* Returns an array of key, value pairs for every entry in the list.
*/
/** Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[string, FormDataEntryValue]>;
/**
* Returns a list of keys in the list.
*/
/** Returns a list of keys in the list. */
keys(): IterableIterator<string>;
/**
* Returns a list of values in the list.
*/
/** Returns a list of values in the list. */
values(): IterableIterator<FormDataEntryValue>;
}
interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all key/value pairs contained in this object.
*/
/** Returns an iterator allowing to go through all key/value pairs contained in this object. */
entries(): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
*/
/** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
keys(): IterableIterator<string>;
/**
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
*/
/** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
}
interface IDBDatabase {
/**
* Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
*/
/** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */
transaction(storeNames: string | Iterable<string>, mode?: IDBTransactionMode): IDBTransaction;
}
@ -90,13 +76,6 @@ interface MessageEvent<T = any> {
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
}
interface ReadableStream<R = any> {
[Symbol.iterator](): IterableIterator<any>;
entries(): IterableIterator<[number, any]>;
keys(): IterableIterator<number>;
values(): IterableIterator<any>;
}
interface SubtleCrypto {
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
@ -109,17 +88,11 @@ interface SubtleCrypto {
interface URLSearchParams {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
* Returns an array of key, value pairs for every entry in the search params.
*/
/** Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[string, string]>;
/**
* Returns a list of keys in the search params.
*/
/** Returns a list of keys in the search params. */
keys(): IterableIterator<string>;
/**
* Returns a list of values in the search params.
*/
/** Returns a list of values in the search params. */
values(): IterableIterator<string>;
}

File diff suppressed because it is too large Load diff

View file

@ -250,9 +250,11 @@ fn get_root_names(
.into_iter()
.filter_map(|(_, r)| match r {
Ok((s, mt)) => match &mt {
MediaType::TypeScript | MediaType::Tsx | MediaType::Jsx => {
Some((s, mt))
}
MediaType::TypeScript
| MediaType::Tsx
| MediaType::Mts
| MediaType::Cts
| MediaType::Jsx => Some((s, mt)),
_ => None,
},
_ => None,
@ -279,7 +281,7 @@ fn get_version(source_bytes: &[u8], config_bytes: &[u8]) -> String {
}
/// Determine if a given media type is emittable or not.
fn is_emittable(media_type: &MediaType, include_js: bool) -> bool {
pub(crate) fn is_emittable(media_type: &MediaType, include_js: bool) -> bool {
match &media_type {
MediaType::TypeScript
| MediaType::Mts

View file

@ -455,12 +455,17 @@ impl Document {
pub fn is_diagnosable(&self) -> bool {
matches!(
self.media_type(),
// todo(#12410): Update with new media types for TS 4.5
MediaType::JavaScript
| MediaType::Jsx
| MediaType::Mjs
| MediaType::Cjs
| MediaType::TypeScript
| MediaType::Tsx
| MediaType::Mts
| MediaType::Cts
| MediaType::Dts
| MediaType::Dmts
| MediaType::Dcts
)
}

View file

@ -326,12 +326,17 @@ impl Inner {
if specifier.scheme() == "asset" {
matches!(
MediaType::from(specifier),
// todo(#12410): Update with new media types for TS 4.5
MediaType::JavaScript
| MediaType::Jsx
| MediaType::Mjs
| MediaType::Cjs
| MediaType::TypeScript
| MediaType::Tsx
| MediaType::Mts
| MediaType::Cts
| MediaType::Dts
| MediaType::Dmts
| MediaType::Dcts
)
} else {
self

View file

@ -586,14 +586,17 @@ impl ProcState {
| MediaType::Mjs
) {
module.source.as_str().to_string()
// The emit may also be missing when a `.dts` file is in the
// The emit may also be missing when a declaration file is in the
// graph. There shouldn't be any runtime statements in the source
// file and if there was, users would be shown a `TS1036`
// diagnostic. So just return an empty emit.
} else if media_type == &MediaType::Dts {
} else if !emit::is_emittable(media_type, true) {
"".to_string()
} else {
unreachable!("unexpected missing emit: {}", specifier)
unreachable!(
"unexpected missing emit: {} media type: {}",
specifier, media_type
)
};
let dependencies = module.dependencies.clone();
let module_entry = ModuleEntry::Module { code, dependencies };

View file

@ -563,6 +563,26 @@ itest!(fetch_response_finalization {
exit_code: 0,
});
itest!(import_type {
args: "run --reload import_type.ts",
output: "import_type.ts.out",
});
itest!(import_type_no_check {
args: "run --reload --no-check import_type.ts",
output: "import_type.ts.out",
});
itest!(private_field_presence {
args: "run --reload private_field_presence.ts",
output: "private_field_presence.ts.out",
});
itest!(private_field_presence_no_check {
args: "run --reload --no-check private_field_presence.ts",
output: "private_field_presence.ts.out",
});
itest!(lock_write_requires_lock {
args: "run --lock-write some_file.ts",
output: "lock_write_requires_lock.out",
@ -611,6 +631,16 @@ itest!(lock_check_err2 {
http_server: true,
});
itest!(mts_dmts_mjs {
args: "run subdir/import.mts",
output: "mts_dmts_mjs.out",
});
itest!(mts_dmts_mjs_no_check {
args: "run --no-check subdir/import.mts",
output: "mts_dmts_mjs.out",
});
itest!(async_error {
exit_code: 1,
args: "run --reload async_error.ts",

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file no-window-prefix
import { assert } from "../../../../test_util/std/testing/asserts.ts";
import "./nest_imported.ts";

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file no-window-prefix no-prototype-builtins
import { assert } from "../../../../test_util/std/testing/asserts.ts";
import "./imported.ts";

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file no-window-prefix
import { assert } from "../../../../test_util/std/testing/asserts.ts";
const handler = (e: Event) => {

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file no-window-prefix
console.log("sync 1");
setTimeout(() => {
console.log("setTimeout 1");

5
cli/tests/testdata/import_type.ts vendored Normal file
View file

@ -0,0 +1,5 @@
import { type B, create } from "./subdir/export_types.ts";
const b: B = create();
console.log(b);

2
cli/tests/testdata/import_type.ts.out vendored Normal file
View file

@ -0,0 +1,2 @@
[WILDCARD]
B { a: "a" }

View file

@ -1 +1,2 @@
// deno-lint-ignore-file no-var
declare var a: string;

View file

@ -1 +1,2 @@
// deno-lint-ignore-file no-var
declare var b: string;

2
cli/tests/testdata/mts_dmts_mjs.out vendored Normal file
View file

@ -0,0 +1,2 @@
[WILDCARD]
a

View file

@ -0,0 +1,20 @@
export class Person {
#name: string;
constructor(name: string) {
this.#name = name;
}
equals(other: unknown) {
return other &&
typeof other === "object" &&
#name in other &&
this.#name === other.#name;
}
}
const a = new Person("alice");
const b = new Person("bob");
const c = new Person("alice");
console.log(a.equals(b));
console.log(a.equals(c));

View file

@ -0,0 +1,3 @@
[WILDCARD]
false
true

View file

@ -0,0 +1,11 @@
export interface A {
a: string;
}
export class B implements A {
a = "a";
}
export function create(): B {
return new B();
}

4
cli/tests/testdata/subdir/import.mts vendored Normal file
View file

@ -0,0 +1,4 @@
import * as a from "./mod.mjs";
import { type A } from "./types.d.mts";
console.log(a.a as A);

1
cli/tests/testdata/subdir/mod.mjs vendored Normal file
View file

@ -0,0 +1 @@
export const a = "a";

1
cli/tests/testdata/subdir/types.d.mts vendored Normal file
View file

@ -0,0 +1 @@
export type A = "a";

View file

@ -1 +1,2 @@
// deno-lint-ignore-file no-var
declare var a: string;

View file

@ -8,6 +8,7 @@ Deno.test(function version() {
assert(
pattern.test(Deno.version.typescript) ||
Deno.version.typescript === "0-dev" ||
Deno.version.typescript === "0-beta",
Deno.version.typescript === "0-beta" ||
Deno.version.typescript === "1-rc",
);
});

View file

@ -144,31 +144,26 @@ fn get_tsc_media_type(specifier: &ModuleSpecifier) -> MediaType {
if let Some(os_str) = path.file_stem() {
if let Some(file_name) = os_str.to_str() {
if file_name.ends_with(".d") {
// todo(#12410): Use Dmts for TS 4.5
return MediaType::Dts;
return MediaType::Dmts;
}
}
}
// todo(#12410): Use Mts for TS 4.5
MediaType::TypeScript
MediaType::Mts
}
Some("cts") => {
if let Some(os_str) = path.file_stem() {
if let Some(file_name) = os_str.to_str() {
if file_name.ends_with(".d") {
// todo(#12410): Use Dcts for TS 4.5
return MediaType::Dts;
return MediaType::Dcts;
}
}
}
// todo(#12410): Use Cts for TS 4.5
MediaType::TypeScript
MediaType::Cts
}
Some("tsx") => MediaType::Tsx,
Some("js") => MediaType::JavaScript,
// todo(#12410): Use correct media type for TS 4.5
Some("mjs") => MediaType::JavaScript,
Some("cjs") => MediaType::JavaScript,
Some("mjs") => MediaType::Mjs,
Some("cjs") => MediaType::Cjs,
Some("jsx") => MediaType::Jsx,
_ => MediaType::Unknown,
},
@ -756,16 +751,16 @@ mod tests {
fn test_get_tsc_media_type() {
let fixtures = vec![
("file:///a.ts", MediaType::TypeScript),
("file:///a.cts", MediaType::TypeScript),
("file:///a.mts", MediaType::TypeScript),
("file:///a.cts", MediaType::Cts),
("file:///a.mts", MediaType::Mts),
("file:///a.tsx", MediaType::Tsx),
("file:///a.d.ts", MediaType::Dts),
("file:///a.d.cts", MediaType::Dts),
("file:///a.d.mts", MediaType::Dts),
("file:///a.d.cts", MediaType::Dcts),
("file:///a.d.mts", MediaType::Dmts),
("file:///a.js", MediaType::JavaScript),
("file:///a.jsx", MediaType::Jsx),
("file:///a.cjs", MediaType::JavaScript),
("file:///a.mjs", MediaType::JavaScript),
("file:///a.cjs", MediaType::Cjs),
("file:///a.mjs", MediaType::Mjs),
("file:///a.json", MediaType::Unknown),
("file:///a.wasm", MediaType::Unknown),
("file:///a.js.map", MediaType::Unknown),

22574
cli/tsc/00_typescript.js vendored

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-explicit-any
// deno-lint-ignore-file no-explicit-any no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,5 +1,7 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-explicit-any
// deno-lint-ignore-file no-explicit-any no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-explicit-any
// deno-lint-ignore-file no-explicit-any no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,5 +1,7 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,5 +1,7 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-explicit-any
// deno-lint-ignore-file no-explicit-any no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-explicit-any
// deno-lint-ignore-file no-explicit-any no-var
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />

@ -1 +1 @@
Subproject commit bc48d4631492b5998795c41b192dee40e6047d95
Subproject commit 233e6ffcd1af061e63a6bab810eb810f2bbae4bd

View file

@ -20,8 +20,6 @@ async function dlint() {
":!:cli/tests/testdata/swc_syntax_error.ts",
":!:cli/tests/testdata/038_checkjs.js",
":!:cli/tests/testdata/error_008_checkjs.js",
":!:std/**/testdata/*",
":!:std/**/node_modules/*",
":!:cli/bench/node*.js",
":!:cli/compilers/wasm_wrap.js",
":!:cli/dts/**",
@ -31,6 +29,7 @@ async function dlint() {
":!:cli/tests/testdata/lint/**",
":!:cli/tests/testdata/tsc/**",
":!:cli/tsc/*typescript.js",
":!:cli/tsc/compiler.d.ts",
":!:test_util/wpt/**",
]);