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

feat: TypeScript 5.6 and npm:@types/node@22 (#25614)

This commit is contained in:
David Sherret 2024-09-14 11:58:47 +01:00 committed by GitHub
parent 2c0bf6fd65
commit af2d992ecd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 6145 additions and 4998 deletions

4
Cargo.lock generated
View file

@ -1375,9 +1375,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_config" name = "deno_config"
version = "0.34.0" version = "0.34.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "353595ebd9d19602f4cc0bb5613ae8bf036fb23ce1e6638eec594a63b1f8d48a" checksum = "764368ba1424ea74f9a28d8e2e7633f57d008e73f76b12bc272f6d5903ca1e08"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_package_json", "deno_package_json",

View file

@ -65,7 +65,7 @@ winres.workspace = true
[dependencies] [dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] } deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_cache_dir = { workspace = true } deno_cache_dir = { workspace = true }
deno_config = { version = "=0.34.0", features = ["workspace", "sync"] } deno_config = { version = "=0.34.2", features = ["workspace", "sync"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "0.148.0", features = ["html", "syntect"] } deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
deno_graph = { version = "=0.82.1" } deno_graph = { version = "=0.82.1" }

View file

@ -13,7 +13,6 @@ mod ts {
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::op2; use deno_core::op2;
use deno_core::OpState; use deno_core::OpState;
use deno_runtime::deno_node::SUPPORTED_BUILTIN_NODE_MODULES;
use serde::Serialize; use serde::Serialize;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::Write; use std::io::Write;
@ -25,7 +24,6 @@ mod ts {
struct BuildInfoResponse { struct BuildInfoResponse {
build_specifier: String, build_specifier: String,
libs: Vec<String>, libs: Vec<String>,
node_built_in_module_names: Vec<String>,
} }
#[op2] #[op2]
@ -37,14 +35,9 @@ mod ts {
.iter() .iter()
.map(|s| s.to_string()) .map(|s| s.to_string())
.collect(); .collect();
let node_built_in_module_names = SUPPORTED_BUILTIN_NODE_MODULES
.iter()
.map(|s| s.to_string())
.collect();
BuildInfoResponse { BuildInfoResponse {
build_specifier, build_specifier,
libs: build_libs, libs: build_libs,
node_built_in_module_names,
} }
} }
@ -243,6 +236,7 @@ mod ts {
"esnext.decorators", "esnext.decorators",
"esnext.disposable", "esnext.disposable",
"esnext.intl", "esnext.intl",
"esnext.iterator",
"esnext.object", "esnext.object",
"esnext.promise", "esnext.promise",
"esnext.regexp", "esnext.regexp",
@ -446,7 +440,7 @@ fn main() {
); );
let ts_version = ts::version(); let ts_version = ts::version();
debug_assert_eq!(ts_version, "5.5.2"); // bump this assertion when it changes debug_assert_eq!(ts_version, "5.6.2"); // bump this assertion when it changes
println!("cargo:rustc-env=TS_VERSION={}", ts_version); println!("cargo:rustc-env=TS_VERSION={}", ts_version);
println!("cargo:rerun-if-env-changed=TS_VERSION"); println!("cargo:rerun-if-env-changed=TS_VERSION");

View file

@ -5475,7 +5475,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"noEmit": true, "noEmit": true,
"lib": [], "lib": [],
}), }),
@ -5521,7 +5520,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"jsx": "react", "jsx": "react",
"lib": ["esnext", "dom", "deno.ns"], "lib": ["esnext", "dom", "deno.ns"],
"noEmit": true, "noEmit": true,
@ -5547,7 +5545,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -5578,7 +5575,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -5624,7 +5620,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -5655,7 +5650,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -5722,7 +5716,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -5800,7 +5793,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, cache) = setup( let (temp_dir, ts_server, snapshot, cache) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -5942,7 +5934,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -6093,7 +6084,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -6202,7 +6192,6 @@ mod tests {
let (temp_dir, ts_server, snapshot, _) = setup( let (temp_dir, ts_server, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),
@ -6273,7 +6262,6 @@ mod tests {
let (temp_dir, _, snapshot, _) = setup( let (temp_dir, _, snapshot, _) = setup(
json!({ json!({
"target": "esnext", "target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"], "lib": ["deno.ns", "deno.window"],
"noEmit": true, "noEmit": true,
}), }),

View file

@ -318,7 +318,7 @@ fn get_npm_pending_resolver(
// WARNING: When bumping this version, check if anything needs to be // WARNING: When bumping this version, check if anything needs to be
// updated in the `setNodeOnlyGlobalNames` call in 99_main_compiler.js // updated in the `setNodeOnlyGlobalNames` call in 99_main_compiler.js
types_node_version_req: Some( types_node_version_req: Some(
VersionReq::parse_from_npm("18.0.0 - 18.16.19").unwrap(), VersionReq::parse_from_npm("22.0.0 - 22.5.4").unwrap(),
), ),
}, },
) )

View file

@ -84,7 +84,9 @@ impl TypeChecker {
graph: ModuleGraph, graph: ModuleGraph,
options: CheckOptions, options: CheckOptions,
) -> Result<Arc<ModuleGraph>, AnyError> { ) -> Result<Arc<ModuleGraph>, AnyError> {
let (graph, diagnostics) = self.check_diagnostics(graph, options).await?; let (graph, mut diagnostics) =
self.check_diagnostics(graph, options).await?;
diagnostics.emit_warnings();
if diagnostics.is_empty() { if diagnostics.is_empty() {
Ok(graph) Ok(graph)
} else { } else {

8153
cli/tsc/00_typescript.js vendored

File diff suppressed because it is too large Load diff

View file

@ -462,6 +462,8 @@ delete Object.prototype.__proto__;
// TS2792: Cannot find module. Did you mean to set the 'moduleResolution' // TS2792: Cannot find module. Did you mean to set the 'moduleResolution'
// option to 'node', or to add aliases to the 'paths' option? // option to 'node', or to add aliases to the 'paths' option?
2792, 2792,
// TS2307: Cannot find module '{0}' or its corresponding type declarations.
2307,
// TS5009: Cannot find the common subdirectory path for the input files. // TS5009: Cannot find the common subdirectory path for the input files.
5009, 5009,
// TS5055: Cannot write file // TS5055: Cannot write file
@ -942,6 +944,8 @@ delete Object.prototype.__proto__;
Object.assign(options, { Object.assign(options, {
allowNonTsExtensions: true, allowNonTsExtensions: true,
allowImportingTsExtensions: true, allowImportingTsExtensions: true,
module: ts.ModuleKind.NodeNext,
moduleResolution: ts.ModuleResolutionKind.NodeNext,
}); });
if (errors.length > 0 && logDebug) { if (errors.length > 0 && logDebug) {
debug(ts.formatDiagnostics(errors, host)); debug(ts.formatDiagnostics(errors, host));
@ -1021,7 +1025,7 @@ delete Object.prototype.__proto__;
: ts.sortAndDeduplicateDiagnostics( : ts.sortAndDeduplicateDiagnostics(
checkFiles.map((s) => program.getSemanticDiagnostics(s)).flat(), checkFiles.map((s) => program.getSemanticDiagnostics(s)).flat(),
)), )),
].filter((diagnostic) => !IGNORED_DIAGNOSTICS.includes(diagnostic.code)); ].filter(filterMapDiagnostic);
// emit the tsbuildinfo file // emit the tsbuildinfo file
// @ts-ignore: emitBuildInfo is not exposed (https://github.com/microsoft/TypeScript/issues/49871) // @ts-ignore: emitBuildInfo is not exposed (https://github.com/microsoft/TypeScript/issues/49871)
@ -1036,6 +1040,27 @@ delete Object.prototype.__proto__;
debug("<<< exec stop"); debug("<<< exec stop");
} }
/** @param {ts.Diagnostic} diagnostic */
function filterMapDiagnostic(diagnostic) {
if (IGNORED_DIAGNOSTICS.includes(diagnostic.code)) {
return false;
}
// make the diagnostic for using an `export =` in an es module a warning
if (diagnostic.code === 1203) {
diagnostic.category = ts.DiagnosticCategory.Warning;
if (typeof diagnostic.messageText === "string") {
const message =
" This will start erroring in a future version of Deno 2 " +
"in order to align with TypeScript.";
// seems typescript shares objects, so check if it's already been set
if (!diagnostic.messageText.endsWith(message)) {
diagnostic.messageText += message;
}
}
}
return true;
}
/** /**
* @param {any} e * @param {any} e
* @returns {e is (OperationCanceledError | ts.OperationCanceledException)} * @returns {e is (OperationCanceledError | ts.OperationCanceledException)}
@ -1107,7 +1132,8 @@ delete Object.prototype.__proto__;
"experimentalDecorators": false, "experimentalDecorators": false,
"isolatedModules": true, "isolatedModules": true,
"lib": ["deno.ns", "deno.window", "deno.unstable"], "lib": ["deno.ns", "deno.window", "deno.unstable"],
"module": "esnext", "module": "NodeNext",
"moduleResolution": "NodeNext",
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": true, "noEmit": true,
"resolveJsonModule": true, "resolveJsonModule": true,
@ -1249,7 +1275,7 @@ delete Object.prototype.__proto__;
...ls.getSemanticDiagnostics(specifier), ...ls.getSemanticDiagnostics(specifier),
...ls.getSuggestionDiagnostics(specifier), ...ls.getSuggestionDiagnostics(specifier),
...ls.getSyntacticDiagnostics(specifier), ...ls.getSyntacticDiagnostics(specifier),
].filter(({ code }) => !IGNORED_DIAGNOSTICS.includes(code))); ].filter(filterMapDiagnostic));
} }
return respond(id, diagnosticMap); return respond(id, diagnosticMap);
} catch (e) { } catch (e) {
@ -1295,48 +1321,38 @@ delete Object.prototype.__proto__;
// A build time only op that provides some setup information that is used to // A build time only op that provides some setup information that is used to
// ensure the snapshot is setup properly. // ensure the snapshot is setup properly.
/** @type {{ buildSpecifier: string; libs: string[]; nodeBuiltInModuleNames: string[] }} */ /** @type {{ buildSpecifier: string; libs: string[]; nodeBuiltInModuleNames: string[] }} */
const { buildSpecifier, libs, nodeBuiltInModuleNames } = ops.op_build_info(); const { buildSpecifier, libs } = ops.op_build_info();
ts.deno.setNodeBuiltInModuleNames(nodeBuiltInModuleNames);
// list of globals that should be kept in Node's globalThis // list of globals that should be kept in Node's globalThis
ts.deno.setNodeOnlyGlobalNames([ ts.deno.setNodeOnlyGlobalNames([
// when bumping the @types/node version we should check if
// anything needs to be updated here
"NodeRequire",
"RequireResolve",
"RequireResolve",
"process",
"console",
"__filename",
"__dirname", "__dirname",
"require", "__filename",
"module", "Buffer",
"BufferConstructor",
"BufferEncoding",
"clearImmediate",
"clearInterval",
"clearTimeout",
"console",
"Console",
"ErrorConstructor",
"exports", "exports",
"gc", "gc",
"BufferEncoding",
"BufferConstructor",
"WithImplicitCoercion",
"Buffer",
"Console",
"ImportMeta",
"setTimeout",
"setInterval",
"setImmediate",
"Global", "Global",
"AbortController", "ImportMeta",
"AbortSignal", "localStorage",
"Blob", "module",
"BroadcastChannel", "NodeModule",
"MessageChannel", "NodeRequire",
"MessagePort", "process",
"Event", "queueMicrotask",
"EventTarget", "RequestInit",
"performance", "require",
"TextDecoder", "ResponseInit",
"TextEncoder", "sessionStorage",
"URL", "setImmediate",
"URLSearchParams", "setInterval",
"setTimeout",
]); ]);
for (const lib of libs) { for (const lib of libs) {

64
cli/tsc/_analyze_types_node.ts Executable file
View file

@ -0,0 +1,64 @@
#!/usr/bin/env -S deno run --allow-env --allow-read --allow-write=.
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import {
ModuleDeclarationKind,
Node,
Project,
ts,
} from "jsr:@ts-morph/ts-morph@23";
import { Path } from "jsr:@david/path@0.2";
const dir = new Path(import.meta.dirname!);
const typesNodeDir = dir.join("../../../DefinitelyTyped/types/node");
const project = new Project({
tsConfigFilePath: typesNodeDir.join("tsconfig.json").toString(),
});
const names = new Set<string>();
const ignoredNames = new Set<string>([
"Array",
"BigInt64Array",
"BigUint64Array",
"Float32Array",
"Float64Array",
"Int16Array",
"Int32Array",
"Int8Array",
"NodeJS",
"ReadonlyArray",
"RelativeIndexable",
"RequireResolve",
"String",
"SymbolConstructor",
"Uint16Array",
"Uint32Array",
"Uint8Array",
"Uint8ClampedArray",
"WithImplicitCoercion",
]);
for (const file of project.getSourceFiles()) {
for (
const mod of file.getDescendantsOfKind(ts.SyntaxKind.ModuleDeclaration)
) {
if (mod.getDeclarationKind() !== ModuleDeclarationKind.Global) continue;
for (const statement of mod.getStatements()) {
if (Node.isVariableStatement(statement)) {
for (const decl of statement.getDeclarations()) {
if (ignoredNames.has(decl.getName())) continue;
names.add(decl.getName());
}
} else if (Node.hasName(statement)) {
if (ignoredNames.has(statement.getName())) continue;
names.add(statement.getName());
}
}
}
}
// deno-lint-ignore no-console
console.log(
"Globals: ",
Array.from(names).sort(),
);

View file

@ -280,6 +280,17 @@ impl Diagnostics {
Diagnostics(diagnostics) Diagnostics(diagnostics)
} }
pub fn emit_warnings(&mut self) {
self.0.retain(|d| {
if d.category == DiagnosticCategory::Warning {
log::warn!("{}\n", d);
false
} else {
true
}
});
}
/// Return a set of diagnostics where only the values where the predicate /// Return a set of diagnostics where only the values where the predicate
/// returns `true` are included. /// returns `true` are included.
pub fn filter<P>(self, predicate: P) -> Self pub fn filter<P>(self, predicate: P) -> Self

View file

@ -20,14 +20,22 @@ and limitations under the License.
/// Window Async Iterable APIs /// Window Async Iterable APIs
///////////////////////////// /////////////////////////////
interface FileSystemDirectoryHandleAsyncIterator<T> extends AsyncIteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<T>;
}
interface FileSystemDirectoryHandle { interface FileSystemDirectoryHandle {
[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>; [Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>;
entries(): AsyncIterableIterator<[string, FileSystemHandle]>; entries(): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>;
keys(): AsyncIterableIterator<string>; keys(): FileSystemDirectoryHandleAsyncIterator<string>;
values(): AsyncIterableIterator<FileSystemHandle>; values(): FileSystemDirectoryHandleAsyncIterator<FileSystemHandle>;
}
interface ReadableStreamAsyncIterator<T> extends AsyncIteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
} }
interface ReadableStream<R = any> { interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
} }

1228
cli/tsc/dts/lib.dom.d.ts vendored

File diff suppressed because it is too large Load diff

View file

@ -41,36 +41,36 @@ interface BaseAudioContext {
} }
interface CSSKeyframesRule { interface CSSKeyframesRule {
[Symbol.iterator](): IterableIterator<CSSKeyframeRule>; [Symbol.iterator](): ArrayIterator<CSSKeyframeRule>;
} }
interface CSSNumericArray { interface CSSNumericArray {
[Symbol.iterator](): IterableIterator<CSSNumericValue>; [Symbol.iterator](): ArrayIterator<CSSNumericValue>;
entries(): IterableIterator<[number, CSSNumericValue]>; entries(): ArrayIterator<[number, CSSNumericValue]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<CSSNumericValue>; values(): ArrayIterator<CSSNumericValue>;
} }
interface CSSRuleList { interface CSSRuleList {
[Symbol.iterator](): IterableIterator<CSSRule>; [Symbol.iterator](): ArrayIterator<CSSRule>;
} }
interface CSSStyleDeclaration { interface CSSStyleDeclaration {
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): ArrayIterator<string>;
} }
interface CSSTransformValue { interface CSSTransformValue {
[Symbol.iterator](): IterableIterator<CSSTransformComponent>; [Symbol.iterator](): ArrayIterator<CSSTransformComponent>;
entries(): IterableIterator<[number, CSSTransformComponent]>; entries(): ArrayIterator<[number, CSSTransformComponent]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<CSSTransformComponent>; values(): ArrayIterator<CSSTransformComponent>;
} }
interface CSSUnparsedValue { interface CSSUnparsedValue {
[Symbol.iterator](): IterableIterator<CSSUnparsedSegment>; [Symbol.iterator](): ArrayIterator<CSSUnparsedSegment>;
entries(): IterableIterator<[number, CSSUnparsedSegment]>; entries(): ArrayIterator<[number, CSSUnparsedSegment]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<CSSUnparsedSegment>; values(): ArrayIterator<CSSUnparsedSegment>;
} }
interface Cache { interface Cache {
@ -92,72 +92,80 @@ interface CustomStateSet extends Set<string> {
} }
interface DOMRectList { interface DOMRectList {
[Symbol.iterator](): IterableIterator<DOMRect>; [Symbol.iterator](): ArrayIterator<DOMRect>;
} }
interface DOMStringList { interface DOMStringList {
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): ArrayIterator<string>;
} }
interface DOMTokenList { interface DOMTokenList {
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): ArrayIterator<string>;
entries(): IterableIterator<[number, string]>; entries(): ArrayIterator<[number, string]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<string>; values(): ArrayIterator<string>;
} }
interface DataTransferItemList { interface DataTransferItemList {
[Symbol.iterator](): IterableIterator<DataTransferItem>; [Symbol.iterator](): ArrayIterator<DataTransferItem>;
} }
interface EventCounts extends ReadonlyMap<string, number> { interface EventCounts extends ReadonlyMap<string, number> {
} }
interface FileList { interface FileList {
[Symbol.iterator](): IterableIterator<File>; [Symbol.iterator](): ArrayIterator<File>;
} }
interface FontFaceSet extends Set<FontFace> { interface FontFaceSet extends Set<FontFace> {
} }
interface FormDataIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): FormDataIterator<T>;
}
interface FormData { interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>; [Symbol.iterator](): FormDataIterator<[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]>; entries(): FormDataIterator<[string, FormDataEntryValue]>;
/** Returns a list of keys in the list. */ /** Returns a list of keys in the list. */
keys(): IterableIterator<string>; keys(): FormDataIterator<string>;
/** Returns a list of values in the list. */ /** Returns a list of values in the list. */
values(): IterableIterator<FormDataEntryValue>; values(): FormDataIterator<FormDataEntryValue>;
} }
interface HTMLAllCollection { interface HTMLAllCollection {
[Symbol.iterator](): IterableIterator<Element>; [Symbol.iterator](): ArrayIterator<Element>;
} }
interface HTMLCollectionBase { interface HTMLCollectionBase {
[Symbol.iterator](): IterableIterator<Element>; [Symbol.iterator](): ArrayIterator<Element>;
} }
interface HTMLCollectionOf<T extends Element> { interface HTMLCollectionOf<T extends Element> {
[Symbol.iterator](): IterableIterator<T>; [Symbol.iterator](): ArrayIterator<T>;
} }
interface HTMLFormElement { interface HTMLFormElement {
[Symbol.iterator](): IterableIterator<Element>; [Symbol.iterator](): ArrayIterator<Element>;
} }
interface HTMLSelectElement { interface HTMLSelectElement {
[Symbol.iterator](): IterableIterator<HTMLOptionElement>; [Symbol.iterator](): ArrayIterator<HTMLOptionElement>;
}
interface HeadersIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): HeadersIterator<T>;
} }
interface Headers { interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>; [Symbol.iterator](): HeadersIterator<[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]>; entries(): HeadersIterator<[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>; keys(): HeadersIterator<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>; values(): HeadersIterator<string>;
} }
interface Highlight extends Set<AbstractRange> { interface Highlight extends Set<AbstractRange> {
@ -197,32 +205,32 @@ interface MIDIOutput {
interface MIDIOutputMap extends ReadonlyMap<string, MIDIOutput> { interface MIDIOutputMap extends ReadonlyMap<string, MIDIOutput> {
} }
interface MediaKeyStatusMapIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): MediaKeyStatusMapIterator<T>;
}
interface MediaKeyStatusMap { interface MediaKeyStatusMap {
[Symbol.iterator](): IterableIterator<[BufferSource, MediaKeyStatus]>; [Symbol.iterator](): MediaKeyStatusMapIterator<[BufferSource, MediaKeyStatus]>;
entries(): IterableIterator<[BufferSource, MediaKeyStatus]>; entries(): MediaKeyStatusMapIterator<[BufferSource, MediaKeyStatus]>;
keys(): IterableIterator<BufferSource>; keys(): MediaKeyStatusMapIterator<BufferSource>;
values(): IterableIterator<MediaKeyStatus>; values(): MediaKeyStatusMapIterator<MediaKeyStatus>;
} }
interface MediaList { interface MediaList {
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): ArrayIterator<string>;
} }
interface MessageEvent<T = any> { interface MessageEvent<T = any> {
/** /** @deprecated */
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/initMessageEvent)
*/
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void; initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
} }
interface MimeTypeArray { interface MimeTypeArray {
[Symbol.iterator](): IterableIterator<MimeType>; [Symbol.iterator](): ArrayIterator<MimeType>;
} }
interface NamedNodeMap { interface NamedNodeMap {
[Symbol.iterator](): IterableIterator<Attr>; [Symbol.iterator](): ArrayIterator<Attr>;
} }
interface Navigator { interface Navigator {
@ -237,82 +245,86 @@ interface Navigator {
} }
interface NodeList { interface NodeList {
[Symbol.iterator](): IterableIterator<Node>; [Symbol.iterator](): ArrayIterator<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]>; entries(): ArrayIterator<[number, Node]>;
/** Returns an list of keys in the list. */ /** Returns an list of keys in the list. */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** Returns an list of values in the list. */ /** Returns an list of values in the list. */
values(): IterableIterator<Node>; values(): ArrayIterator<Node>;
} }
interface NodeListOf<TNode extends Node> { interface NodeListOf<TNode extends Node> {
[Symbol.iterator](): IterableIterator<TNode>; [Symbol.iterator](): ArrayIterator<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]>; entries(): ArrayIterator<[number, TNode]>;
/** Returns an list of keys in the list. */ /** Returns an list of keys in the list. */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** Returns an list of values in the list. */ /** Returns an list of values in the list. */
values(): IterableIterator<TNode>; values(): ArrayIterator<TNode>;
} }
interface Plugin { interface Plugin {
[Symbol.iterator](): IterableIterator<MimeType>; [Symbol.iterator](): ArrayIterator<MimeType>;
} }
interface PluginArray { interface PluginArray {
[Symbol.iterator](): IterableIterator<Plugin>; [Symbol.iterator](): ArrayIterator<Plugin>;
} }
interface RTCRtpTransceiver { interface RTCRtpTransceiver {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/setCodecPreferences) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/setCodecPreferences) */
setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void; setCodecPreferences(codecs: Iterable<RTCRtpCodec>): void;
} }
interface RTCStatsReport extends ReadonlyMap<string, any> { interface RTCStatsReport extends ReadonlyMap<string, any> {
} }
interface SVGLengthList { interface SVGLengthList {
[Symbol.iterator](): IterableIterator<SVGLength>; [Symbol.iterator](): ArrayIterator<SVGLength>;
} }
interface SVGNumberList { interface SVGNumberList {
[Symbol.iterator](): IterableIterator<SVGNumber>; [Symbol.iterator](): ArrayIterator<SVGNumber>;
} }
interface SVGPointList { interface SVGPointList {
[Symbol.iterator](): IterableIterator<DOMPoint>; [Symbol.iterator](): ArrayIterator<DOMPoint>;
} }
interface SVGStringList { interface SVGStringList {
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): ArrayIterator<string>;
} }
interface SVGTransformList { interface SVGTransformList {
[Symbol.iterator](): IterableIterator<SVGTransform>; [Symbol.iterator](): ArrayIterator<SVGTransform>;
} }
interface SourceBufferList { interface SourceBufferList {
[Symbol.iterator](): IterableIterator<SourceBuffer>; [Symbol.iterator](): ArrayIterator<SourceBuffer>;
} }
interface SpeechRecognitionResult { interface SpeechRecognitionResult {
[Symbol.iterator](): IterableIterator<SpeechRecognitionAlternative>; [Symbol.iterator](): ArrayIterator<SpeechRecognitionAlternative>;
} }
interface SpeechRecognitionResultList { interface SpeechRecognitionResultList {
[Symbol.iterator](): IterableIterator<SpeechRecognitionResult>; [Symbol.iterator](): ArrayIterator<SpeechRecognitionResult>;
}
interface StylePropertyMapReadOnlyIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): StylePropertyMapReadOnlyIterator<T>;
} }
interface StylePropertyMapReadOnly { interface StylePropertyMapReadOnly {
[Symbol.iterator](): IterableIterator<[string, Iterable<CSSStyleValue>]>; [Symbol.iterator](): StylePropertyMapReadOnlyIterator<[string, Iterable<CSSStyleValue>]>;
entries(): IterableIterator<[string, Iterable<CSSStyleValue>]>; entries(): StylePropertyMapReadOnlyIterator<[string, Iterable<CSSStyleValue>]>;
keys(): IterableIterator<string>; keys(): StylePropertyMapReadOnlyIterator<string>;
values(): IterableIterator<Iterable<CSSStyleValue>>; values(): StylePropertyMapReadOnlyIterator<Iterable<CSSStyleValue>>;
} }
interface StyleSheetList { interface StyleSheetList {
[Symbol.iterator](): IterableIterator<CSSStyleSheet>; [Symbol.iterator](): ArrayIterator<CSSStyleSheet>;
} }
interface SubtleCrypto { interface SubtleCrypto {
@ -331,25 +343,29 @@ interface SubtleCrypto {
} }
interface TextTrackCueList { interface TextTrackCueList {
[Symbol.iterator](): IterableIterator<TextTrackCue>; [Symbol.iterator](): ArrayIterator<TextTrackCue>;
} }
interface TextTrackList { interface TextTrackList {
[Symbol.iterator](): IterableIterator<TextTrack>; [Symbol.iterator](): ArrayIterator<TextTrack>;
} }
interface TouchList { interface TouchList {
[Symbol.iterator](): IterableIterator<Touch>; [Symbol.iterator](): ArrayIterator<Touch>;
}
interface URLSearchParamsIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): URLSearchParamsIterator<T>;
} }
interface URLSearchParams { interface URLSearchParams {
[Symbol.iterator](): IterableIterator<[string, string]>; [Symbol.iterator](): URLSearchParamsIterator<[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]>; entries(): URLSearchParamsIterator<[string, string]>;
/** Returns a list of keys in the search params. */ /** Returns a list of keys in the search params. */
keys(): IterableIterator<string>; keys(): URLSearchParamsIterator<string>;
/** Returns a list of values in the search params. */ /** Returns a list of values in the search params. */
values(): IterableIterator<string>; values(): URLSearchParamsIterator<string>;
} }
interface WEBGL_draw_buffers { interface WEBGL_draw_buffers {

View file

@ -18,9 +18,9 @@ and limitations under the License.
/// <reference lib="es2015.iterable" /> /// <reference lib="es2015.iterable" />
interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> { interface Generator<T = unknown, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places. // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): IteratorResult<T, TReturn>; next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
return(value: TReturn): IteratorResult<T, TReturn>; return(value: TReturn): IteratorResult<T, TReturn>;
throw(e: any): IteratorResult<T, TReturn>; throw(e: any): IteratorResult<T, TReturn>;
[Symbol.iterator](): Generator<T, TReturn, TNext>; [Symbol.iterator](): Generator<T, TReturn, TNext>;

View file

@ -38,39 +38,59 @@ interface IteratorReturnResult<TReturn> {
type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>; type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
interface Iterator<T, TReturn = any, TNext = undefined> { interface Iterator<T, TReturn = any, TNext = any> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places. // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): IteratorResult<T, TReturn>; next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
return?(value?: TReturn): IteratorResult<T, TReturn>; return?(value?: TReturn): IteratorResult<T, TReturn>;
throw?(e?: any): IteratorResult<T, TReturn>; throw?(e?: any): IteratorResult<T, TReturn>;
} }
interface Iterable<T> { interface Iterable<T, TReturn = any, TNext = any> {
[Symbol.iterator](): Iterator<T>; [Symbol.iterator](): Iterator<T, TReturn, TNext>;
} }
interface IterableIterator<T> extends Iterator<T> { /**
[Symbol.iterator](): IterableIterator<T>; * Describes a user-defined {@link Iterator} that is also iterable.
*/
interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {
[Symbol.iterator](): IterableIterator<T, TReturn, TNext>;
}
/**
* Describes an {@link Iterator} produced by the runtime that inherits from the intrinsic `Iterator.prototype`.
*/
interface IteratorObject<T, TReturn = unknown, TNext = unknown> extends Iterator<T, TReturn, TNext> {
[Symbol.iterator](): IteratorObject<T, TReturn, TNext>;
}
/**
* Defines the `TReturn` type used for built-in iterators produced by `Array`, `Map`, `Set`, and others.
* This is `undefined` when `strictBuiltInIteratorReturn` is `true`; otherwise, this is `any`.
*/
type BuiltinIteratorReturn = intrinsic;
interface ArrayIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): ArrayIterator<T>;
} }
interface Array<T> { interface Array<T> {
/** Iterator */ /** Iterator */
[Symbol.iterator](): IterableIterator<T>; [Symbol.iterator](): ArrayIterator<T>;
/** /**
* Returns an iterable of key, value pairs for every entry in the array * Returns an iterable of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, T]>; entries(): ArrayIterator<[number, T]>;
/** /**
* Returns an iterable of keys in the array * Returns an iterable of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an iterable of values in the array * Returns an iterable of values in the array
*/ */
values(): IterableIterator<T>; values(): ArrayIterator<T>;
} }
interface ArrayConstructor { interface ArrayConstructor {
@ -91,67 +111,71 @@ interface ArrayConstructor {
interface ReadonlyArray<T> { interface ReadonlyArray<T> {
/** Iterator of values in the array. */ /** Iterator of values in the array. */
[Symbol.iterator](): IterableIterator<T>; [Symbol.iterator](): ArrayIterator<T>;
/** /**
* Returns an iterable of key, value pairs for every entry in the array * Returns an iterable of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, T]>; entries(): ArrayIterator<[number, T]>;
/** /**
* Returns an iterable of keys in the array * Returns an iterable of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an iterable of values in the array * Returns an iterable of values in the array
*/ */
values(): IterableIterator<T>; values(): ArrayIterator<T>;
} }
interface IArguments { interface IArguments {
/** Iterator */ /** Iterator */
[Symbol.iterator](): IterableIterator<any>; [Symbol.iterator](): ArrayIterator<any>;
}
interface MapIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): MapIterator<T>;
} }
interface Map<K, V> { interface Map<K, V> {
/** Returns an iterable of entries in the map. */ /** Returns an iterable of entries in the map. */
[Symbol.iterator](): IterableIterator<[K, V]>; [Symbol.iterator](): MapIterator<[K, V]>;
/** /**
* Returns an iterable of key, value pairs for every entry in the map. * Returns an iterable of key, value pairs for every entry in the map.
*/ */
entries(): IterableIterator<[K, V]>; entries(): MapIterator<[K, V]>;
/** /**
* Returns an iterable of keys in the map * Returns an iterable of keys in the map
*/ */
keys(): IterableIterator<K>; keys(): MapIterator<K>;
/** /**
* Returns an iterable of values in the map * Returns an iterable of values in the map
*/ */
values(): IterableIterator<V>; values(): MapIterator<V>;
} }
interface ReadonlyMap<K, V> { interface ReadonlyMap<K, V> {
/** Returns an iterable of entries in the map. */ /** Returns an iterable of entries in the map. */
[Symbol.iterator](): IterableIterator<[K, V]>; [Symbol.iterator](): MapIterator<[K, V]>;
/** /**
* Returns an iterable of key, value pairs for every entry in the map. * Returns an iterable of key, value pairs for every entry in the map.
*/ */
entries(): IterableIterator<[K, V]>; entries(): MapIterator<[K, V]>;
/** /**
* Returns an iterable of keys in the map * Returns an iterable of keys in the map
*/ */
keys(): IterableIterator<K>; keys(): MapIterator<K>;
/** /**
* Returns an iterable of values in the map * Returns an iterable of values in the map
*/ */
values(): IterableIterator<V>; values(): MapIterator<V>;
} }
interface MapConstructor { interface MapConstructor {
@ -165,42 +189,46 @@ interface WeakMapConstructor {
new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>; new <K extends WeakKey, V>(iterable: Iterable<readonly [K, V]>): WeakMap<K, V>;
} }
interface SetIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): SetIterator<T>;
}
interface Set<T> { interface Set<T> {
/** Iterates over values in the set. */ /** Iterates over values in the set. */
[Symbol.iterator](): IterableIterator<T>; [Symbol.iterator](): SetIterator<T>;
/** /**
* Returns an iterable of [v,v] pairs for every value `v` in the set. * Returns an iterable of [v,v] pairs for every value `v` in the set.
*/ */
entries(): IterableIterator<[T, T]>; entries(): SetIterator<[T, T]>;
/** /**
* Despite its name, returns an iterable of the values in the set. * Despite its name, returns an iterable of the values in the set.
*/ */
keys(): IterableIterator<T>; keys(): SetIterator<T>;
/** /**
* Returns an iterable of values in the set. * Returns an iterable of values in the set.
*/ */
values(): IterableIterator<T>; values(): SetIterator<T>;
} }
interface ReadonlySet<T> { interface ReadonlySet<T> {
/** Iterates over values in the set. */ /** Iterates over values in the set. */
[Symbol.iterator](): IterableIterator<T>; [Symbol.iterator](): SetIterator<T>;
/** /**
* Returns an iterable of [v,v] pairs for every value `v` in the set. * Returns an iterable of [v,v] pairs for every value `v` in the set.
*/ */
entries(): IterableIterator<[T, T]>; entries(): SetIterator<[T, T]>;
/** /**
* Despite its name, returns an iterable of the values in the set. * Despite its name, returns an iterable of the values in the set.
*/ */
keys(): IterableIterator<T>; keys(): SetIterator<T>;
/** /**
* Returns an iterable of values in the set. * Returns an iterable of values in the set.
*/ */
values(): IterableIterator<T>; values(): SetIterator<T>;
} }
interface SetConstructor { interface SetConstructor {
@ -233,25 +261,29 @@ interface PromiseConstructor {
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>; race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
} }
interface StringIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): StringIterator<T>;
}
interface String { interface String {
/** Iterator */ /** Iterator */
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): StringIterator<string>;
} }
interface Int8Array { interface Int8Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Int8ArrayConstructor { interface Int8ArrayConstructor {
@ -267,19 +299,19 @@ interface Int8ArrayConstructor {
} }
interface Uint8Array { interface Uint8Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Uint8ArrayConstructor { interface Uint8ArrayConstructor {
@ -295,21 +327,21 @@ interface Uint8ArrayConstructor {
} }
interface Uint8ClampedArray { interface Uint8ClampedArray {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Uint8ClampedArrayConstructor { interface Uint8ClampedArrayConstructor {
@ -325,21 +357,21 @@ interface Uint8ClampedArrayConstructor {
} }
interface Int16Array { interface Int16Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Int16ArrayConstructor { interface Int16ArrayConstructor {
@ -355,19 +387,19 @@ interface Int16ArrayConstructor {
} }
interface Uint16Array { interface Uint16Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Uint16ArrayConstructor { interface Uint16ArrayConstructor {
@ -383,19 +415,19 @@ interface Uint16ArrayConstructor {
} }
interface Int32Array { interface Int32Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Int32ArrayConstructor { interface Int32ArrayConstructor {
@ -411,19 +443,19 @@ interface Int32ArrayConstructor {
} }
interface Uint32Array { interface Uint32Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Uint32ArrayConstructor { interface Uint32ArrayConstructor {
@ -439,19 +471,19 @@ interface Uint32ArrayConstructor {
} }
interface Float32Array { interface Float32Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Float32ArrayConstructor { interface Float32ArrayConstructor {
@ -467,19 +499,19 @@ interface Float32ArrayConstructor {
} }
interface Float64Array { interface Float64Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): ArrayIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
*/ */
entries(): IterableIterator<[number, number]>; entries(): ArrayIterator<[number, number]>;
/** /**
* Returns an list of keys in the array * Returns an list of keys in the array
*/ */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns an list of values in the array * Returns an list of values in the array
*/ */
values(): IterableIterator<number>; values(): ArrayIterator<number>;
} }
interface Float64ArrayConstructor { interface Float64ArrayConstructor {

View file

@ -18,25 +18,25 @@ and limitations under the License.
interface ObjectConstructor { interface ObjectConstructor {
/** /**
* Returns an array of values of the enumerable properties of an object * Returns an array of values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/ */
values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[]; values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[];
/** /**
* Returns an array of values of the enumerable properties of an object * Returns an array of values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/ */
values(o: {}): any[]; values(o: {}): any[];
/** /**
* Returns an array of key/values of the enumerable properties of an object * Returns an array of key/values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/ */
entries<T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][]; entries<T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][];
/** /**
* Returns an array of key/values of the enumerable properties of an object * Returns an array of key/values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/ */
entries(o: {}): [string, any][]; entries(o: {}): [string, any][];

View file

@ -18,9 +18,9 @@ and limitations under the License.
/// <reference lib="es2018.asynciterable" /> /// <reference lib="es2018.asynciterable" />
interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown> extends AsyncIterator<T, TReturn, TNext> { interface AsyncGenerator<T = unknown, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places. // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>; next(...[value]: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
return(value: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>; return(value: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
throw(e: any): Promise<IteratorResult<T, TReturn>>; throw(e: any): Promise<IteratorResult<T, TReturn>>;
[Symbol.asyncIterator](): AsyncGenerator<T, TReturn, TNext>; [Symbol.asyncIterator](): AsyncGenerator<T, TReturn, TNext>;

View file

@ -27,17 +27,27 @@ interface SymbolConstructor {
readonly asyncIterator: unique symbol; readonly asyncIterator: unique symbol;
} }
interface AsyncIterator<T, TReturn = any, TNext = undefined> { interface AsyncIterator<T, TReturn = any, TNext = any> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places. // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>; next(...[value]: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>; return?(value?: TReturn | PromiseLike<TReturn>): Promise<IteratorResult<T, TReturn>>;
throw?(e?: any): Promise<IteratorResult<T, TReturn>>; throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
} }
interface AsyncIterable<T> { interface AsyncIterable<T, TReturn = any, TNext = any> {
[Symbol.asyncIterator](): AsyncIterator<T>; [Symbol.asyncIterator](): AsyncIterator<T, TReturn, TNext>;
} }
interface AsyncIterableIterator<T> extends AsyncIterator<T> { /**
[Symbol.asyncIterator](): AsyncIterableIterator<T>; * Describes a user-defined {@link AsyncIterator} that is also async iterable.
*/
interface AsyncIterableIterator<T, TReturn = any, TNext = any> extends AsyncIterator<T, TReturn, TNext> {
[Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
}
/**
* Describes an {@link AsyncIterator} produced by the runtime that inherits from the intrinsic `AsyncIterator.prototype`.
*/
interface AsyncIteratorObject<T, TReturn = unknown, TNext = unknown> extends AsyncIterator<T, TReturn, TNext> {
[Symbol.asyncIterator](): AsyncIteratorObject<T, TReturn, TNext>;
} }

View file

@ -171,7 +171,7 @@ interface BigInt64Array {
copyWithin(target: number, start: number, end?: number): this; copyWithin(target: number, start: number, end?: number): this;
/** Yields index, value pairs for every entry in the array. */ /** Yields index, value pairs for every entry in the array. */
entries(): IterableIterator<[number, bigint]>; entries(): ArrayIterator<[number, bigint]>;
/** /**
* Determines whether all the members of an array satisfy the specified test. * Determines whether all the members of an array satisfy the specified test.
@ -256,7 +256,7 @@ interface BigInt64Array {
join(separator?: string): string; join(separator?: string): string;
/** Yields each index in the array. */ /** Yields each index in the array. */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns the index of the last occurrence of a value in an array. * Returns the index of the last occurrence of a value in an array.
@ -378,9 +378,9 @@ interface BigInt64Array {
valueOf(): BigInt64Array; valueOf(): BigInt64Array;
/** Yields each value in the array. */ /** Yields each value in the array. */
values(): IterableIterator<bigint>; values(): ArrayIterator<bigint>;
[Symbol.iterator](): IterableIterator<bigint>; [Symbol.iterator](): ArrayIterator<bigint>;
readonly [Symbol.toStringTag]: "BigInt64Array"; readonly [Symbol.toStringTag]: "BigInt64Array";
@ -443,7 +443,7 @@ interface BigUint64Array {
copyWithin(target: number, start: number, end?: number): this; copyWithin(target: number, start: number, end?: number): this;
/** Yields index, value pairs for every entry in the array. */ /** Yields index, value pairs for every entry in the array. */
entries(): IterableIterator<[number, bigint]>; entries(): ArrayIterator<[number, bigint]>;
/** /**
* Determines whether all the members of an array satisfy the specified test. * Determines whether all the members of an array satisfy the specified test.
@ -528,7 +528,7 @@ interface BigUint64Array {
join(separator?: string): string; join(separator?: string): string;
/** Yields each index in the array. */ /** Yields each index in the array. */
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
/** /**
* Returns the index of the last occurrence of a value in an array. * Returns the index of the last occurrence of a value in an array.
@ -650,9 +650,9 @@ interface BigUint64Array {
valueOf(): BigUint64Array; valueOf(): BigUint64Array;
/** Yields each value in the array. */ /** Yields each value in the array. */
values(): IterableIterator<bigint>; values(): ArrayIterator<bigint>;
[Symbol.iterator](): IterableIterator<bigint>; [Symbol.iterator](): ArrayIterator<bigint>;
readonly [Symbol.toStringTag]: "BigUint64Array"; readonly [Symbol.toStringTag]: "BigUint64Array";

View file

@ -16,7 +16,7 @@ and limitations under the License.
/// <reference no-default-lib="true"/> /// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" /> /// <reference lib="es2020.symbol.wellknown" />
interface String { interface String {
/** /**
@ -24,7 +24,7 @@ interface String {
* containing the results of that search. * containing the results of that search.
* @param regexp A variable name or string literal containing the regular expression pattern and flags. * @param regexp A variable name or string literal containing the regular expression pattern and flags.
*/ */
matchAll(regexp: RegExp): IterableIterator<RegExpExecArray>; matchAll(regexp: RegExp): RegExpStringIterator<RegExpExecArray>;
/** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */
toLocaleLowerCase(locales?: Intl.LocalesArgument): string; toLocaleLowerCase(locales?: Intl.LocalesArgument): string;

View file

@ -27,11 +27,15 @@ interface SymbolConstructor {
readonly matchAll: unique symbol; readonly matchAll: unique symbol;
} }
interface RegExpStringIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): RegExpStringIterator<T>;
}
interface RegExp { interface RegExp {
/** /**
* Matches a string with this regular expression, and returns an iterable of matches * Matches a string with this regular expression, and returns an iterable of matches
* containing the results of that search. * containing the results of that search.
* @param string A string to search within. * @param string A string to search within.
*/ */
[Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>; [Symbol.matchAll](str: string): RegExpStringIterator<RegExpMatchArray>;
} }

View file

@ -46,6 +46,10 @@ declare namespace Intl {
granularity: "grapheme" | "word" | "sentence"; granularity: "grapheme" | "word" | "sentence";
} }
interface SegmentIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): SegmentIterator<T>;
}
interface Segments { interface Segments {
/** /**
* Returns an object describing the segment in the original string that includes the code unit at a specified index. * Returns an object describing the segment in the original string that includes the code unit at a specified index.
@ -55,7 +59,7 @@ declare namespace Intl {
containing(codeUnitIndex?: number): SegmentData; containing(codeUnitIndex?: number): SegmentData;
/** Returns an iterator to iterate over the segments. */ /** Returns an iterator to iterate over the segments. */
[Symbol.iterator](): IterableIterator<SegmentData>; [Symbol.iterator](): SegmentIterator<SegmentData>;
} }
interface SegmentData { interface SegmentData {

View file

@ -203,7 +203,7 @@ interface Int8Array {
/** /**
* Copies the array and returns the copy with the elements in reverse order. * Copies the array and returns the copy with the elements in reverse order.
*/ */
toReversed(): Uint8Array; toReversed(): Int8Array;
/** /**
* Copies and sorts the array. * Copies and sorts the array.
@ -211,11 +211,11 @@ interface Int8Array {
* a negative value if the first argument is less than the 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 order. * value otherwise. If omitted, the elements are sorted in ascending order.
* ```ts * ```ts
* const myNums = Uint8Array.from([11, 2, 22, 1]); * const myNums = Int8Array.from([11, 2, 22, 1]);
* myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22] * myNums.toSorted((a, b) => a - b) // Int8Array(4) [1, 2, 11, 22]
* ``` * ```
*/ */
toSorted(compareFn?: (a: number, b: number) => number): Uint8Array; toSorted(compareFn?: (a: number, b: number) => number): Int8Array;
/** /**
* Copies the array and inserts the given number at the provided index. * Copies the array and inserts the given number at the provided index.
@ -224,7 +224,7 @@ interface Int8Array {
* @param value The value to insert into the copied array. * @param value The value to insert into the copied array.
* @returns A copy of the original array with the inserted value. * @returns A copy of the original array with the inserted value.
*/ */
with(index: number, value: number): Uint8Array; with(index: number, value: number): Int8Array;
} }
interface Uint8Array { interface Uint8Array {

View file

@ -26,3 +26,4 @@ and limitations under the License.
/// <reference lib="esnext.array" /> /// <reference lib="esnext.array" />
/// <reference lib="esnext.regexp" /> /// <reference lib="esnext.regexp" />
/// <reference lib="esnext.string" /> /// <reference lib="esnext.string" />
/// <reference lib="esnext.iterator" />

View file

@ -17,6 +17,8 @@ and limitations under the License.
/// <reference no-default-lib="true"/> /// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" /> /// <reference lib="es2015.symbol" />
/// <reference lib="es2015.iterable" />
/// <reference lib="es2018.asynciterable" />
interface SymbolConstructor { interface SymbolConstructor {
/** /**
@ -183,3 +185,9 @@ interface AsyncDisposableStackConstructor {
readonly prototype: AsyncDisposableStack; readonly prototype: AsyncDisposableStack;
} }
declare var AsyncDisposableStack: AsyncDisposableStackConstructor; declare var AsyncDisposableStack: AsyncDisposableStackConstructor;
interface IteratorObject<T, TReturn, TNext> extends Disposable {
}
interface AsyncIteratorObject<T, TReturn, TNext> extends AsyncDisposable {
}

148
cli/tsc/dts/lib.esnext.iterator.d.ts vendored Normal file
View file

@ -0,0 +1,148 @@
/*! *****************************************************************************
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"/>
/// <reference lib="es2015.iterable" />
// NOTE: This is specified as what is essentially an unreachable module. All actual global declarations can be found
// in the `declare global` section, below. This is necessary as there is currently no way to declare an `abstract`
// member without declaring a `class`, but declaring `class Iterator<T>` globally would conflict with TypeScript's
// general purpose `Iterator<T>` interface.
export {};
// Abstract type that allows us to mark `next` as `abstract`
declare abstract class Iterator<T, TResult = undefined, TNext = unknown> { // eslint-disable-line @typescript-eslint/no-unsafe-declaration-merging
abstract next(value?: TNext): IteratorResult<T, TResult>;
}
// Merge all members of `IteratorObject<T>` into `Iterator<T>`
interface Iterator<T, TResult, TNext> extends globalThis.IteratorObject<T, TResult, TNext> {}
// Capture the `Iterator` constructor in a type we can use in the `extends` clause of `IteratorConstructor`.
type IteratorObjectConstructor = typeof Iterator;
declare global {
// Global `IteratorObject<T, TReturn, TNext>` interface that can be augmented by polyfills
interface IteratorObject<T, TReturn, TNext> {
/**
* Returns this iterator.
*/
[Symbol.iterator](): IteratorObject<T, TReturn, TNext>;
/**
* Creates an iterator whose values are the result of applying the callback to the values from this iterator.
* @param callbackfn A function that accepts up to two arguments to be used to transform values from the underlying iterator.
*/
map<U>(callbackfn: (value: T, index: number) => U): IteratorObject<U, undefined, unknown>;
/**
* Creates an iterator whose values are those from this iterator for which the provided predicate returns true.
* @param predicate A function that accepts up to two arguments to be used to test values from the underlying iterator.
*/
filter<S extends T>(predicate: (value: T, index: number) => value is S): IteratorObject<S, undefined, unknown>;
/**
* Creates an iterator whose values are those from this iterator for which the provided predicate returns true.
* @param predicate A function that accepts up to two arguments to be used to test values from the underlying iterator.
*/
filter(predicate: (value: T, index: number) => unknown): IteratorObject<T, undefined, unknown>;
/**
* Creates an iterator whose values are the values from this iterator, stopping once the provided limit is reached.
* @param limit The maximum number of values to yield.
*/
take(limit: number): IteratorObject<T, undefined, unknown>;
/**
* Creates an iterator whose values are the values from this iterator after skipping the provided count.
* @param count The number of values to drop.
*/
drop(count: number): IteratorObject<T, undefined, unknown>;
/**
* Creates an iterator whose values are the result of applying the callback to the values from this iterator and then flattening the resulting iterators or iterables.
* @param callback A function that accepts up to two arguments to be used to transform values from the underlying iterator into new iterators or iterables to be flattened into the result.
*/
flatMap<U>(callback: (value: T, index: number) => Iterator<U, unknown, undefined> | Iterable<U, unknown, undefined>): IteratorObject<U, undefined, unknown>;
/**
* Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator.
*/
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T;
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue: T): T;
/**
* Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U;
/**
* Creates a new array from the values yielded by this iterator.
*/
toArray(): T[];
/**
* Performs the specified action for each element in the iterator.
* @param callbackfn A function that accepts up to two arguments. forEach calls the callbackfn function one time for each element in the iterator.
*/
forEach(callbackfn: (value: T, index: number) => void): void;
/**
* Determines whether the specified callback function returns true for any element of this iterator.
* @param predicate A function that accepts up to two arguments. The some method calls
* the predicate function for each element in this iterator until the predicate returns a value
* true, or until the end of the iterator.
*/
some(predicate: (value: T, index: number) => unknown): boolean;
/**
* Determines whether all the members of this iterator satisfy the specified test.
* @param predicate A function that accepts up to two arguments. The every method calls
* the predicate function for each element in this iterator until the predicate returns
* false, or until the end of this iterator.
*/
every(predicate: (value: T, index: number) => unknown): boolean;
/**
* Returns the value of the first element in this iterator where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of this iterator, in
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
*/
find<S extends T>(predicate: (value: T, index: number) => value is S): S | undefined;
find(predicate: (value: T, index: number) => unknown): T | undefined;
readonly [Symbol.toStringTag]: string;
}
// Global `IteratorConstructor` interface that can be augmented by polyfills
interface IteratorConstructor extends IteratorObjectConstructor {
/**
* Creates a native iterator from an iterator or iterable object.
* Returns its input if the input already inherits from the built-in Iterator class.
* @param value An iterator or iterable object to convert a native iterator.
*/
from<T>(value: Iterator<T, unknown, undefined> | Iterable<T, unknown, undefined>): IteratorObject<T, undefined, unknown>;
}
var Iterator: IteratorConstructor;
}

View file

@ -20,14 +20,22 @@ and limitations under the License.
/// Worker Async Iterable APIs /// Worker Async Iterable APIs
///////////////////////////// /////////////////////////////
interface FileSystemDirectoryHandleAsyncIterator<T> extends AsyncIteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<T>;
}
interface FileSystemDirectoryHandle { interface FileSystemDirectoryHandle {
[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>; [Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>;
entries(): AsyncIterableIterator<[string, FileSystemHandle]>; entries(): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>;
keys(): AsyncIterableIterator<string>; keys(): FileSystemDirectoryHandleAsyncIterator<string>;
values(): AsyncIterableIterator<FileSystemHandle>; values(): FileSystemDirectoryHandleAsyncIterator<FileSystemHandle>;
}
interface ReadableStreamAsyncIterator<T> extends AsyncIteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
} }
interface ReadableStream<R = any> { interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
} }

View file

@ -340,10 +340,6 @@ interface ImageEncodeOptions {
type?: string; type?: string;
} }
interface ImportMeta {
url: string;
}
interface JsonWebKey { interface JsonWebKey {
alg?: string; alg?: string;
crv?: string; crv?: string;
@ -414,6 +410,10 @@ interface MediaEncodingConfiguration extends MediaConfiguration {
type: MediaEncodingType; type: MediaEncodingType;
} }
interface MediaStreamTrackProcessorInit {
maxBufferSize?: number;
}
interface MessageEventInit<T = any> extends EventInit { interface MessageEventInit<T = any> extends EventInit {
data?: T; data?: T;
lastEventId?: string; lastEventId?: string;
@ -717,16 +717,11 @@ interface TextEncoderEncodeIntoResult {
written: number; written: number;
} }
interface TransformerCancelCallback {
(reason: any): void | PromiseLike<void>;
}
interface Transformer<I = any, O = any> { interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>; flush?: TransformerFlushCallback<O>;
readableType?: undefined; readableType?: undefined;
start?: TransformerStartCallback<O>; start?: TransformerStartCallback<O>;
transform?: TransformerTransformCallback<I, O>; transform?: TransformerTransformCallback<I, O>;
cancel?: TransformerCancelCallback;
writableType?: undefined; writableType?: undefined;
} }
@ -1676,6 +1671,8 @@ interface CanvasShadowStyles {
} }
interface CanvasState { interface CanvasState {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/isContextLost) */
isContextLost(): boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/reset) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/reset) */
reset(): void; reset(): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/restore) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/restore) */
@ -1812,8 +1809,6 @@ declare var CloseEvent: {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */
interface CompressionStream extends GenericTransformStream { interface CompressionStream extends GenericTransformStream {
readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<BufferSource>;
} }
declare var CompressionStream: { declare var CompressionStream: {
@ -2011,9 +2006,7 @@ interface DOMMatrix extends DOMMatrixReadOnly {
rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
rotateFromVectorSelf(x?: number, y?: number): DOMMatrix; rotateFromVectorSelf(x?: number, y?: number): DOMMatrix;
rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/scale3dSelf) */
scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/scaleSelf) */
scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
skewXSelf(sx?: number): DOMMatrix; skewXSelf(sx?: number): DOMMatrix;
skewYSelf(sy?: number): DOMMatrix; skewYSelf(sy?: number): DOMMatrix;
@ -2030,88 +2023,48 @@ declare var DOMMatrix: {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly) */
interface DOMMatrixReadOnly { interface DOMMatrixReadOnly {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/a) */
readonly a: number; readonly a: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/b) */
readonly b: number; readonly b: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/c) */
readonly c: number; readonly c: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/d) */
readonly d: number; readonly d: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/e) */
readonly e: number; readonly e: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/f) */
readonly f: number; readonly f: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/is2D) */
readonly is2D: boolean; readonly is2D: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/isIdentity) */
readonly isIdentity: boolean; readonly isIdentity: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m11) */
readonly m11: number; readonly m11: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m12) */
readonly m12: number; readonly m12: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m13) */
readonly m13: number; readonly m13: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m14) */
readonly m14: number; readonly m14: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m21) */
readonly m21: number; readonly m21: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m22) */
readonly m22: number; readonly m22: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m23) */
readonly m23: number; readonly m23: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m24) */
readonly m24: number; readonly m24: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m31) */
readonly m31: number; readonly m31: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m32) */
readonly m32: number; readonly m32: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m33) */
readonly m33: number; readonly m33: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m34) */
readonly m34: number; readonly m34: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m41) */
readonly m41: number; readonly m41: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m42) */
readonly m42: number; readonly m42: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m43) */
readonly m43: number; readonly m43: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m44) */
readonly m44: number; readonly m44: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipX) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipX) */
flipX(): DOMMatrix; flipX(): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipY) */
flipY(): DOMMatrix; flipY(): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/inverse) */
inverse(): DOMMatrix; inverse(): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/multiply) */
multiply(other?: DOMMatrixInit): DOMMatrix; multiply(other?: DOMMatrixInit): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotate) */
rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotateAxisAngle) */
rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotateFromVector) */
rotateFromVector(x?: number, y?: number): DOMMatrix; rotateFromVector(x?: number, y?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale) */
scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale3d) */
scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
/** /** @deprecated */
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scaleNonUniform)
*/
scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix; scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/skewX) */
skewX(sx?: number): DOMMatrix; skewX(sx?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/skewY) */
skewY(sy?: number): DOMMatrix; skewY(sy?: number): DOMMatrix;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toFloat32Array) */
toFloat32Array(): Float32Array; toFloat32Array(): Float32Array;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toFloat64Array) */
toFloat64Array(): Float64Array; toFloat64Array(): Float64Array;
toJSON(): any; toJSON(): any;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/transformPoint) */
transformPoint(point?: DOMPointInit): DOMPoint; transformPoint(point?: DOMPointInit): DOMPoint;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/translate) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/translate) */
translate(tx?: number, ty?: number, tz?: number): DOMMatrix; translate(tx?: number, ty?: number, tz?: number): DOMMatrix;
@ -2154,7 +2107,6 @@ interface DOMPointReadOnly {
readonly y: number; readonly y: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/z) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/z) */
readonly z: number; readonly z: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/matrixTransform) */
matrixTransform(matrix?: DOMMatrixInit): DOMPoint; matrixTransform(matrix?: DOMMatrixInit): DOMPoint;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/toJSON) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/toJSON) */
toJSON(): any; toJSON(): any;
@ -2169,15 +2121,10 @@ declare var DOMPointReadOnly: {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad) */
interface DOMQuad { interface DOMQuad {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p1) */
readonly p1: DOMPoint; readonly p1: DOMPoint;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p2) */
readonly p2: DOMPoint; readonly p2: DOMPoint;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p3) */
readonly p3: DOMPoint; readonly p3: DOMPoint;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p4) */
readonly p4: DOMPoint; readonly p4: DOMPoint;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/getBounds) */
getBounds(): DOMRect; getBounds(): DOMRect;
toJSON(): any; toJSON(): any;
} }
@ -2200,6 +2147,7 @@ interface DOMRect extends DOMRectReadOnly {
declare var DOMRect: { declare var DOMRect: {
prototype: DOMRect; prototype: DOMRect;
new(x?: number, y?: number, width?: number, height?: number): DOMRect; new(x?: number, y?: number, width?: number, height?: number): DOMRect;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect/fromRect_static) */
fromRect(other?: DOMRectInit): DOMRect; fromRect(other?: DOMRectInit): DOMRect;
}; };
@ -2265,8 +2213,6 @@ declare var DOMStringList: {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */
interface DecompressionStream extends GenericTransformStream { interface DecompressionStream extends GenericTransformStream {
readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<BufferSource>;
} }
declare var DecompressionStream: { declare var DecompressionStream: {
@ -2427,15 +2373,10 @@ declare var EncodedVideoChunk: {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
*/ */
interface ErrorEvent extends Event { interface ErrorEvent extends Event {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
readonly colno: number; readonly colno: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
readonly error: any; readonly error: any;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
readonly filename: string; readonly filename: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
readonly lineno: number; readonly lineno: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
readonly message: string; readonly message: string;
} }
@ -3091,7 +3032,9 @@ declare var FormData: {
}; };
interface GenericTransformStream { interface GenericTransformStream {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream/readable) */
readonly readable: ReadableStream; readonly readable: ReadableStream;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream/writable) */
readonly writable: WritableStream; readonly writable: WritableStream;
} }
@ -3750,7 +3693,7 @@ interface IDBTransaction extends EventTarget {
/** /**
* Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. * Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.
* *
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/ObjectStoreNames)
*/ */
readonly objectStoreNames: DOMStringList; readonly objectStoreNames: DOMStringList;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/abort_event) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBTransaction/abort_event) */
@ -3877,6 +3820,11 @@ declare var ImageData: {
new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData; new(data: Uint8ClampedArray, sw: number, sh?: number, settings?: ImageDataSettings): ImageData;
}; };
interface ImportMeta {
url: string;
resolve(specifier: string): string;
}
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KHR_parallel_shader_compile) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KHR_parallel_shader_compile) */
interface KHR_parallel_shader_compile { interface KHR_parallel_shader_compile {
readonly COMPLETION_STATUS_KHR: 0x91B1; readonly COMPLETION_STATUS_KHR: 0x91B1;
@ -3930,6 +3878,26 @@ declare var MediaCapabilities: {
new(): MediaCapabilities; new(): MediaCapabilities;
}; };
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaSourceHandle) */
interface MediaSourceHandle {
}
declare var MediaSourceHandle: {
prototype: MediaSourceHandle;
new(): MediaSourceHandle;
};
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaStreamTrackProcessor) */
interface MediaStreamTrackProcessor {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaStreamTrackProcessor/readable) */
readonly readable: ReadableStream;
}
declare var MediaStreamTrackProcessor: {
prototype: MediaStreamTrackProcessor;
new(init: MediaStreamTrackProcessorInit): MediaStreamTrackProcessor;
};
/** /**
* This Channel Messaging API interface allows us to create a new message channel and send data through it via its two MessagePort properties. * This Channel Messaging API interface allows us to create a new message channel and send data through it via its two MessagePort properties.
* *
@ -3991,11 +3959,7 @@ interface MessageEvent<T = any> extends Event {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/ */
readonly source: MessageEventSource | null; readonly source: MessageEventSource | null;
/** /** @deprecated */
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/initMessageEvent)
*/
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: MessagePort[]): void; initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: MessagePort[]): void;
} }
@ -4327,7 +4291,9 @@ interface OffscreenCanvas extends EventTarget {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/height) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/height)
*/ */
height: number; height: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/contextlost_event) */
oncontextlost: ((this: OffscreenCanvas, ev: Event) => any) | null; oncontextlost: ((this: OffscreenCanvas, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/contextrestored_event) */
oncontextrestored: ((this: OffscreenCanvas, ev: Event) => any) | null; oncontextrestored: ((this: OffscreenCanvas, ev: Event) => any) | null;
/** /**
* These attributes return the dimensions of the OffscreenCanvas object's bitmap. * These attributes return the dimensions of the OffscreenCanvas object's bitmap.
@ -4379,8 +4345,6 @@ declare var OffscreenCanvas: {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvasRenderingContext2D) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvasRenderingContext2D) */
interface OffscreenCanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform { interface OffscreenCanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform {
readonly canvas: OffscreenCanvas; readonly canvas: OffscreenCanvas;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/OffscreenCanvasRenderingContext2D/commit) */
commit(): void;
} }
declare var OffscreenCanvasRenderingContext2D: { declare var OffscreenCanvasRenderingContext2D: {
@ -4885,24 +4849,19 @@ declare var ReadableStream: {
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>; new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
from<R>(asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>>): ReadableStream<R>;
}; };
interface ReadableStreamBYOBReaderReadOptions {
min?: number;
}
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
read<T extends ArrayBufferView>(view: T, options?: ReadableStreamBYOBReaderReadOptions): Promise<ReadableStreamReadResult<T>>; read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
releaseLock(): void; releaseLock(): void;
} }
declare var ReadableStreamBYOBReader: { declare var ReadableStreamBYOBReader: {
prototype: ReadableStreamBYOBReader; prototype: ReadableStreamBYOBReader;
new(stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader; new(stream: ReadableStream): ReadableStreamBYOBReader;
}; };
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
@ -4975,6 +4934,7 @@ declare var Report: {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReportBody) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReportBody) */
interface ReportBody { interface ReportBody {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReportBody/toJSON) */
toJSON(): any; toJSON(): any;
} }
@ -5034,11 +4994,7 @@ interface Request extends Body {
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
*/ */
readonly integrity: string; readonly integrity: string;
/** /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
*/
readonly keepalive: boolean; readonly keepalive: boolean;
/** /**
* Returns request's HTTP method, which is "GET" by default. * Returns request's HTTP method, which is "GET" by default.
@ -5802,6 +5758,7 @@ interface VideoDecoderEventMap {
interface VideoDecoder extends EventTarget { interface VideoDecoder extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/decodeQueueSize) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/decodeQueueSize) */
readonly decodeQueueSize: number; readonly decodeQueueSize: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/dequeue_event) */
ondequeue: ((this: VideoDecoder, ev: Event) => any) | null; ondequeue: ((this: VideoDecoder, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/state) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/state) */
readonly state: CodecState; readonly state: CodecState;
@ -5824,6 +5781,7 @@ interface VideoDecoder extends EventTarget {
declare var VideoDecoder: { declare var VideoDecoder: {
prototype: VideoDecoder; prototype: VideoDecoder;
new(init: VideoDecoderInit): VideoDecoder; new(init: VideoDecoderInit): VideoDecoder;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoDecoder/isConfigSupported_static) */
isConfigSupported(config: VideoDecoderConfig): Promise<VideoDecoderSupport>; isConfigSupported(config: VideoDecoderConfig): Promise<VideoDecoderSupport>;
}; };
@ -5839,6 +5797,7 @@ interface VideoEncoderEventMap {
interface VideoEncoder extends EventTarget { interface VideoEncoder extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/encodeQueueSize) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/encodeQueueSize) */
readonly encodeQueueSize: number; readonly encodeQueueSize: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/dequeue_event) */
ondequeue: ((this: VideoEncoder, ev: Event) => any) | null; ondequeue: ((this: VideoEncoder, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/state) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/state) */
readonly state: CodecState; readonly state: CodecState;
@ -5848,6 +5807,7 @@ interface VideoEncoder extends EventTarget {
configure(config: VideoEncoderConfig): void; configure(config: VideoEncoderConfig): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/encode) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/encode) */
encode(frame: VideoFrame, options?: VideoEncoderEncodeOptions): void; encode(frame: VideoFrame, options?: VideoEncoderEncodeOptions): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/flush) */
flush(): Promise<void>; flush(): Promise<void>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/reset) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/reset) */
reset(): void; reset(): void;
@ -5860,6 +5820,7 @@ interface VideoEncoder extends EventTarget {
declare var VideoEncoder: { declare var VideoEncoder: {
prototype: VideoEncoder; prototype: VideoEncoder;
new(init: VideoEncoderInit): VideoEncoder; new(init: VideoEncoderInit): VideoEncoder;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoEncoder/isConfigSupported_static) */
isConfigSupported(config: VideoEncoderConfig): Promise<VideoEncoderSupport>; isConfigSupported(config: VideoEncoderConfig): Promise<VideoEncoderSupport>;
}; };
@ -5891,6 +5852,7 @@ interface VideoFrame {
clone(): VideoFrame; clone(): VideoFrame;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoFrame/close) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoFrame/close) */
close(): void; close(): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/VideoFrame/copyTo) */
copyTo(destination: AllowSharedBufferSource, options?: VideoFrameCopyToOptions): Promise<PlaneLayout[]>; copyTo(destination: AllowSharedBufferSource, options?: VideoFrameCopyToOptions): Promise<PlaneLayout[]>;
} }
@ -6668,7 +6630,7 @@ interface WebGL2RenderingContextBase {
clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: number): void; clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: number): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clientWaitSync) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/clientWaitSync) */
clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64): GLenum; clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64): GLenum;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/compressedTexImage3D) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/compressedTexImage2D) */
compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr): void; compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr): void;
compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: GLuint): void; compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: GLuint): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/compressedTexSubImage3D) */
@ -7549,6 +7511,7 @@ declare var WebGLRenderingContext: {
}; };
interface WebGLRenderingContextBase { interface WebGLRenderingContextBase {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferColorSpace) */
drawingBufferColorSpace: PredefinedColorSpace; drawingBufferColorSpace: PredefinedColorSpace;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferHeight) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferHeight) */
readonly drawingBufferHeight: GLsizei; readonly drawingBufferHeight: GLsizei;
@ -8258,7 +8221,7 @@ declare var WebGLVertexArrayObject: {
new(): WebGLVertexArrayObject; new(): WebGLVertexArrayObject;
}; };
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLVertexArrayObjectOES) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebGLVertexArrayObject) */
interface WebGLVertexArrayObjectOES { interface WebGLVertexArrayObjectOES {
} }
@ -8469,24 +8432,24 @@ interface WindowOrWorkerGlobalScope {
/** /**
* Available only in secure contexts. * Available only in secure contexts.
* *
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/caches) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/caches)
*/ */
readonly caches: CacheStorage; readonly caches: CacheStorage;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/crossOriginIsolated) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/crossOriginIsolated) */
readonly crossOriginIsolated: boolean; readonly crossOriginIsolated: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/crypto_property) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/crypto) */
readonly crypto: Crypto; readonly crypto: Crypto;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/indexedDB) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/indexedDB) */
readonly indexedDB: IDBFactory; readonly indexedDB: IDBFactory;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/isSecureContext) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/isSecureContext) */
readonly isSecureContext: boolean; readonly isSecureContext: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/origin) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/origin) */
readonly origin: string; readonly origin: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/performance_property) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/performance) */
readonly performance: Performance; readonly performance: Performance;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
atob(data: string): string; atob(data: string): string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
btoa(data: string): string; btoa(data: string): string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
clearInterval(id: number | undefined): void; clearInterval(id: number | undefined): void;
@ -8583,7 +8546,9 @@ interface WorkerGlobalScope extends EventTarget, FontFaceSource, WindowOrWorkerG
onoffline: ((this: WorkerGlobalScope, ev: Event) => any) | null; onoffline: ((this: WorkerGlobalScope, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/online_event) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/online_event) */
ononline: ((this: WorkerGlobalScope, ev: Event) => any) | null; ononline: ((this: WorkerGlobalScope, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/rejectionhandled_event) */
onrejectionhandled: ((this: WorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null; onrejectionhandled: ((this: WorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/unhandledrejection_event) */
onunhandledrejection: ((this: WorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null; onunhandledrejection: ((this: WorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null;
/** /**
* Returns workerGlobal. * Returns workerGlobal.
@ -8641,7 +8606,7 @@ declare var WorkerLocation: {
}; };
/** /**
* A subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property obtained by calling globalThis.self.navigator. * A subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property obtained by calling window.self.navigator.
* *
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerNavigator) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerNavigator)
*/ */
@ -8917,7 +8882,7 @@ interface Console {
clear(): void; clear(): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
count(label?: string): void; count(label?: string): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countreset_static) */
countReset(label?: string): void; countReset(label?: string): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
debug(...data: any[]): void; debug(...data: any[]): void;
@ -8929,9 +8894,9 @@ interface Console {
error(...data: any[]): void; error(...data: any[]): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
group(...data: any[]): void; group(...data: any[]): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupcollapsed_static) */
groupCollapsed(...data: any[]): void; groupCollapsed(...data: any[]): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupend_static) */
groupEnd(): void; groupEnd(): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
info(...data: any[]): void; info(...data: any[]): void;
@ -8941,9 +8906,9 @@ interface Console {
table(tabularData?: any, properties?: string[]): void; table(tabularData?: any, properties?: string[]): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
time(label?: string): void; time(label?: string): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeend_static) */
timeEnd(label?: string): void; timeEnd(label?: string): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timelog_static) */
timeLog(label?: string, ...data: any[]): void; timeLog(label?: string, ...data: any[]): void;
timeStamp(label?: string): void; timeStamp(label?: string): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
@ -8966,9 +8931,7 @@ declare namespace WebAssembly {
/** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/JavaScript_interface/Global) */ /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/JavaScript_interface/Global) */
interface Global<T extends ValueType = ValueType> { interface Global<T extends ValueType = ValueType> {
/** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/JavaScript_interface/Global/value) */
value: ValueTypeMap[T]; value: ValueTypeMap[T];
/** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/JavaScript_interface/Global/valueOf) */
valueOf(): ValueTypeMap[T]; valueOf(): ValueTypeMap[T];
} }
@ -9246,7 +9209,9 @@ declare var onlanguagechange: ((this: DedicatedWorkerGlobalScope, ev: Event) =>
declare var onoffline: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null; declare var onoffline: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/online_event) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/online_event) */
declare var ononline: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null; declare var ononline: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/rejectionhandled_event) */
declare var onrejectionhandled: ((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null; declare var onrejectionhandled: ((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/unhandledrejection_event) */
declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null; declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null;
/** /**
* Returns workerGlobal. * Returns workerGlobal.
@ -9271,24 +9236,24 @@ declare var fonts: FontFaceSet;
/** /**
* Available only in secure contexts. * Available only in secure contexts.
* *
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/caches) * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/caches)
*/ */
declare var caches: CacheStorage; declare var caches: CacheStorage;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/crossOriginIsolated) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/crossOriginIsolated) */
declare var crossOriginIsolated: boolean; declare var crossOriginIsolated: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/crypto_property) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/crypto) */
declare var crypto: Crypto; declare var crypto: Crypto;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/indexedDB) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/indexedDB) */
declare var indexedDB: IDBFactory; declare var indexedDB: IDBFactory;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/isSecureContext) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/isSecureContext) */
declare var isSecureContext: boolean; declare var isSecureContext: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/origin) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/origin) */
declare var origin: string; declare var origin: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/performance_property) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/performance) */
declare var performance: Performance; declare var performance: Performance;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
declare function atob(data: string): string; declare function atob(data: string): string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */
declare function btoa(data: string): string; declare function btoa(data: string): string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
declare function clearInterval(id: number | undefined): void; declare function clearInterval(id: number | undefined): void;
@ -9365,7 +9330,7 @@ type ReportList = Report[];
type RequestInfo = Request | string; type RequestInfo = Request | string;
type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas | VideoFrame; type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas | VideoFrame;
type TimerHandler = string | Function; type TimerHandler = string | Function;
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | VideoFrame | ArrayBuffer; type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | MediaSourceHandle | ReadableStream | WritableStream | TransformStream | VideoFrame | ArrayBuffer;
type Uint32List = Uint32Array | GLuint[]; type Uint32List = Uint32Array | GLuint[];
type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string;
type AlphaOption = "discard" | "keep"; type AlphaOption = "discard" | "keep";

