feat(cli): Update to TypeScript 4.4 (#11678)

This commit is contained in:
Kitson Kelly 2021-08-27 10:12:59 +10:00 committed by GitHub
parent b9a965c607
commit 935133f53a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 18623 additions and 15871 deletions

View file

@ -133,9 +133,7 @@ fn create_compiler_snapshot(
"esnext.error",
"esnext.intl",
"esnext.object",
"esnext.promise",
"esnext.string",
"esnext.weakref",
];
let path_dts = cwd.join("dts");

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

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,7 @@ and limitations under the License.
/////////////////////////////
/// DOM Iterable APIs
/// Window Iterable APIs
/////////////////////////////
interface AudioParam {
@ -50,10 +50,6 @@ interface CanvasPathDrawingStyles {
setLineDash(segments: Iterable<number>): void;
}
interface ClientRectList {
[Symbol.iterator](): IterableIterator<ClientRect>;
}
interface DOMRectList {
[Symbol.iterator](): IterableIterator<DOMRect>;
}
@ -77,6 +73,9 @@ interface FileList {
[Symbol.iterator](): IterableIterator<File>;
}
interface FontFaceSet extends Set<FontFace> {
}
interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
/**
@ -110,7 +109,7 @@ interface HTMLFormElement {
}
interface HTMLSelectElement {
[Symbol.iterator](): IterableIterator<Element>;
[Symbol.iterator](): IterableIterator<HTMLOptionElement>;
}
interface Headers {
@ -156,6 +155,11 @@ interface MediaList {
[Symbol.iterator](): IterableIterator<string>;
}
interface MessageEvent<T = any> {
/** @deprecated */
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
}
interface MimeTypeArray {
[Symbol.iterator](): IterableIterator<MimeType>;
}
@ -166,6 +170,7 @@ interface NamedNodeMap {
interface Navigator {
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
vibrate(pattern: Iterable<number>): boolean;
}
interface NodeList {
@ -208,11 +213,14 @@ interface PluginArray {
[Symbol.iterator](): IterableIterator<Plugin>;
}
interface RTCRtpTransceiver {
setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void;
interface RTCStatsReport extends ReadonlyMap<string, any> {
}
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 {
@ -231,12 +239,12 @@ interface SVGStringList {
[Symbol.iterator](): IterableIterator<string>;
}
interface SourceBufferList {
[Symbol.iterator](): IterableIterator<SourceBuffer>;
interface SVGTransformList {
[Symbol.iterator](): IterableIterator<SVGTransform>;
}
interface SpeechGrammarList {
[Symbol.iterator](): IterableIterator<SpeechGrammar>;
interface SourceBufferList {
[Symbol.iterator](): IterableIterator<SourceBuffer>;
}
interface SpeechRecognitionResult {
@ -251,6 +259,16 @@ interface StyleSheetList {
[Symbol.iterator](): IterableIterator<CSSStyleSheet>;
}
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>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKeyPair | CryptoKey>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
}
interface TextTrackCueList {
[Symbol.iterator](): IterableIterator<TextTrackCue>;
}
@ -279,10 +297,6 @@ interface URLSearchParams {
values(): IterableIterator<string>;
}
interface VRDisplay {
requestPresent(layers: Iterable<VRLayer>): Promise<void>;
}
interface WEBGL_draw_buffers {
drawBuffersWEBGL(buffers: Iterable<GLenum>): void;
}

View file

@ -43,7 +43,7 @@ interface Array<T> {
findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -507,11 +507,13 @@ interface StringConstructor {
fromCodePoint(...codePoints: number[]): string;
/**
* String.raw is intended for use as a tag function of a Tagged Template String. When called
* as such the first argument will be a well formed template call site object and the rest
* parameter will contain the substitution values.
* String.raw is usually used as a tag function of a Tagged Template String. When called as
* such, the first argument will be a well formed template call site object and the rest
* parameter will contain the substitution values. It can also be called directly, for example,
* to interleave strings and values from your own tag function, and in this case the only thing
* it needs from the first argument is the raw property.
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
raw(template: { raw: readonly string[] | ArrayLike<string>}, ...substitutions: any[]): string;
}

View file

@ -163,7 +163,7 @@ interface MapConstructor {
interface WeakMap<K extends object, V> { }
interface WeakMapConstructor {
new <K extends object, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
new <K extends object, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
}
interface Set<T> {

View file

@ -239,9 +239,9 @@ interface String {
match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;
/**
* Replaces text in a string, using an object that supports replacement within a string.
* @param searchValue A object can search for and replace matches within a string.
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
* Replaces first match with string or all matches with RegExp.
* @param searchValue A string or RegExp search value.
* @param replaceValue A string containing the text to replace for match.
*/
replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;

View file

@ -184,7 +184,7 @@ interface BigInt64Array {
every(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -456,7 +456,7 @@ interface BigUint64Array {
every(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.

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

@ -1796,7 +1796,7 @@ interface Int8Array {
every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -2078,7 +2078,7 @@ interface Uint8Array {
every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -2360,7 +2360,7 @@ interface Uint8ClampedArray {
every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -2641,7 +2641,7 @@ interface Int16Array {
every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -2923,7 +2923,7 @@ interface Uint16Array {
every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -3205,7 +3205,7 @@ interface Int32Array {
every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -3487,7 +3487,7 @@ interface Uint32Array {
every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -3768,7 +3768,7 @@ interface Float32Array {
every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
@ -4051,7 +4051,7 @@ interface Float64Array {
every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.

View file

@ -27,6 +27,6 @@ declare namespace Intl {
}
interface NumberFormat {
formatToParts(number?: number): NumberFormatPart[];
formatToParts(number?: number | bigint): NumberFormatPart[];
}
}

View file

@ -13,12 +13,29 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/**
* Access string by relative indexing.
* @param index index to access.
*/
at(index: number): string | undefined;
/**
* Access string by relative indexing.
* @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;
}

File diff suppressed because it is too large Load diff

View file

@ -26,10 +26,6 @@ interface Cache {
addAll(requests: Iterable<RequestInfo>): Promise<void>;
}
interface CanvasPathDrawingStyles {
setLineDash(segments: Iterable<number>): void;
}
interface DOMStringList {
[Symbol.iterator](): IterableIterator<string>;
}
@ -38,6 +34,9 @@ interface FileList {
[Symbol.iterator](): IterableIterator<File>;
}
interface FontFaceSet extends Set<FontFace> {
}
interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>;
/**
@ -86,6 +85,28 @@ interface IDBObjectStore {
createIndex(name: string, keyPath: string | Iterable<string>, options?: IDBIndexParameters): IDBIndex;
}
interface MessageEvent<T = any> {
/** @deprecated */
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>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKeyPair | CryptoKey>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: Exclude<KeyFormat, "jwk">, keyData: BufferSource, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
}
interface URLSearchParams {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**

File diff suppressed because it is too large Load diff

View file

@ -581,6 +581,8 @@ impl Inner {
"strict": true,
"target": "esnext",
"useDefineForClassFields": true,
// TODO(@kitsonk) remove for Deno 1.15
"useUnknownInCatchVariables": false,
}));
let (maybe_config, maybe_root_uri) = {
let config = &self.config;

View file

@ -3304,7 +3304,28 @@ mod tests {
);
assert!(result.is_ok());
let response = result.unwrap();
assert_eq!(response, json!({}));
assert_eq!(
response,
json!({
"file:///a.ts": [
{
"start": {
"line": 0,
"character": 35,
},
"end": {
"line": 0,
"character": 35
},
"fileName": "file:///a.ts",
"messageText": "Identifier expected.",
"sourceLine": "const url = new URL(\"b.js\", import.",
"category": 1,
"code": 1003,
}
]
})
);
}
#[test]

View file

@ -831,6 +831,8 @@ impl Graph {
"target": "esnext",
"tsBuildInfoFile": "deno:///.tsbuildinfo",
"useDefineForClassFields": true,
// TODO(@kitsonk) remove for Deno 1.15
"useUnknownInCatchVariables": false,
}));
if options.emit {
config.merge(&json!({
@ -991,6 +993,8 @@ impl Graph {
"strict": true,
"target": "esnext",
"useDefineForClassFields": true,
// TODO(@kitsonk) remove for Deno 1.15
"useUnknownInCatchVariables": false,
}));
let opts = match options.bundle_type {
BundleType::Module | BundleType::Classic => json!({

View file

@ -2430,7 +2430,7 @@ fn lsp_completions_optional() {
{
"label": "b?",
"kind": 5,
"sortText": "1",
"sortText": "11",
"filterText": "b",
"insertText": "b",
"data": {

26726
cli/tsc/00_typescript.js vendored

File diff suppressed because one or more lines are too long