View file

@ -26,24 +26,24 @@ interface AbortSignal {
} }
interface CSSNumericArray { interface CSSNumericArray {
[Symbol.iterator](): IterableIterator<CSSNumericValue>; [Symbol.iterator](): ArrayIterator<CSSNumericValue>;
entries(): IterableIterator<[number, CSSNumericValue]>; entries(): ArrayIterator<[number, CSSNumericValue]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<CSSNumericValue>; values(): ArrayIterator<CSSNumericValue>;
} }
interface CSSTransformValue { interface CSSTransformValue {
[Symbol.iterator](): IterableIterator<CSSTransformComponent>; [Symbol.iterator](): ArrayIterator<CSSTransformComponent>;
entries(): IterableIterator<[number, CSSTransformComponent]>; entries(): ArrayIterator<[number, CSSTransformComponent]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<CSSTransformComponent>; values(): ArrayIterator<CSSTransformComponent>;
} }
interface CSSUnparsedValue { interface CSSUnparsedValue {
[Symbol.iterator](): IterableIterator<CSSUnparsedSegment>; [Symbol.iterator](): ArrayIterator<CSSUnparsedSegment>;
entries(): IterableIterator<[number, CSSUnparsedSegment]>; entries(): ArrayIterator<[number, CSSUnparsedSegment]>;
keys(): IterableIterator<number>; keys(): ArrayIterator<number>;
values(): IterableIterator<CSSUnparsedSegment>; values(): ArrayIterator<CSSUnparsedSegment>;
} }
interface Cache { interface Cache {
@ -62,34 +62,42 @@ interface CanvasPathDrawingStyles {
} }
interface DOMStringList { interface DOMStringList {
[Symbol.iterator](): IterableIterator<string>; [Symbol.iterator](): ArrayIterator<string>;
} }
interface FileList { interface FileList {
[Symbol.iterator](): IterableIterator<File>; [Symbol.iterator](): ArrayIterator<File>;
} }
interface FontFaceSet extends Set<FontFace> { interface FontFaceSet extends Set<FontFace> {
} }
interface FormDataIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): FormDataIterator<T>;
}
interface FormData { interface FormData {
[Symbol.iterator](): IterableIterator<[string, FormDataEntryValue]>; [Symbol.iterator](): FormDataIterator<[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]>; entries(): FormDataIterator<[string, FormDataEntryValue]>;
/** Returns a list of keys in the list. */ /** Returns a list of keys in the list. */
keys(): IterableIterator<string>; keys(): FormDataIterator<string>;
/** Returns a list of values in the list. */ /** Returns a list of values in the list. */
values(): IterableIterator<FormDataEntryValue>; values(): FormDataIterator<FormDataEntryValue>;
}
interface HeadersIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): HeadersIterator<T>;
} }
interface Headers { interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>; [Symbol.iterator](): HeadersIterator<[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]>; entries(): HeadersIterator<[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>; keys(): HeadersIterator<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>; values(): HeadersIterator<string>;
} }
interface IDBDatabase { interface IDBDatabase {
@ -113,19 +121,19 @@ interface IDBObjectStore {
} }
interface MessageEvent<T = any> { interface MessageEvent<T = any> {
/** /** @deprecated */
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/initMessageEvent)
*/
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void; initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
} }
interface StylePropertyMapReadOnlyIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): StylePropertyMapReadOnlyIterator<T>;
}
interface StylePropertyMapReadOnly { interface StylePropertyMapReadOnly {
[Symbol.iterator](): IterableIterator<[string, Iterable<CSSStyleValue>]>; [Symbol.iterator](): StylePropertyMapReadOnlyIterator<[string, Iterable<CSSStyleValue>]>;
entries(): IterableIterator<[string, Iterable<CSSStyleValue>]>; entries(): StylePropertyMapReadOnlyIterator<[string, Iterable<CSSStyleValue>]>;
keys(): IterableIterator<string>; keys(): StylePropertyMapReadOnlyIterator<string>;
values(): IterableIterator<Iterable<CSSStyleValue>>; values(): StylePropertyMapReadOnlyIterator<Iterable<CSSStyleValue>>;
} }
interface SubtleCrypto { interface SubtleCrypto {
@ -143,14 +151,18 @@ interface SubtleCrypto {
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>; 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 URLSearchParamsIterator<T> extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): URLSearchParamsIterator<T>;
}
interface URLSearchParams { interface URLSearchParams {
[Symbol.iterator](): IterableIterator<[string, string]>; [Symbol.iterator](): URLSearchParamsIterator<[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]>; entries(): URLSearchParamsIterator<[string, string]>;
/** Returns a list of keys in the search params. */ /** Returns a list of keys in the search params. */
keys(): IterableIterator<string>; keys(): URLSearchParamsIterator<string>;
/** Returns a list of values in the search params. */ /** Returns a list of values in the search params. */
values(): IterableIterator<string>; values(): URLSearchParamsIterator<string>;
} }
interface WEBGL_draw_buffers { interface WEBGL_draw_buffers {

View file

@ -214,6 +214,22 @@ declare namespace ts {
* The time spent creating or updating the auto-import program, in milliseconds. * The time spent creating or updating the auto-import program, in milliseconds.
*/ */
createAutoImportProviderProgramDurationMs?: number; createAutoImportProviderProgramDurationMs?: number;
/**
* The time spent computing diagnostics, in milliseconds.
*/
diagnosticsDuration?: FileDiagnosticPerformanceData[];
}
/**
* Time spent computing each kind of diagnostics, in milliseconds.
*/
export type DiagnosticPerformanceData = {
[Kind in DiagnosticEventKind]?: number;
};
export interface FileDiagnosticPerformanceData extends DiagnosticPerformanceData {
/**
* The file for which the performance data is reported.
*/
file: string;
} }
/** /**
* Arguments for FileRequest messages. * Arguments for FileRequest messages.
@ -584,23 +600,7 @@ declare namespace ts {
} }
export interface ApplyCodeActionCommandResponse extends Response { export interface ApplyCodeActionCommandResponse extends Response {
} }
export interface FileRangeRequestArgs extends FileRequestArgs { export interface FileRangeRequestArgs extends FileRequestArgs, FileRange {
/**
* The line number for the request (1-based).
*/
startLine: number;
/**
* The character offset (on the line) for the request (1-based).
*/
startOffset: number;
/**
* The line number for the request (1-based).
*/
endLine: number;
/**
* The character offset (on the line) for the request (1-based).
*/
endOffset: number;
} }
/** /**
* Instances of this interface specify errorcodes on a specific location in a sourcefile. * Instances of this interface specify errorcodes on a specific location in a sourcefile.
@ -1866,7 +1866,7 @@ declare namespace ts {
* List of file names for which to compute compiler errors. * List of file names for which to compute compiler errors.
* The files will be checked in list order. * The files will be checked in list order.
*/ */
files: string[]; files: (string | FileRangesRequestArgs)[];
/** /**
* Delay in milliseconds to wait before starting to compute * Delay in milliseconds to wait before starting to compute
* errors for the files in the file list * errors for the files in the file list
@ -1887,6 +1887,27 @@ declare namespace ts {
command: CommandTypes.Geterr; command: CommandTypes.Geterr;
arguments: GeterrRequestArgs; arguments: GeterrRequestArgs;
} }
export interface FileRange {
/**
* The line number for the request (1-based).
*/
startLine: number;
/**
* The character offset (on the line) for the request (1-based).
*/
startOffset: number;
/**
* The line number for the request (1-based).
*/
endLine: number;
/**
* The character offset (on the line) for the request (1-based).
*/
endOffset: number;
}
export interface FileRangesRequestArgs extends Pick<FileRequestArgs, "file"> {
ranges: FileRange[];
}
export type RequestCompletedEventName = "requestCompleted"; export type RequestCompletedEventName = "requestCompleted";
/** /**
* Event that is sent when server have finished processing request with specified id. * Event that is sent when server have finished processing request with specified id.
@ -1897,6 +1918,7 @@ declare namespace ts {
} }
export interface RequestCompletedEventBody { export interface RequestCompletedEventBody {
request_seq: number; request_seq: number;
performanceData?: PerformanceData;
} }
/** /**
* Item of diagnostic information found in a DiagnosticEvent message. * Item of diagnostic information found in a DiagnosticEvent message.
@ -1969,8 +1991,12 @@ declare namespace ts {
* An array of diagnostic information items. * An array of diagnostic information items.
*/ */
diagnostics: Diagnostic[]; diagnostics: Diagnostic[];
/**
* Spans where the region diagnostic was requested, if this is a region semantic diagnostic event.
*/
spans?: TextSpan[];
} }
export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag";
/** /**
* Event message for DiagnosticEventKind event types. * Event message for DiagnosticEventKind event types.
* These events provide syntactic and semantic errors for a file. * These events provide syntactic and semantic errors for a file.
@ -2510,6 +2536,7 @@ declare namespace ts {
private readonly knownCachesSet; private readonly knownCachesSet;
private readonly projectWatchers; private readonly projectWatchers;
private safeList; private safeList;
private pendingRunRequests;
private installRunCount; private installRunCount;
private inFlightRequestCount; private inFlightRequestCount;
abstract readonly typesRegistry: Map<string, MapLike<string>>; abstract readonly typesRegistry: Map<string, MapLike<string>>;
@ -2636,6 +2663,7 @@ declare namespace ts {
interface ServerHost extends System { interface ServerHost extends System {
watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher; watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher; watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
preferNonRecursiveWatch?: boolean;
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
clearTimeout(timeoutId: any): void; clearTimeout(timeoutId: any): void;
setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
@ -2644,6 +2672,18 @@ declare namespace ts {
trace?(s: string): void; trace?(s: string): void;
require?(initialPath: string, moduleName: string): ModuleImportResult; require?(initialPath: string, moduleName: string): ModuleImportResult;
} }
interface InstallPackageOptionsWithProject extends InstallPackageOptions {
projectName: string;
projectRootPath: Path;
}
interface ITypingsInstaller {
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string> | undefined): void;
attach(projectService: ProjectService): void;
onProjectClosed(p: Project): void;
readonly globalTypingsCacheLocation: string | undefined;
}
function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings; function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
function toNormalizedPath(fileName: string): NormalizedPath; function toNormalizedPath(fileName: string): NormalizedPath;
function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path; function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path;
@ -2702,6 +2742,7 @@ declare namespace ts {
readonly containingProjects: Project[]; readonly containingProjects: Project[];
private formatSettings; private formatSettings;
private preferences; private preferences;
private realpath;
constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: number); constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: number);
isScriptOpen(): boolean; isScriptOpen(): boolean;
open(newText: string | undefined): void; open(newText: string | undefined): void;
@ -2735,19 +2776,6 @@ declare namespace ts {
positionToLineOffset(position: number): protocol.Location; positionToLineOffset(position: number): protocol.Location;
isJavaScript(): boolean; isJavaScript(): boolean;
} }
interface InstallPackageOptionsWithProject extends InstallPackageOptions {
projectName: string;
projectRootPath: Path;
}
interface ITypingsInstaller {
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string> | undefined): void;
attach(projectService: ProjectService): void;
onProjectClosed(p: Project): void;
readonly globalTypingsCacheLocation: string | undefined;
}
const nullTypingsInstaller: ITypingsInstaller;
function allRootFilesAreJsOrDts(project: Project): boolean; function allRootFilesAreJsOrDts(project: Project): boolean;
function allFilesAreJsOrDts(project: Project): boolean; function allFilesAreJsOrDts(project: Project): boolean;
enum ProjectKind { enum ProjectKind {
@ -2789,33 +2817,31 @@ declare namespace ts {
private externalFiles; private externalFiles;
private missingFilesMap; private missingFilesMap;
private generatedFilesMap; private generatedFilesMap;
private hasAddedorRemovedFiles;
private hasAddedOrRemovedSymlinks;
protected languageService: LanguageService; protected languageService: LanguageService;
languageServiceEnabled: boolean; languageServiceEnabled: boolean;
readonly trace?: (s: string) => void; readonly trace?: (s: string) => void;
readonly realpath?: (path: string) => string; readonly realpath?: (path: string) => string;
private builderState; private builderState;
/**
* Set of files names that were updated since the last call to getChangesSinceVersion.
*/
private updatedFileNames; private updatedFileNames;
/**
* Set of files that was returned from the last call to getChangesSinceVersion.
*/
private lastReportedFileNames; private lastReportedFileNames;
/**
* Last version that was reported.
*/
private lastReportedVersion; private lastReportedVersion;
protected projectErrors: Diagnostic[] | undefined; protected projectErrors: Diagnostic[] | undefined;
protected isInitialLoadPending: () => boolean; protected isInitialLoadPending: () => boolean;
private typingsCache;
private typingWatchers;
private readonly cancellationToken; private readonly cancellationToken;
isNonTsProject(): boolean; isNonTsProject(): boolean;
isJsOnlyProject(): boolean; isJsOnlyProject(): boolean;
static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined; static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined;
private exportMapCache;
private changedFilesForExportMapCache;
private moduleSpecifierCache;
private symlinks;
readonly jsDocParsingMode: JSDocParsingMode | undefined; readonly jsDocParsingMode: JSDocParsingMode | undefined;
isKnownTypesPackageName(name: string): boolean; isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>; installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
private get typingsCache();
getCompilationSettings(): ts.CompilerOptions; getCompilationSettings(): ts.CompilerOptions;
getCompilerOptions(): ts.CompilerOptions; getCompilerOptions(): ts.CompilerOptions;
getNewLine(): string; getNewLine(): string;
@ -2882,6 +2908,8 @@ declare namespace ts {
* @returns: true if set of files in the project stays the same and false - otherwise. * @returns: true if set of files in the project stays the same and false - otherwise.
*/ */
updateGraph(): boolean; updateGraph(): boolean;
private closeWatchingTypingLocations;
private onTypingInstallerWatchInvoke;
protected removeExistingTypings(include: string[]): string[]; protected removeExistingTypings(include: string[]): string[];
private updateGraphWorker; private updateGraphWorker;
private detachScriptInfoFromProject; private detachScriptInfoFromProject;
@ -2893,6 +2921,7 @@ declare namespace ts {
getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined; getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
getScriptInfo(uncheckedFileName: string): ts.server.ScriptInfo | undefined; getScriptInfo(uncheckedFileName: string): ts.server.ScriptInfo | undefined;
filesToString(writeProjectFileNames: boolean): string; filesToString(writeProjectFileNames: boolean): string;
private filesToStringWorker;
setCompilerOptions(compilerOptions: CompilerOptions): void; setCompilerOptions(compilerOptions: CompilerOptions): void;
setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void; setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void;
getTypeAcquisition(): ts.TypeAcquisition; getTypeAcquisition(): ts.TypeAcquisition;
@ -2901,6 +2930,8 @@ declare namespace ts {
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void; protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void;
/** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */ /** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
refreshDiagnostics(): void; refreshDiagnostics(): void;
private isDefaultProjectForOpenFiles;
private getCompilerOptionsForNoDtsResolutionProject;
} }
/** /**
* If a file is opened and no tsconfig (or jsconfig) is found, * If a file is opened and no tsconfig (or jsconfig) is found,
@ -2920,6 +2951,7 @@ declare namespace ts {
} }
class AutoImportProviderProject extends Project { class AutoImportProviderProject extends Project {
private hostProject; private hostProject;
private static readonly maxDependencies;
private rootFileNames; private rootFileNames;
updateGraph(): boolean; updateGraph(): boolean;
hasRoots(): boolean; hasRoots(): boolean;
@ -2936,6 +2968,8 @@ declare namespace ts {
class ConfiguredProject extends Project { class ConfiguredProject extends Project {
readonly canonicalConfigFilePath: NormalizedPath; readonly canonicalConfigFilePath: NormalizedPath;
private projectReferences; private projectReferences;
private compilerHost?;
private releaseParsedConfig;
/** /**
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
* @returns: true if set of files in the project stays the same and false - otherwise. * @returns: true if set of files in the project stays the same and false - otherwise.
@ -3126,6 +3160,7 @@ declare namespace ts {
configFileName?: NormalizedPath; configFileName?: NormalizedPath;
configFileErrors?: readonly Diagnostic[]; configFileErrors?: readonly Diagnostic[];
} }
const nullTypingsInstaller: ITypingsInstaller;
interface ProjectServiceOptions { interface ProjectServiceOptions {
host: ServerHost; host: ServerHost;
logger: Logger; logger: Logger;
@ -3151,16 +3186,8 @@ declare namespace ts {
} }
class ProjectService { class ProjectService {
private readonly nodeModulesWatchers; private readonly nodeModulesWatchers;
/**
* Contains all the deleted script info's version information so that
* it does not reset when creating script info again
* (and could have potentially collided with version where contents mismatch)
*/
private readonly filenameToScriptInfoVersion; private readonly filenameToScriptInfoVersion;
private readonly allJsFilesForOpenFileTelemetry; private readonly allJsFilesForOpenFileTelemetry;
/**
* maps external project file name to list of config files that were the part of this project
*/
private readonly externalProjectToConfiguredProjectMap; private readonly externalProjectToConfiguredProjectMap;
/** /**
* external projects (configuration and list of root files is not controlled by tsserver) * external projects (configuration and list of root files is not controlled by tsserver)
@ -3178,13 +3205,8 @@ declare namespace ts {
* Open files: with value being project root path, and key being Path of the file that is open * Open files: with value being project root path, and key being Path of the file that is open
*/ */
readonly openFiles: Map<Path, NormalizedPath | undefined>; readonly openFiles: Map<Path, NormalizedPath | undefined>;
/** Config files looked up and cached config files for open script info */
private readonly configFileForOpenFiles; private readonly configFileForOpenFiles;
/** Set of open script infos that are root of inferred project */
private rootOfInferredProjects; private rootOfInferredProjects;
/**
* Map of open files that are opened without complete path but have projectRoot as current directory
*/
private readonly openFilesWithNonRootedDiskPath; private readonly openFilesWithNonRootedDiskPath;
private compilerOptionsForInferredProjects; private compilerOptionsForInferredProjects;
private compilerOptionsForInferredProjectsPerProjectRoot; private compilerOptionsForInferredProjectsPerProjectRoot;
@ -3192,18 +3214,11 @@ declare namespace ts {
private watchOptionsForInferredProjectsPerProjectRoot; private watchOptionsForInferredProjectsPerProjectRoot;
private typeAcquisitionForInferredProjects; private typeAcquisitionForInferredProjects;
private typeAcquisitionForInferredProjectsPerProjectRoot; private typeAcquisitionForInferredProjectsPerProjectRoot;
/**
* Project size for configured or external projects
*/
private readonly projectToSizeMap; private readonly projectToSizeMap;
private readonly hostConfiguration; private readonly hostConfiguration;
private safelist; private safelist;
private readonly legacySafelist; private readonly legacySafelist;
private pendingProjectUpdates; private pendingProjectUpdates;
/**
* All the open script info that needs recalculation of the default project,
* this also caches config file info before config file change was detected to use it in case projects are not updated yet
*/
private pendingOpenFileProjectUpdates?; private pendingOpenFileProjectUpdates?;
readonly currentDirectory: NormalizedPath; readonly currentDirectory: NormalizedPath;
readonly toCanonicalFileName: (f: string) => string; readonly toCanonicalFileName: (f: string) => string;
@ -3221,8 +3236,11 @@ declare namespace ts {
readonly allowLocalPluginLoads: boolean; readonly allowLocalPluginLoads: boolean;
readonly typesMapLocation: string | undefined; readonly typesMapLocation: string | undefined;
readonly serverMode: LanguageServiceMode; readonly serverMode: LanguageServiceMode;
/** Tracks projects that we have already sent telemetry for. */
private readonly seenProjects; private readonly seenProjects;
private readonly sharedExtendedConfigFileWatchers;
private readonly extendedConfigCache;
private packageJsonFilesMap;
private incompleteCompletionsCache;
private performanceEventHandler?; private performanceEventHandler?;
private pendingPluginEnablements?; private pendingPluginEnablements?;
private currentPluginEnablementPromise?; private currentPluginEnablementPromise?;
@ -3236,20 +3254,9 @@ declare namespace ts {
setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void; setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void;
findProject(projectName: string): Project | undefined; findProject(projectName: string): Project | undefined;
getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined; getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined;
/**
* If there is default project calculation pending for this file,
* then it completes that calculation so that correct default project is used for the project
*/
private tryGetDefaultProjectForEnsuringConfiguredProjectForFile; private tryGetDefaultProjectForEnsuringConfiguredProjectForFile;
private doEnsureDefaultProjectForFile; private doEnsureDefaultProjectForFile;
getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined; getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined;
/**
* Ensures the project structures are upto date
* This means,
* - we go through all the projects and update them if they are dirty
* - if updates reflect some change in structure or there was pending request to ensure projects for open files
* ensure that each open script info has project
*/
private ensureProjectStructuresUptoDate; private ensureProjectStructuresUptoDate;
getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings; getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings;
getPreferences(file: NormalizedPath): protocol.UserPreferences; getPreferences(file: NormalizedPath): protocol.UserPreferences;
@ -3260,37 +3267,30 @@ declare namespace ts {
private delayUpdateSourceInfoProjects; private delayUpdateSourceInfoProjects;
private delayUpdateProjectsOfScriptInfoPath; private delayUpdateProjectsOfScriptInfoPath;
private handleDeletedFile; private handleDeletedFile;
private watchWildcardDirectory;
private onWildCardDirectoryWatcherInvoke;
private delayUpdateProjectsFromParsedConfigOnConfigFileChange;
private onConfigFileChanged;
private removeProject; private removeProject;
private assignOrphanScriptInfosToInferredProject; private assignOrphanScriptInfosToInferredProject;
/**
* Remove this file from the set of open, non-configured files.
* @param info The file that has been closed or newly configured
*/
private closeOpenFile; private closeOpenFile;
private deleteScriptInfo; private deleteScriptInfo;
private configFileExists; private configFileExists;
/** private createConfigFileWatcherForParsedConfig;
* This function tries to search for a tsconfig.json for the given file.
* This is different from the method the compiler uses because
* the compiler can assume it will always start searching in the
* current directory (the directory in which tsc was invoked).
* The server must start searching from the directory containing
* the newly opened file.
*/
private forEachConfigFileLocation; private forEachConfigFileLocation;
/** Get cached configFileName for scriptInfo or ancestor of open script info */
private getConfigFileNameForFileFromCache; private getConfigFileNameForFileFromCache;
/** Caches the configFilename for script info or ancestor of open script info */
private setConfigFileNameForFileInCache; private setConfigFileNameForFileInCache;
private printProjects; private printProjects;
private getConfiguredProjectByCanonicalConfigFilePath; private getConfiguredProjectByCanonicalConfigFilePath;
private findExternalProjectByProjectName; private findExternalProjectByProjectName;
/** Get a filename if the language service exceeds the maximum allowed program size; otherwise returns undefined. */
private getFilenameForExceededTotalSizeLimitForNonTsFiles; private getFilenameForExceededTotalSizeLimitForNonTsFiles;
private createExternalProject; private createExternalProject;
private addFilesToNonInferredProject; private addFilesToNonInferredProject;
private loadConfiguredProject;
private updateNonInferredProjectFiles; private updateNonInferredProjectFiles;
private updateRootAndOptionsOfNonInferredProject; private updateRootAndOptionsOfNonInferredProject;
private reloadFileNamesOfParsedConfig;
private clearSemanticCache;
private getOrCreateInferredProjectForProjectRootPathIfEnabled; private getOrCreateInferredProjectForProjectRootPathIfEnabled;
private getOrCreateSingleInferredProjectIfEnabled; private getOrCreateSingleInferredProjectIfEnabled;
private getOrCreateSingleInferredWithoutProjectRoot; private getOrCreateSingleInferredWithoutProjectRoot;
@ -3316,23 +3316,15 @@ declare namespace ts {
private addSourceInfoToSourceMap; private addSourceInfoToSourceMap;
private addMissingSourceMapFile; private addMissingSourceMapFile;
setHostConfiguration(args: protocol.ConfigureRequestArguments): void; setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
private getWatchOptionsFromProjectWatchOptions;
closeLog(): void; closeLog(): void;
private sendSourceFileChange;
/** /**
* This function rebuilds the project for every file opened by the client * This function rebuilds the project for every file opened by the client
* This does not reload contents of open files from disk. But we could do that if needed * This does not reload contents of open files from disk. But we could do that if needed
*/ */
reloadProjects(): void; reloadProjects(): void;
/**
* Remove the root of inferred project if script info is part of another project
*/
private removeRootOfInferredProjectIfNowPartOfOtherProject; private removeRootOfInferredProjectIfNowPartOfOtherProject;
/**
* This function is to update the project structure for every inferred project.
* It is called on the premise that all the configured projects are
* up to date.
* This will go through open files and assign them to inferred project if open file is not part of any other project
* After that all the inferred project graphs are updated
*/
private ensureProjectForOpenFiles; private ensureProjectForOpenFiles;
/** /**
* Open file whose contents is managed by the client * Open file whose contents is managed by the client
@ -3343,20 +3335,12 @@ declare namespace ts {
private findExternalProjectContainingOpenScriptInfo; private findExternalProjectContainingOpenScriptInfo;
private getOrCreateOpenScriptInfo; private getOrCreateOpenScriptInfo;
private assignProjectToOpenedScriptInfo; private assignProjectToOpenedScriptInfo;
/**
* Finds the default configured project for given info
* For any tsconfig found, it looks into that project, if not then all its references,
* The search happens for all tsconfigs till projectRootPath
*/
private tryFindDefaultConfiguredProjectForOpenScriptInfo; private tryFindDefaultConfiguredProjectForOpenScriptInfo;
/**
* Finds the default configured project, if found, it creates the solution projects (does not load them right away)
* with Find: finds the projects even if the project is deferredClosed
*/
private tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo; private tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo;
private ensureProjectChildren; private ensureProjectChildren;
private cleanupConfiguredProjects; private cleanupConfiguredProjects;
private cleanupProjectsAndScriptInfos; private cleanupProjectsAndScriptInfos;
private tryInvokeWildCardDirectories;
openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult; openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
private removeOrphanScriptInfos; private removeOrphanScriptInfos;
private telemetryOnOpenFile; private telemetryOnOpenFile;
@ -3368,7 +3352,6 @@ declare namespace ts {
private collectChanges; private collectChanges;
closeExternalProject(uncheckedFileName: string): void; closeExternalProject(uncheckedFileName: string): void;
openExternalProjects(projects: protocol.ExternalProject[]): void; openExternalProjects(projects: protocol.ExternalProject[]): void;
/** Makes a filename safe to insert in a RegExp */
private static readonly filenameEscapeRegexp; private static readonly filenameEscapeRegexp;
private static escapeFilenameForRegex; private static escapeFilenameForRegex;
resetSafeList(): void; resetSafeList(): void;
@ -3376,9 +3359,12 @@ declare namespace ts {
private applySafeListWorker; private applySafeListWorker;
openExternalProject(proj: protocol.ExternalProject): void; openExternalProject(proj: protocol.ExternalProject): void;
hasDeferredExtension(): boolean; hasDeferredExtension(): boolean;
private endEnablePlugin;
private enableRequestedPluginsAsync; private enableRequestedPluginsAsync;
private enableRequestedPluginsWorker; private enableRequestedPluginsWorker;
configurePlugin(args: protocol.ConfigurePluginRequestArguments): void; configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
private watchPackageJsonFile;
private onPackageJsonChange;
} }
function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string; function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string;
interface ServerCancellationToken extends HostCancellationToken { interface ServerCancellationToken extends HostCancellationToken {
@ -3386,10 +3372,6 @@ declare namespace ts {
resetRequest(requestId: number): void; resetRequest(requestId: number): void;
} }
const nullCancellationToken: ServerCancellationToken; const nullCancellationToken: ServerCancellationToken;
interface PendingErrorCheck {
fileName: NormalizedPath;
project: Project;
}
/** @deprecated use ts.server.protocol.CommandTypes */ /** @deprecated use ts.server.protocol.CommandTypes */
type CommandNames = protocol.CommandTypes; type CommandNames = protocol.CommandTypes;
/** @deprecated use ts.server.protocol.CommandTypes */ /** @deprecated use ts.server.protocol.CommandTypes */
@ -3449,6 +3431,7 @@ declare namespace ts {
constructor(opts: SessionOptions); constructor(opts: SessionOptions);
private sendRequestCompletedEvent; private sendRequestCompletedEvent;
private addPerformanceData; private addPerformanceData;
private addDiagnosticsPerformanceData;
private performanceEventHandler; private performanceEventHandler;
private defaultEventHandler; private defaultEventHandler;
private projectsUpdatedInBackgroundEvent; private projectsUpdatedInBackgroundEvent;
@ -3460,8 +3443,8 @@ declare namespace ts {
private semanticCheck; private semanticCheck;
private syntacticCheck; private syntacticCheck;
private suggestionCheck; private suggestionCheck;
private regionSemanticCheck;
private sendDiagnosticsEvent; private sendDiagnosticsEvent;
/** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
private updateErrorCheck; private updateErrorCheck;
private cleanProjects; private cleanProjects;
private cleanup; private cleanup;
@ -3508,10 +3491,6 @@ declare namespace ts {
private toSpanGroups; private toSpanGroups;
private getReferences; private getReferences;
private getFileReferences; private getFileReferences;
/**
* @param fileName is the name of the file to be opened
* @param fileContent is a version of the file content that is known to be more up to date than the one on disk
*/
private openClientFile; private openClientFile;
private getPosition; private getPosition;
private getPositionInFile; private getPositionInFile;
@ -3610,19 +3589,12 @@ declare namespace ts {
} }
namespace deno { namespace deno {
function setIsNodeSourceFileCallback(callback: IsNodeSourceFileCallback): void; function setIsNodeSourceFileCallback(callback: IsNodeSourceFileCallback): void;
function setNodeBuiltInModuleNames(names: readonly string[]): void;
function setNodeOnlyGlobalNames(names: readonly string[]): void; function setNodeOnlyGlobalNames(names: readonly string[]): void;
function createDenoForkContext({ mergeSymbol, globals, nodeGlobals, ambientModuleSymbolRegex }: { function createDenoForkContext({ mergeSymbol, globals, nodeGlobals }: {
mergeSymbol(target: ts.Symbol, source: ts.Symbol, unidirectional?: boolean): ts.Symbol; mergeSymbol(target: ts.Symbol, source: ts.Symbol, unidirectional?: boolean): ts.Symbol;
globals: ts.SymbolTable; globals: ts.SymbolTable;
nodeGlobals: ts.SymbolTable; nodeGlobals: ts.SymbolTable;
ambientModuleSymbolRegex: RegExp; }): DenoForkContext;
}): {
hasNodeSourceFile: (node: ts.Node | undefined) => boolean;
getGlobalsForName: (id: ts.__String) => ts.SymbolTable;
mergeGlobalSymbolTable: (node: ts.Node, source: ts.SymbolTable, unidirectional?: boolean) => void;
combinedGlobals: ts.SymbolTable;
};
function tryParseNpmPackageReference(text: string): { function tryParseNpmPackageReference(text: string): {
name: string; name: string;
versionReq: string | undefined; versionReq: string | undefined;
@ -3634,6 +3606,12 @@ declare namespace ts {
subPath: string | undefined; subPath: string | undefined;
}; };
type IsNodeSourceFileCallback = (sourceFile: ts.SourceFile) => boolean; type IsNodeSourceFileCallback = (sourceFile: ts.SourceFile) => boolean;
interface DenoForkContext {
hasNodeSourceFile: (node: ts.Node | undefined) => boolean;
getGlobalsForName: (id: ts.__String) => ts.SymbolTable;
mergeGlobalSymbolTable: (node: ts.Node, source: ts.SymbolTable, unidirectional?: boolean) => void;
combinedGlobals: ts.SymbolTable;
}
interface NpmPackageReference { interface NpmPackageReference {
name: string; name: string;
versionReq: string; versionReq: string;
@ -3648,7 +3626,7 @@ declare namespace ts {
readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[]; readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[];
} }
} }
const versionMajorMinor = "5.5"; const versionMajorMinor = "5.6";
/** The version of the TypeScript compiler release */ /** The version of the TypeScript compiler release */
const version: string; const version: string;
/** /**
@ -4478,7 +4456,7 @@ declare namespace ts {
readonly right: Identifier; readonly right: Identifier;
} }
type EntityName = Identifier | QualifiedName; type EntityName = Identifier | QualifiedName;
type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier; type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier | BigIntLiteral;
type MemberName = Identifier | PrivateIdentifier; type MemberName = Identifier | PrivateIdentifier;
type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression; type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
interface Declaration extends Node { interface Declaration extends Node {
@ -4829,7 +4807,7 @@ declare namespace ts {
readonly kind: SyntaxKind.StringLiteral; readonly kind: SyntaxKind.StringLiteral;
} }
type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral; type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName; type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName | BigIntLiteral;
interface TemplateLiteralTypeNode extends TypeNode { interface TemplateLiteralTypeNode extends TypeNode {
kind: SyntaxKind.TemplateLiteralType; kind: SyntaxKind.TemplateLiteralType;
readonly head: TemplateHead; readonly head: TemplateHead;
@ -5549,7 +5527,7 @@ declare namespace ts {
interface NamespaceExport extends NamedDeclaration { interface NamespaceExport extends NamedDeclaration {
readonly kind: SyntaxKind.NamespaceExport; readonly kind: SyntaxKind.NamespaceExport;
readonly parent: ExportDeclaration; readonly parent: ExportDeclaration;
readonly name: Identifier; readonly name: ModuleExportName;
} }
interface NamespaceExportDeclaration extends DeclarationStatement, JSDocContainer { interface NamespaceExportDeclaration extends DeclarationStatement, JSDocContainer {
readonly kind: SyntaxKind.NamespaceExportDeclaration; readonly kind: SyntaxKind.NamespaceExportDeclaration;
@ -5581,7 +5559,7 @@ declare namespace ts {
interface ImportSpecifier extends NamedDeclaration { interface ImportSpecifier extends NamedDeclaration {
readonly kind: SyntaxKind.ImportSpecifier; readonly kind: SyntaxKind.ImportSpecifier;
readonly parent: NamedImports; readonly parent: NamedImports;
readonly propertyName?: Identifier; readonly propertyName?: ModuleExportName;
readonly name: Identifier; readonly name: Identifier;
readonly isTypeOnly: boolean; readonly isTypeOnly: boolean;
} }
@ -5589,9 +5567,10 @@ declare namespace ts {
readonly kind: SyntaxKind.ExportSpecifier; readonly kind: SyntaxKind.ExportSpecifier;
readonly parent: NamedExports; readonly parent: NamedExports;
readonly isTypeOnly: boolean; readonly isTypeOnly: boolean;
readonly propertyName?: Identifier; readonly propertyName?: ModuleExportName;
readonly name: Identifier; readonly name: ModuleExportName;
} }
type ModuleExportName = Identifier | StringLiteral;
type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier | ExportDeclaration | NamespaceExport; type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier | ExportDeclaration | NamespaceExport;
type TypeOnlyImportDeclaration = type TypeOnlyImportDeclaration =
@ -6046,19 +6025,67 @@ declare namespace ts {
isSourceFileFromExternalLibrary(file: SourceFile): boolean; isSourceFileFromExternalLibrary(file: SourceFile): boolean;
isSourceFileDefaultLibrary(file: SourceFile): boolean; isSourceFileDefaultLibrary(file: SourceFile): boolean;
/** /**
* Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import * Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
* attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may * settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
* depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other * which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
* `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no * overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
* impact on module resolution, emit, or type checking. * Some examples:
*
* ```ts
* // tsc foo.mts --module nodenext
* import {} from "mod";
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
*
* // tsc foo.cts --module nodenext
* import {} from "mod";
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
*
* // tsc foo.ts --module preserve --moduleResolution bundler
* import {} from "mod";
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
* // supports conditional imports/exports
*
* // tsc foo.ts --module preserve --moduleResolution node10
* import {} from "mod";
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
* // does not support conditional imports/exports
*
* // tsc foo.ts --module commonjs --moduleResolution node10
* import type {} from "mod" with { "resolution-mode": "import" };
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
* ```
*/ */
getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode; getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
/** /**
* Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode * Calculates the final resolution mode for an import at some index within a file's `imports` list. This function only returns a result
* explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In * when module resolution settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided
* `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the * via import attributes, which cause an `import` or `require` condition to be used during resolution regardless of module resolution
* input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns * settings. In absence of overriding attributes, and in modes that support differing resolution, the result indicates the syntax the
* `undefined`, as the result would have no impact on module resolution, emit, or type checking. * usage would emit to JavaScript. Some examples:
*
* ```ts
* // tsc foo.mts --module nodenext
* import {} from "mod";
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
*
* // tsc foo.cts --module nodenext
* import {} from "mod";
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
*
* // tsc foo.ts --module preserve --moduleResolution bundler
* import {} from "mod";
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
* // supports conditional imports/exports
*
* // tsc foo.ts --module preserve --moduleResolution node10
* import {} from "mod";
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
* // does not support conditional imports/exports
*
* // tsc foo.ts --module commonjs --moduleResolution node10
* import type {} from "mod" with { "resolution-mode": "import" };
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
* ```
*/ */
getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode; getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
getProjectReferences(): readonly ProjectReference[] | undefined; getProjectReferences(): readonly ProjectReference[] | undefined;
@ -6125,6 +6152,27 @@ declare namespace ts {
getBaseTypes(type: InterfaceType): BaseType[]; getBaseTypes(type: InterfaceType): BaseType[];
getBaseTypeOfLiteralType(type: Type): Type; getBaseTypeOfLiteralType(type: Type): Type;
getWidenedType(type: Type): Type; getWidenedType(type: Type): Type;
/**
* Gets the "awaited type" of a type.
*
* If an expression has a Promise-like type, the "awaited type" of the expression is
* derived from the type of the first argument of the fulfillment callback for that
* Promise's `then` method. If the "awaited type" is itself a Promise-like, it is
* recursively unwrapped in the same manner until a non-promise type is found.
*
* If an expression does not have a Promise-like type, its "awaited type" is the type
* of the expression.
*
* If the resulting "awaited type" is a generic object type, then it is wrapped in
* an `Awaited<T>`.
*
* In the event the "awaited type" circularly references itself, or is a non-Promise
* object-type with a callable `then()` method, an "awaited type" cannot be determined
* and the value `undefined` will be returned.
*
* This is used to reflect the runtime behavior of the `await` keyword.
*/
getAwaitedType(type: Type): Type | undefined;
getReturnTypeOfSignature(signature: Signature): Type; getReturnTypeOfSignature(signature: Signature): Type;
getNullableType(type: Type, flags: TypeFlags): Type; getNullableType(type: Type, flags: TypeFlags): Type;
getNonNullableType(type: Type): Type; getNonNullableType(type: Type): Type;
@ -6217,6 +6265,7 @@ declare namespace ts {
getNumberType(): Type; getNumberType(): Type;
getNumberLiteralType(value: number): NumberLiteralType; getNumberLiteralType(value: number): NumberLiteralType;
getBigIntType(): Type; getBigIntType(): Type;
getBigIntLiteralType(value: PseudoBigInt): BigIntLiteralType;
getBooleanType(): Type; getBooleanType(): Type;
getFalseType(): Type; getFalseType(): Type;
getTrueType(): Type; getTrueType(): Type;
@ -6686,7 +6735,11 @@ declare namespace ts {
minLength: number; minLength: number;
/** Number of initial required or optional elements */ /** Number of initial required or optional elements */
fixedLength: number; fixedLength: number;
/** True if tuple has any rest or variadic elements */ /**
* True if tuple has any rest or variadic elements
*
* @deprecated Use `.combinedFlags & ElementFlags.Variable` instead
*/
hasRestElement: boolean; hasRestElement: boolean;
combinedFlags: ElementFlags; combinedFlags: ElementFlags;
readonly: boolean; readonly: boolean;
@ -7010,6 +7063,7 @@ declare namespace ts {
strictBindCallApply?: boolean; strictBindCallApply?: boolean;
strictNullChecks?: boolean; strictNullChecks?: boolean;
strictPropertyInitialization?: boolean; strictPropertyInitialization?: boolean;
strictBuiltinIteratorReturn?: boolean;
stripInternal?: boolean; stripInternal?: boolean;
/** @deprecated */ /** @deprecated */
suppressExcessPropertyErrors?: boolean; suppressExcessPropertyErrors?: boolean;
@ -7018,6 +7072,7 @@ declare namespace ts {
target?: ScriptTarget; target?: ScriptTarget;
traceResolution?: boolean; traceResolution?: boolean;
useUnknownInCatchVariables?: boolean; useUnknownInCatchVariables?: boolean;
noUncheckedSideEffectImports?: boolean;
resolveJsonModule?: boolean; resolveJsonModule?: boolean;
types?: string[]; types?: string[];
/** Paths used to compute primary types search locations */ /** Paths used to compute primary types search locations */
@ -7344,9 +7399,10 @@ declare namespace ts {
TypeAssertions = 2, TypeAssertions = 2,
NonNullAssertions = 4, NonNullAssertions = 4,
PartiallyEmittedExpressions = 8, PartiallyEmittedExpressions = 8,
ExpressionsWithTypeArguments = 16,
Assertions = 6, Assertions = 6,
All = 15, All = 31,
ExcludeJSDocTypeAssertion = 16, ExcludeJSDocTypeAssertion = -2147483648,
} }
type ImmediatelyInvokedFunctionExpression = CallExpression & { type ImmediatelyInvokedFunctionExpression = CallExpression & {
readonly expression: FunctionExpression; readonly expression: FunctionExpression;
@ -7645,20 +7701,20 @@ declare namespace ts {
updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute;
createNamespaceImport(name: Identifier): NamespaceImport; createNamespaceImport(name: Identifier): NamespaceImport;
updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
createNamespaceExport(name: Identifier): NamespaceExport; createNamespaceExport(name: ModuleExportName): NamespaceExport;
updateNamespaceExport(node: NamespaceExport, name: Identifier): NamespaceExport; updateNamespaceExport(node: NamespaceExport, name: ModuleExportName): NamespaceExport;
createNamedImports(elements: readonly ImportSpecifier[]): NamedImports; createNamedImports(elements: readonly ImportSpecifier[]): NamedImports;
updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports; updateNamedImports(node: NamedImports, elements: readonly ImportSpecifier[]): NamedImports;
createImportSpecifier(isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; createImportSpecifier(isTypeOnly: boolean, propertyName: ModuleExportName | undefined, name: Identifier): ImportSpecifier;
updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: ModuleExportName | undefined, name: Identifier): ImportSpecifier;
createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment;
createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, attributes?: ImportAttributes): ExportDeclaration; createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, attributes?: ImportAttributes): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, attributes: ImportAttributes | undefined): ExportDeclaration;
createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; createExportSpecifier(isTypeOnly: boolean, propertyName: string | ModuleExportName | undefined, name: string | ModuleExportName): ExportSpecifier;
updateExportSpecifier(node: ExportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ExportSpecifier; updateExportSpecifier(node: ExportSpecifier, isTypeOnly: boolean, propertyName: ModuleExportName | undefined, name: ModuleExportName): ExportSpecifier;
createExternalModuleReference(expression: Expression): ExternalModuleReference; createExternalModuleReference(expression: Expression): ExternalModuleReference;
updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference;
createJSDocAllType(): JSDocAllType; createJSDocAllType(): JSDocAllType;
@ -8238,6 +8294,7 @@ declare namespace ts {
readonly interactiveInlayHints?: boolean; readonly interactiveInlayHints?: boolean;
readonly allowRenameOfImportPath?: boolean; readonly allowRenameOfImportPath?: boolean;
readonly autoImportFileExcludePatterns?: string[]; readonly autoImportFileExcludePatterns?: string[];
readonly autoImportSpecifierExcludeRegexes?: string[];
readonly preferTypeOnlyAutoImports?: boolean; readonly preferTypeOnlyAutoImports?: boolean;
/** /**
* Indicates whether imports should be organized in a case-insensitive manner. * Indicates whether imports should be organized in a case-insensitive manner.
@ -8976,6 +9033,7 @@ declare namespace ts {
function isExportDeclaration(node: Node): node is ExportDeclaration; function isExportDeclaration(node: Node): node is ExportDeclaration;
function isNamedExports(node: Node): node is NamedExports; function isNamedExports(node: Node): node is NamedExports;
function isExportSpecifier(node: Node): node is ExportSpecifier; function isExportSpecifier(node: Node): node is ExportSpecifier;
function isModuleExportName(node: Node): node is ModuleExportName;
function isMissingDeclaration(node: Node): node is MissingDeclaration; function isMissingDeclaration(node: Node): node is MissingDeclaration;
function isNotEmittedStatement(node: Node): node is NotEmittedStatement; function isNotEmittedStatement(node: Node): node is NotEmittedStatement;
function isExternalModuleReference(node: Node): node is ExternalModuleReference; function isExternalModuleReference(node: Node): node is ExternalModuleReference;
@ -9411,24 +9469,43 @@ declare namespace ts {
function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode; function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
/** /**
* Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible. * Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
* Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import * Calculates the final resolution mode for a given module reference node. This function only returns a result when module resolution
* attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may * settings allow differing resolution between ESM imports and CJS requires, or when a mode is explicitly provided via import attributes,
* depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other * which cause an `import` or `require` condition to be used during resolution regardless of module resolution settings. In absence of
* `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no * overriding attributes, and in modes that support differing resolution, the result indicates the syntax the usage would emit to JavaScript.
* impact on module resolution, emit, or type checking. * Some examples:
*
* ```ts
* // tsc foo.mts --module nodenext
* import {} from "mod";
* // Result: ESNext - the import emits as ESM due to `impliedNodeFormat` set by .mts file extension
*
* // tsc foo.cts --module nodenext
* import {} from "mod";
* // Result: CommonJS - the import emits as CJS due to `impliedNodeFormat` set by .cts file extension
*
* // tsc foo.ts --module preserve --moduleResolution bundler
* import {} from "mod";
* // Result: ESNext - the import emits as ESM due to `--module preserve` and `--moduleResolution bundler`
* // supports conditional imports/exports
*
* // tsc foo.ts --module preserve --moduleResolution node10
* import {} from "mod";
* // Result: undefined - the import emits as ESM due to `--module preserve`, but `--moduleResolution node10`
* // does not support conditional imports/exports
*
* // tsc foo.ts --module commonjs --moduleResolution node10
* import type {} from "mod" with { "resolution-mode": "import" };
* // Result: ESNext - conditional imports/exports always supported with "resolution-mode" attribute
* ```
*
* @param file The file the import or import-like reference is contained within * @param file The file the import or import-like reference is contained within
* @param usage The module reference string * @param usage The module reference string
* @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
* should be the options of the referenced project, not the referencing project. * should be the options of the referenced project, not the referencing project.
* @returns The final resolution mode of the import * @returns The final resolution mode of the import
*/ */
function getModeForUsageLocation( function getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike, compilerOptions: CompilerOptions): ResolutionMode;
file: {
impliedNodeFormat?: ResolutionMode;
},
usage: StringLiteralLike,
compilerOptions: CompilerOptions,
): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[]; function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
/** /**
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
@ -9654,6 +9731,7 @@ declare namespace ts {
setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
/** If provided, will be used to reset existing delayed compilation */ /** If provided, will be used to reset existing delayed compilation */
clearTimeout?(timeoutId: any): void; clearTimeout?(timeoutId: any): void;
preferNonRecursiveWatch?: boolean;
} }
interface ProgramHost<T extends BuilderProgram> { interface ProgramHost<T extends BuilderProgram> {
/** /**
@ -9776,6 +9854,7 @@ declare namespace ts {
dry?: boolean; dry?: boolean;
force?: boolean; force?: boolean;
verbose?: boolean; verbose?: boolean;
stopBuildOnErrors?: boolean;
incremental?: boolean; incremental?: boolean;
assumeChangesOnlyAffectDirectDependencies?: boolean; assumeChangesOnlyAffectDirectDependencies?: boolean;
declaration?: boolean; declaration?: boolean;
@ -10743,6 +10822,10 @@ declare namespace ts {
*/ */
isIncomplete?: true; isIncomplete?: true;
entries: CompletionEntry[]; entries: CompletionEntry[];
/**
* Default commit characters for the completion entries.
*/
defaultCommitCharacters?: string[];
} }
interface CompletionEntryDataAutoImport { interface CompletionEntryDataAutoImport {
/** /**
@ -10849,6 +10932,10 @@ declare namespace ts {
* is an auto-import. * is an auto-import.
*/ */
data?: CompletionEntryData; data?: CompletionEntryData;
/**
* If this completion entry is selected, typing a commit character will cause the entry to be accepted.
*/
commitCharacters?: string[];
} }
interface CompletionEntryLabelDetails { interface CompletionEntryLabelDetails {
/** /**

View file

@ -1096,7 +1096,6 @@ mod tests {
"jsxFactory": "React.createElement", "jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment", "jsxFragmentFactory": "React.Fragment",
"lib": ["deno.window"], "lib": ["deno.window"],
"module": "esnext",
"noEmit": true, "noEmit": true,
"outDir": "internal:///", "outDir": "internal:///",
"strict": true, "strict": true,

View file

@ -52,11 +52,6 @@ itest!(check_npm_install_diagnostics {
exit_code: 1, exit_code: 1,
}); });
itest!(check_export_equals_declaration_file {
args: "check --quiet check/export_equals_declaration_file/main.ts",
exit_code: 0,
});
itest!(check_static_response_json { itest!(check_static_response_json {
args: "check --quiet check/response_json.ts", args: "check --quiet check/response_json.ts",
exit_code: 0, exit_code: 0,

View file

@ -5380,7 +5380,7 @@ fn lsp_jsr_auto_import_completion() {
json!({ "triggerKind": 1 }), json!({ "triggerKind": 1 }),
); );
assert!(!list.is_incomplete); assert!(!list.is_incomplete);
assert_eq!(list.items.len(), 267); assert_eq!(list.items.len(), 268);
let item = list.items.iter().find(|i| i.label == "add").unwrap(); let item = list.items.iter().find(|i| i.label == "add").unwrap();
assert_eq!(&item.label, "add"); assert_eq!(&item.label, "add");
assert_eq!( assert_eq!(
@ -5460,7 +5460,7 @@ fn lsp_jsr_auto_import_completion_import_map() {
json!({ "triggerKind": 1 }), json!({ "triggerKind": 1 }),
); );
assert!(!list.is_incomplete); assert!(!list.is_incomplete);
assert_eq!(list.items.len(), 267); assert_eq!(list.items.len(), 268);
let item = list.items.iter().find(|i| i.label == "add").unwrap(); let item = list.items.iter().find(|i| i.label == "add").unwrap();
assert_eq!(&item.label, "add"); assert_eq!(&item.label, "add");
assert_eq!(json!(&item.label_details), json!({ "description": "add" })); assert_eq!(json!(&item.label_details), json!({ "description": "add" }));

Binary file not shown.

View file

@ -1,17 +1,49 @@
{ {
"name": "@types/node", "name": "@types/node",
"description": "TypeScript definitions for node",
"dist-tags": { "dist-tags": {
"latest": "18.8.2" "ts4.9": "22.5.4",
"ts5.5": "22.5.4",
"ts5.6": "22.5.4",
"ts5.7": "22.5.4",
"ts4.8": "22.5.4",
"ts5.2": "22.5.4",
"ts5.3": "22.5.4",
"ts5.4": "22.5.4",
"ts5.1": "22.5.4",
"ts5.0": "22.5.4",
"latest": "22.5.4"
}, },
"versions": { "versions": {
"18.8.2": { "18.8.2": {
"name": "@types/node", "name": "@types/node",
"version": "18.8.2", "version": "18.8.2",
"description": "TypeScript definitions for Node.js",
"license": "MIT", "license": "MIT",
"_id": "@types/node@18.8.2",
"dist": {
"shasum": "17d42c6322d917764dd3d2d3a10d7884925de067",
"tarball": "http://localhost:4260/@types/node/node-18.8.2.tgz",
"fileCount": 124,
"integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==",
"signatures": [
{
"sig": "MEYCIQCAqI3XibndhBD647C/13AFb58Fhmg4WmfCoGrIYrgtzwIhAIB0b0D58Tigwb3qKaOVsKnuYOOr0strAmprZSCi/+oq",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 3524549,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjPFItACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKAg/+IwaUWPgePlO4IxW7CVhFEEFiyhjEH3FHe0ogC3YmreoBFv/A\r\nPwQrwObdskbGWrBzsAOVFvhzYktzP3kc857HtU2ia9FXeaEYvsSQBqh6jZfA\r\njR1+h+jn+W5JnmbnwRGfNn2riCo/un4tYoZ4o/bKiMdNd9WrdIs0Oii1Dd4N\r\nnsBXPb05UPPP4Uu8cz68u1bj+QQ6aslr6keGNyNeILf8bJsEfcfVkEO3l4cu\r\njyTIrxiD+tM8jrUE9CDeodF8CZNuvLh3hqdMPJeH3U47qkDtPDKEOvZTbyYm\r\ngodto6mcnuBr8F9vmikAQfGiXV0U2cg2XRjWc1lI8HT4X0kESTIo+nzNuliD\r\niTpfjyZHdKBGGIuHP1Ou9dVvx4t5XZ1JsK9EK5WTilvAlu/qZrynxXxAV3Rc\r\nvL9UhIacISprMWB3Sohl9ZtfcmGnV/KMRpM+yPZOWp39gQQCKaKF/j2f/mir\r\n8YFbFUnySZkXKzxgsgjrSsh9QiK2dYAzcqHlazITeFN9jOYRzYUjAFj3qOFm\r\n7o1eJpW0qM5vgR+fPq30WxcdcQ4PaWgHSlb/ll8hiwQG1ZUihO/1RU7FtDoc\r\n1KwcfrGOAJPL6vBSLPReUkhDIUTSBwfmvfMxzqD1aDp6YV5WX7h03B0dWbPJ\r\nmPJmJZjjZje4Trk9jBJ5/ZLpB8/zkrDKvhE=\r\n=LPWa\r\n-----END PGP SIGNATURE-----\r\n"
},
"main": "", "main": "",
"types": "index.d.ts", "types": "index.d.ts",
"scripts": {},
"repository": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"type": "git",
"directory": "types/node"
},
"description": "TypeScript definitions for Node.js",
"directories": {},
"dependencies": {},
"typesVersions": { "typesVersions": {
"<4.9.0-0": { "<4.9.0-0": {
"*": [ "*": [
@ -19,33 +51,39 @@
] ]
} }
}, },
"repository": { "_hasShrinkwrap": false,
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/node"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "034172ea945b66afc6502e6be34d6fb957c596091e39cf43672e8aca563a8c66",
"typeScriptVersion": "4.1", "typeScriptVersion": "4.1",
"_id": "@types/node@18.8.2", "typesPublisherContentHash": "034172ea945b66afc6502e6be34d6fb957c596091e39cf43672e8aca563a8c66"
"dist": {
"integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==",
"shasum": "17d42c6322d917764dd3d2d3a10d7884925de067",
"tarball": "http://localhost:4260/@types/node/node-18.8.2.tgz",
"fileCount": 124,
"unpackedSize": 3524549
},
"directories": {},
"_hasShrinkwrap": false
}, },
"18.16.19": { "18.16.19": {
"name": "@types/node", "name": "@types/node",
"version": "18.16.19", "version": "18.16.19",
"description": "TypeScript definitions for Node.js",
"license": "MIT", "license": "MIT",
"_id": "@types/node@18.16.19",
"dist": {
"shasum": "cb03fca8910fdeb7595b755126a8a78144714eea",
"tarball": "http://localhost:4260/@types/node/node-18.16.19.tgz",
"fileCount": 125,
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",
"signatures": [
{
"sig": "MEYCIQCrmUK+J0P1ywi+U/RBUqMXSK7c0kDYxMEYunkXNSPf+wIhANTRnqmuKWdzIKhsGHCZB+js8qhLcce/P+XOR1JmSNIc",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 3677153
},
"main": "", "main": "",
"types": "index.d.ts", "types": "index.d.ts",
"scripts": {},
"repository": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"type": "git",
"directory": "types/node"
},
"description": "TypeScript definitions for Node.js",
"directories": {},
"dependencies": {},
"typesVersions": { "typesVersions": {
"<=4.8": { "<=4.8": {
"*": [ "*": [
@ -53,33 +91,54 @@
] ]
} }
}, },
"_hasShrinkwrap": false,
"typeScriptVersion": "4.3",
"typesPublisherContentHash": "e0763594b4075c74150a6024cd39f92797ea5c273540e3a5fe0a63a791ffa0c8"
},
"22.5.4": {
"name": "@types/node",
"version": "22.5.4",
"license": "MIT",
"_id": "@types/node@22.5.4",
"dist": {
"shasum": "83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8",
"tarball": "http://localhost:4260/@types/node/node-22.5.4.tgz",
"fileCount": 66,
"integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
"signatures": [
{
"sig": "MEQCIBbWAo9Soe8vwExWQDxwtbCM6CdXy4QChOKJVJSoNpNiAiBfaOBNxW/iDfPEGn6WQ/wZggtMCAdZNLbVBfSynJ/pdA==",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 2203331
},
"main": "",
"types": "index.d.ts",
"scripts": {},
"repository": { "repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"type": "git",
"directory": "types/node" "directory": "types/node"
}, },
"scripts": {}, "description": "TypeScript definitions for node",
"dependencies": {},
"typesPublisherContentHash": "e0763594b4075c74150a6024cd39f92797ea5c273540e3a5fe0a63a791ffa0c8",
"typeScriptVersion": "4.3",
"_id": "@types/node@18.16.19",
"dist": {
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",
"shasum": "cb03fca8910fdeb7595b755126a8a78144714eea",
"tarball": "http://localhost:4260/@types/node/node-18.16.19.tgz",
"fileCount": 125,
"unpackedSize": 3677153
},
"directories": {}, "directories": {},
"_hasShrinkwrap": false "dependencies": {
"undici-types": "~6.19.2"
},
"_hasShrinkwrap": false,
"typeScriptVersion": "4.8",
"typesPublisherContentHash": "6ee9a11eba834031423800320320aa873d6bf2b6f33603c13a2aa9d90b3803ee"
} }
}, },
"license": "MIT", "license": "MIT",
"readmeFilename": "", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"repository": { "repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"type": "git",
"directory": "types/node" "directory": "types/node"
}, },
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node" "description": "TypeScript definitions for node",
} "readme": "[object Object]",
"readmeFilename": ""
}

0
tests/registry/npm/trim_registry_files.js Executable file → Normal file
View file

View file

@ -0,0 +1,53 @@
{
"name": "undici-types",
"dist-tags": {
"latest": "6.19.8"
},
"versions": {
"6.19.8": {
"name": "undici-types",
"version": "6.19.8",
"description": "A stand-alone types package for Undici",
"bugs": {
"url": "https://github.com/nodejs/undici/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/undici.git"
},
"license": "MIT",
"types": "index.d.ts",
"_id": "undici-types@6.19.8",
"gitHead": "3d3ce0695c8c3f9a8f3c8af90dd42d0569d3f0bb",
"_nodeVersion": "20.16.0",
"_npmVersion": "10.8.1",
"dist": {
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"shasum": "35111c9d1437ab83a7cdc0abae2f26d88eda0a02",
"tarball": "http://localhost:4260/undici-types/undici-types-6.19.8.tgz",
"fileCount": 41,
"unpackedSize": 84225,
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEUCIGHm3RU6nmPjpFrE7lus7cMT9nBeVHOhTWjzflE57x08AiEAs6/KJsXAnqL1KXWZBAkJ5Gf4NdDUqZcjr/OL+clXX3I="
}
]
},
"directories": {},
"_hasShrinkwrap": false
}
},
"bugs": {
"url": "https://github.com/nodejs/undici/issues"
},
"license": "MIT",
"homepage": "https://undici.nodejs.org",
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/undici.git"
},
"description": "A stand-alone types package for Undici",
"readme": "# undici-types\n\nThis package is a dual-publish of the [undici](https://www.npmjs.com/package/undici) library types. The `undici` package **still contains types**. This package is for users who _only_ need undici types (such as for `@types/node`). It is published alongside every release of `undici`, so you can always use the same version.\n\n- [GitHub nodejs/undici](https://github.com/nodejs/undici)\n- [Undici Documentation](https://undici.nodejs.org/#/)\n",
"readmeFilename": "README.md"
}

View file

@ -0,0 +1,10 @@
{
"steps": [{
"args": "check main.ts",
"output": "main.out"
}, {
// ensure diagnostic is not cached
"args": "check main.ts",
"output": "main.out"
}]
}

View file

@ -0,0 +1,6 @@
Check file:///[WILDLINE]/main.ts
TS1203 [WARN]: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. This will start erroring in a future version of Deno 2 in order to align with TypeScript.
export = other;
~~~~~~~~~~~~~~~
at file:///[WILDLINE]/other.d.ts:1:1

View file

@ -1,7 +1,11 @@
Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix.
Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix.
[UNORDERED_START]
Download http://localhost:4260/@types/node Download http://localhost:4260/@types/node
Download http://localhost:4260/@types/node/node-18.16.19.tgz Download http://localhost:4260/undici-types
Download http://localhost:4260/@types/node/node-22.5.4.tgz
Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz
[UNORDERED_END]
Check file:///[WILDLINE]/mod.ts Check file:///[WILDLINE]/mod.ts
Checking for slow types in the public API... Checking for slow types in the public API...
Check file:///[WILDLINE]/mod.ts Check file:///[WILDLINE]/mod.ts

View file

@ -1,5 +1,9 @@
[UNORDERED_START]
Download http://localhost:4260/@types/node Download http://localhost:4260/@types/node
Download http://localhost:4260/@types/node/node-[WILDCARD].tgz Download http://localhost:4260/undici-types
Download http://localhost:4260/@types/node/node-22.5.4.tgz
Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz
[UNORDERED_END]
Check file:///[WILDCARD]/mod.ts Check file:///[WILDCARD]/mod.ts
Checking for slow types in the public API... Checking for slow types in the public API...
Check file:///[WILDCARD]/publish/node_specifier/mod.ts Check file:///[WILDCARD]/publish/node_specifier/mod.ts

View file

@ -1,10 +1,12 @@
[UNORDERED_START] [UNORDERED_START]
Download http://localhost:4260/@types/node Download http://localhost:4260/@types/node
Download http://localhost:4260/undici-types
Download http://localhost:4260/@denotest/globals Download http://localhost:4260/@denotest/globals
[UNORDERED_END] [UNORDERED_END]
[UNORDERED_START] [UNORDERED_START]
Download http://localhost:4260/@denotest/globals/1.0.0.tgz Download http://localhost:4260/@denotest/globals/1.0.0.tgz
Download http://localhost:4260/@types/node/node-18.16.19.tgz Download http://localhost:4260/@types/node/node-22.5.4.tgz
Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz
[UNORDERED_END] [UNORDERED_END]
Check file:///[WILDCARD]/npm/compare_globals/main.ts Check file:///[WILDCARD]/npm/compare_globals/main.ts
true true

View file

@ -6,5 +6,5 @@ Deno.test(function version() {
const pattern = /^\d+\.\d+\.\d+/; const pattern = /^\d+\.\d+\.\d+/;
assert(pattern.test(Deno.version.deno)); assert(pattern.test(Deno.version.deno));
assert(pattern.test(Deno.version.v8)); assert(pattern.test(Deno.version.v8));
assertEquals(Deno.version.typescript, "5.5.2"); assertEquals(Deno.version.typescript, "5.6.2");
}); });

View file

@ -133,7 +133,9 @@ Deno.test("[std/node/fs] stat callback isn't called twice if error is thrown", a
Deno.test({ Deno.test({
name: "[std/node/fs] stat default methods", name: "[std/node/fs] stat default methods",
fn() { fn() {
const stats = new Stats(); // stats ctor is private
// deno-lint-ignore no-explicit-any
const stats = new (Stats as any)();
assertEquals(stats.isFile(), false); assertEquals(stats.isFile(), false);
assertEquals(stats.isDirectory(), false); assertEquals(stats.isDirectory(), false);
assertEquals(stats.isBlockDevice(), false); assertEquals(stats.isBlockDevice(), false);

View file

@ -12,7 +12,7 @@ import {
assertThrows, assertThrows,
} from "@std/assert"; } from "@std/assert";
import * as path from "@std/path"; import * as path from "@std/path";
import { setTimeout } from "node:timers"; import { clearTimeout, setTimeout } from "node:timers";
const { spawn, spawnSync, execFile, execFileSync, ChildProcess } = CP; const { spawn, spawnSync, execFile, execFileSync, ChildProcess } = CP;

View file

@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// @ts-expect-error: @types/node is outdated
import events, { addAbortListener, EventEmitter } from "node:events"; import events, { addAbortListener, EventEmitter } from "node:events";
EventEmitter.captureRejections = true; EventEmitter.captureRejections = true;

View file

@ -3,7 +3,6 @@
import { assert, assertEquals } from "@std/assert"; import { assert, assertEquals } from "@std/assert";
import { fromFileUrl, relative } from "@std/path"; import { fromFileUrl, relative } from "@std/path";
import { pipeline } from "node:stream/promises"; import { pipeline } from "node:stream/promises";
// @ts-expect-error: @types/node is outdated
import { getDefaultHighWaterMark, Stream } from "node:stream"; import { getDefaultHighWaterMark, Stream } from "node:stream";
import { createReadStream, createWriteStream } from "node:fs"; import { createReadStream, createWriteStream } from "node:fs";
import { EventEmitter } from "node:events"; import { EventEmitter } from "node:events";

View file

@ -198,7 +198,7 @@ async function ensureNoNewITests() {
"bench_tests.rs": 0, "bench_tests.rs": 0,
"cache_tests.rs": 0, "cache_tests.rs": 0,
"cert_tests.rs": 0, "cert_tests.rs": 0,
"check_tests.rs": 22, "check_tests.rs": 21,
"compile_tests.rs": 0, "compile_tests.rs": 0,
"coverage_tests.rs": 0, "coverage_tests.rs": 0,
"eval_tests.rs": 0, "eval_tests.rs": 0,