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

feat: TypeScript 5.0.2 (except decorators) (#18294)

This upgrades TypeScript to 5.0.2, but does not have ES decorator
support because swc does not support that yet.
This commit is contained in:
David Sherret 2023-03-21 11:46:40 -04:00 committed by GitHub
parent 0366d6833f
commit 2fcf1f14cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 173492 additions and 178485 deletions

145
Cargo.lock generated
View file

@ -791,9 +791,9 @@ dependencies = [
[[package]]
name = "deno_ast"
version = "0.24.0"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76e007f9f03be5484596ea6bed86ffdc6357ba9660cb8da20845baf2ce079722"
checksum = "b08341e0ed5b816e24b6582054b37707c8686de5598fa3004dc555131c993308"
dependencies = [
"anyhow",
"base64 0.13.1",
@ -922,9 +922,9 @@ dependencies = [
[[package]]
name = "deno_doc"
version = "0.57.0"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "717302b02dd63e4e16a5e7f6339a74708a981b2addc5cbc944b9a4c74857120c"
checksum = "809eb811963058339383294e27e464cf792d05e9e73c834ecf46a98c69a613c3"
dependencies = [
"cfg-if",
"deno_ast",
@ -940,9 +940,9 @@ dependencies = [
[[package]]
name = "deno_emit"
version = "0.16.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "068712ed5abcae4c109c4e08d7b8f959fc974726c922a6c3c71aabb613249c92"
checksum = "f00bbc0de48ee82a1645063b71310bac75db182002d6cbe318b808c26c7d10ad"
dependencies = [
"anyhow",
"base64 0.13.1",
@ -1023,9 +1023,9 @@ dependencies = [
[[package]]
name = "deno_graph"
version = "0.44.3"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "500e2ba1f77f6baf0722a84290ab238ff47c46e48d0f94e3f3cd5632a012ee0c"
checksum = "46c47969e9745b8ecd0bbf674e374a47a2cc465b00887716295b422ddb5ae56b"
dependencies = [
"anyhow",
"data-url",
@ -1080,9 +1080,9 @@ dependencies = [
[[package]]
name = "deno_lint"
version = "0.41.0"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb65a10eb9bbff2c0e475958ea4a1f7db1f1e92d4a78a07853867049b7dfee8f"
checksum = "6afdaeeec629609b4a95b29db5e151a437e133524ad62d4bb4358cf4f70f0465"
dependencies = [
"anyhow",
"deno_ast",
@ -1452,9 +1452,9 @@ dependencies = [
[[package]]
name = "dprint-plugin-typescript"
version = "0.83.0"
version = "0.84.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d1c293007fd6552e023431731f0d6fa0ed560d056ef4609e1c6dfcfbd734924"
checksum = "f763f97007edaf6dd50f59526f29ee8aa8fa056f50644601bde04e0f1ac2e208"
dependencies = [
"anyhow",
"deno_ast",
@ -1465,9 +1465,9 @@ dependencies = [
[[package]]
name = "dprint-swc-ext"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e2dc99247101e0132a17680c5afbba9a7334477b47738dd3431c13f5e2c9a84"
checksum = "008b6061551bcf644454469e6506c32bb23b765df93d608bf7a8e2494f82fcb3"
dependencies = [
"bumpalo",
"num-bigint",
@ -1645,12 +1645,12 @@ dependencies = [
[[package]]
name = "eszip"
version = "0.37.0"
version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a9f2547787db6a0f5998a91dc54a3b5031190d11edcc62739473c0299bf36b"
checksum = "7291206febe844df2138e11a419ac22b6a9d02931663a9cd58a8f3989116ae5e"
dependencies = [
"anyhow",
"base64 0.13.1",
"base64 0.21.0",
"deno_ast",
"deno_graph",
"futures",
@ -3263,6 +3263,15 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "psm"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874"
dependencies = [
"cc",
]
[[package]]
name = "pty2"
version = "0.1.0"
@ -3929,6 +3938,17 @@ version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "smartstring"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
dependencies = [
"autocfg",
"static_assertions",
"version_check",
]
[[package]]
name = "socket2"
version = "0.4.9"
@ -3976,6 +3996,19 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stacker"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce"
dependencies = [
"cc",
"cfg-if",
"libc",
"psm",
"winapi",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
@ -4016,9 +4049,9 @@ dependencies = [
[[package]]
name = "string_enum"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "994453cd270ad0265796eb24abf5540091ed03e681c5f3c12bc33e4db33253e1"
checksum = "41491e23e7db79343236a6ced96325ff132eb09e29ac4c5b8132b9c55aaaae89"
dependencies = [
"pmutil",
"proc-macro2 1.0.51",
@ -4041,9 +4074,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "swc_atoms"
version = "0.4.34"
version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "731cf66bd8e11030f056f91f9d8af77f83ec4377ff04d1670778a57d1607402a"
checksum = "2ebef84c2948cd0d1ba25acbf1b4bd9d80ab6f057efdbe35d8449b8d54699401"
dependencies = [
"once_cell",
"rustc-hash",
@ -4055,9 +4088,9 @@ dependencies = [
[[package]]
name = "swc_bundler"
version = "0.199.11"
version = "0.208.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd8fba0fc5fd9deb528007c6bd6b0a326d17c114d702a1ec00863c2981bb03af"
checksum = "5adaebcfcb3ebc1b4d6418838250bb12f257bab9277fa2b2c61bb3324152c78f"
dependencies = [
"ahash",
"anyhow",
@ -4086,9 +4119,9 @@ dependencies = [
[[package]]
name = "swc_common"
version = "0.29.29"
version = "0.29.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97e491d31418cd33fea58e9f893316fc04b30e2b5d0e750c066e2ba4907ae54"
checksum = "5005cd73617e18592faa31298225b26f1c407b84a681d67efb735c3d3458e101"
dependencies = [
"ahash",
"ast_node",
@ -4139,9 +4172,9 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.96.3"
version = "0.100.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a887102d5595b557261aa4bde35f3d71906fba674d4b79cd5c59b4155b12ee2d"
checksum = "7dbfdbe05dde274473a6030dcf5e52e579516aea761d25d7a8d128f2ab597f09"
dependencies = [
"bitflags",
"is-macro",
@ -4156,9 +4189,9 @@ dependencies = [
[[package]]
name = "swc_ecma_codegen"
version = "0.129.8"
version = "0.135.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f8f20522626a737753381bdf64ee53d568730f9f7e720d35960de97e5ff965"
checksum = "78d196e6979af0cbb91084361ca006db292a6374f75ec04cbb55306051cc4f50"
dependencies = [
"memchr",
"num-bigint",
@ -4188,9 +4221,9 @@ dependencies = [
[[package]]
name = "swc_ecma_dep_graph"
version = "0.96.5"
version = "0.102.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fa847768c9ffb0b44085c881bc8931b3cb17f8eb0b81c65bf9068c0e9cbdc02"
checksum = "188196862dfb9bbf12f5fcf1f0397c0b70852144f666d406f09951ddcf0a73e0"
dependencies = [
"swc_atoms",
"swc_common",
@ -4200,9 +4233,9 @@ dependencies = [
[[package]]
name = "swc_ecma_loader"
version = "0.41.31"
version = "0.41.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c996baa947150d496c79fbd153d3df834e38d05c779abc4af987aded90e168a2"
checksum = "681c1fbb762c82700a5bd23dc39bad892a287ea9fb2121cf56e77f1ddc89afeb"
dependencies = [
"ahash",
"anyhow",
@ -4214,9 +4247,9 @@ dependencies = [
[[package]]
name = "swc_ecma_parser"
version = "0.124.5"
version = "0.130.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e75888eabf1ad8a8968e3befc7cd20c10e4721254d3344285bd5c3a42f58dc1"
checksum = "042435aaeb71c4416cde440323ac9fa2c24121c2ec150f0cb79999c2e6ceffaa"
dependencies = [
"either",
"enum_kind",
@ -4224,6 +4257,8 @@ dependencies = [
"num-bigint",
"serde",
"smallvec",
"smartstring",
"stacker",
"swc_atoms",
"swc_common",
"swc_ecma_ast",
@ -4233,9 +4268,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_base"
version = "0.116.5"
version = "0.122.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f5a212abba41897332f9ab3af8fe5d1a59f83d69e25eea119c27d9b53876688"
checksum = "fd4141092b17cd85eefc224b035b717e03c910b9fd58e4e637ffd05236d7e13b"
dependencies = [
"better_scoped_tls",
"bitflags",
@ -4255,9 +4290,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_classes"
version = "0.105.5"
version = "0.111.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2fd5a8eff1a7f16ec1b3ae50186debf3d3983effed6ed05d4e6db0ed7aadcac"
checksum = "b5022c592f0ae17f4dc42031e1c4c60b7e6d2d8d1c2428b986759a92ea853801"
dependencies = [
"swc_atoms",
"swc_common",
@ -4282,9 +4317,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_optimization"
version = "0.172.12"
version = "0.181.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db95141f068ca7cf391157c05bfb74c8b628174aa213b96c3a20a12ab3e07d14"
checksum = "584b8d5b1ea8d174453eeff6abb66ed2e58cbd67b6e83a4d4b8154b463ef4dd3"
dependencies = [
"ahash",
"dashmap",
@ -4307,9 +4342,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_proposal"
version = "0.149.8"
version = "0.156.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6fe11a20c7ced3c6b6149da330b8b4d8912fe02af6923aaac4d4479aa3dd3b6"
checksum = "f4015c3ab090f27eee0834d45bdcf9666dc6329ed06845d1882cdfe6f4826fca"
dependencies = [
"either",
"serde",
@ -4326,9 +4361,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_react"
version = "0.160.9"
version = "0.167.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b94e3884668e2e12684e4adf812dbd22d34b17da2d7637b1c9cffe393acad6c2"
checksum = "db1c7801b1d7741ab335441dd301ddcc4183fb250d5e6efaab33b03def268c06"
dependencies = [
"ahash",
"base64 0.13.1",
@ -4352,9 +4387,9 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_typescript"
version = "0.164.10"
version = "0.171.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a885199b43798b46d8b26b4a986f899436f9f2cb37477eb12a183388a5c213f"
checksum = "142e8fb5ebe870bc51b3a95c0214af9112d3475b7cd5be4f13b87f3be664841a"
dependencies = [
"serde",
"swc_atoms",
@ -4368,9 +4403,9 @@ dependencies = [
[[package]]
name = "swc_ecma_utils"
version = "0.107.5"
version = "0.113.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d773cf626c8d3be468a883879cda3727a2f1ea6169ccd0b5b8eb2d7afb5f367b"
checksum = "4c44885603c09926118708f4352e04242c2482bc16eb51ad7beb8ad4cf5f7bb6"
dependencies = [
"indexmap",
"num_cpus",
@ -4386,9 +4421,9 @@ dependencies = [
[[package]]
name = "swc_ecma_visit"
version = "0.82.3"
version = "0.86.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b2ee0f4b61d6c426189d0d9da1333705ff3bc4513fb63633ca254595a700f75"
checksum = "147cf9137da6fe2704a5defd29a1cde849961978f8c92911e6790d50df475fef"
dependencies = [
"num-bigint",
"swc_atoms",
@ -4412,9 +4447,9 @@ dependencies = [
[[package]]
name = "swc_fast_graph"
version = "0.17.30"
version = "0.17.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42663a304e6b2aa28ff50da0c1cb49fc9d5e84a97d57d68d7eba385602deef95"
checksum = "e3a720ad8028d6c6e992039c862ed7318d143dee3994929793f59067fd69600b"
dependencies = [
"ahash",
"indexmap",
@ -4424,9 +4459,9 @@ dependencies = [
[[package]]
name = "swc_graph_analyzer"
version = "0.18.32"
version = "0.18.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b4fd7f98578fda786fed452c0a790c93ad6825abfe20989758afa1f13295273"
checksum = "b25ac475500b0776f1bb82da02eff867819b3c653130023ea957cbd1e91befa8"
dependencies = [
"ahash",
"auto_impl",

View file

@ -43,7 +43,7 @@ repository = "https://github.com/denoland/deno"
[workspace.dependencies]
v8 = { version = "0.65.0", default-features = false }
deno_ast = { version = "0.24.0", features = ["transpiling"] }
deno_ast = { version = "0.25.0", features = ["transpiling"] }
deno_core = { version = "0.175.0", path = "./core" }
deno_ops = { version = "0.53.0", path = "./ops" }

View file

@ -42,10 +42,10 @@ winres.workspace = true
[dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_graph", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = "0.57.0"
deno_emit = "0.16.0"
deno_graph = "=0.44.3"
deno_lint = { version = "0.41.0", features = ["docs"] }
deno_doc = "0.59.0"
deno_emit = "0.17.0"
deno_graph = "=0.45.0"
deno_lint = { version = "0.43.0", features = ["docs"] }
deno_lockfile.workspace = true
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "include_js_files_for_snapshotting"] }
deno_task_shell = "0.10.0"
@ -65,10 +65,10 @@ data-url.workspace = true
dissimilar = "=1.0.4"
dprint-plugin-json = "=0.17.0"
dprint-plugin-markdown = "=0.15.2"
dprint-plugin-typescript = "=0.83.0"
dprint-plugin-typescript = "=0.84.0"
encoding_rs.workspace = true
env_logger = "=0.9.0"
eszip = "=0.37.0"
eszip = "=0.38.0"
fancy-regex = "=0.10.0"
flate2.workspace = true
fs3.workspace = true

View file

@ -95,6 +95,7 @@ impl Serialize for IgnoredCompilerOptions {
/// either have no effect on the compilation or would cause the emit to not work
/// in Deno.
pub const IGNORED_COMPILER_OPTIONS: &[&str] = &[
"allowImportingTsExtensions",
"allowSyntheticDefaultImports",
"allowUmdGlobalAccess",
"assumeChangesOnlyAffectDirectDependencies",
@ -900,6 +901,7 @@ pub fn get_ts_config_for_emit(
) -> Result<TsConfigForEmit, AnyError> {
let mut ts_config = match config_type {
TsConfigType::Bundle => TsConfig::new(json!({
"allowImportingTsExtensions": true,
"checkJs": false,
"emitDecoratorMetadata": false,
"importsNotUsedAsValues": "remove",
@ -912,6 +914,7 @@ pub fn get_ts_config_for_emit(
})),
TsConfigType::Check { lib } => TsConfig::new(json!({
"allowJs": true,
"allowImportingTsExtensions": true,
"allowSyntheticDefaultImports": true,
"checkJs": false,
"emitDecoratorMetadata": false,
@ -936,6 +939,7 @@ pub fn get_ts_config_for_emit(
"useUnknownInCatchVariables": false,
})),
TsConfigType::Emit => TsConfig::new(json!({
"allowImportingTsExtensions": true,
"checkJs": false,
"emitDecoratorMetadata": false,
"importsNotUsedAsValues": "remove",

View file

@ -162,6 +162,8 @@ mod ts {
"deno.ns",
"deno.unstable",
// Deno built-in type libraries
"decorators",
"decorators.legacy",
"es5",
"es2015.collection",
"es2015.core",
@ -212,8 +214,11 @@ mod ts {
"es2022.error",
"es2022.intl",
"es2022.object",
"es2022.regexp",
"es2022.sharedmemory",
"es2022.string",
"es2023",
"es2023.array",
"esnext",
"esnext.array",
"esnext.intl",
@ -287,20 +292,11 @@ mod ts {
pub(crate) fn version() -> String {
let file_text = std::fs::read_to_string("tsc/00_typescript.js").unwrap();
let mut version = String::new();
let version_text = " version = \"";
for line in file_text.lines() {
let major_minor_text = "ts.versionMajorMinor = \"";
let version_text = "ts.version = \"\".concat(ts.versionMajorMinor, \"";
if version.is_empty() {
if let Some(index) = line.find(major_minor_text) {
let remaining_line = &line[index + major_minor_text.len()..];
version
.push_str(&remaining_line[..remaining_line.find('"').unwrap()]);
}
} else if let Some(index) = line.find(version_text) {
if let Some(index) = line.find(version_text) {
let remaining_line = &line[index + version_text.len()..];
version.push_str(&remaining_line[..remaining_line.find('"').unwrap()]);
return version;
return remaining_line[..remaining_line.find('"').unwrap()].to_string();
}
}
panic!("Could not find ts version.")
@ -459,7 +455,9 @@ fn main() {
println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_commit_hash());
println!("cargo:rerun-if-env-changed=GIT_COMMIT_HASH");
println!("cargo:rustc-env=TS_VERSION={}", ts::version());
let ts_version = ts::version();
debug_assert_eq!(ts_version, "5.0.2"); // bump this assertion when it changes
println!("cargo:rustc-env=TS_VERSION={}", ts_version);
println!("cargo:rerun-if-env-changed=TS_VERSION");
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());

View file

@ -11,6 +11,7 @@
use deno_ast::Diagnostic;
use deno_core::error::AnyError;
use deno_graph::ModuleError;
use deno_graph::ModuleGraphError;
use deno_graph::ResolutionError;
use import_map::ImportMapError;
@ -25,18 +26,17 @@ fn get_diagnostic_class(_: &Diagnostic) -> &'static str {
fn get_module_graph_error_class(err: &ModuleGraphError) -> &'static str {
match err {
ModuleGraphError::LoadingErr(_, _, err) => {
get_error_class_name(err.as_ref())
}
ModuleGraphError::InvalidTypeAssertion { .. } => "SyntaxError",
ModuleGraphError::ParseErr(_, diagnostic) => {
get_diagnostic_class(diagnostic)
}
ModuleGraphError::ModuleError(err) => match err {
ModuleError::LoadingErr(_, _, err) => get_error_class_name(err.as_ref()),
ModuleError::InvalidTypeAssertion { .. } => "SyntaxError",
ModuleError::ParseErr(_, diagnostic) => get_diagnostic_class(diagnostic),
ModuleError::UnsupportedMediaType { .. }
| ModuleError::UnsupportedImportAssertionType { .. } => "TypeError",
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
"NotFound"
}
},
ModuleGraphError::ResolutionError(err) => get_resolution_error_class(err),
ModuleGraphError::UnsupportedMediaType { .. }
| ModuleGraphError::UnsupportedImportAssertionType { .. } => "TypeError",
ModuleGraphError::Missing(_, _)
| ModuleGraphError::MissingDynamic(_, _) => "NotFound",
}
}

View file

@ -93,7 +93,7 @@ fn fetch_local(specifier: &ModuleSpecifier) -> Result<File, AnyError> {
let bytes = fs::read(&local)?;
let charset = text_encoding::detect_charset(&bytes).to_string();
let source = get_source_from_bytes(bytes, Some(charset))?;
let media_type = MediaType::from(specifier);
let media_type = MediaType::from_specifier(specifier);
Ok(File {
local,
@ -166,7 +166,7 @@ pub fn map_content_type(
(media_type, charset)
} else {
(MediaType::from(specifier), None)
(MediaType::from_specifier(specifier), None)
}
}

View file

@ -22,6 +22,7 @@ use deno_core::ModuleSpecifier;
use deno_core::TaskQueue;
use deno_core::TaskQueuePermit;
use deno_graph::Module;
use deno_graph::ModuleError;
use deno_graph::ModuleGraph;
use deno_graph::ModuleGraphError;
use deno_graph::ResolutionError;
@ -83,7 +84,9 @@ pub fn graph_valid(
.flat_map(|error| {
let is_root = match &error {
ModuleGraphError::ResolutionError(_) => false,
_ => roots.contains(error.specifier()),
ModuleGraphError::ModuleError(error) => {
roots.contains(error.specifier())
}
};
let mut message = if let ModuleGraphError::ResolutionError(err) = &error {
enhanced_resolution_error_message(err)
@ -99,7 +102,10 @@ pub fn graph_valid(
if options.is_vendoring {
// warn about failing dynamic imports when vendoring, but don't fail completely
if matches!(error, ModuleGraphError::MissingDynamic(_, _)) {
if matches!(
error,
ModuleGraphError::ModuleError(ModuleError::MissingDynamic(_, _))
) {
log::warn!("Ignoring: {:#}", message);
return None;
}
@ -436,7 +442,6 @@ mod test {
specifier: input.to_string(),
range: Range {
specifier,
text: "".to_string(),
start: Position::zeroed(),
end: Position::zeroed(),
},
@ -453,7 +458,6 @@ mod test {
let err = ResolutionError::InvalidSpecifier {
range: Range {
specifier,
text: "".to_string(),
start: Position::zeroed(),
end: Position::zeroed(),
},

View file

@ -680,7 +680,6 @@ mod tests {
&text_info,
&Range {
specifier: ModuleSpecifier::parse("https://deno.land").unwrap(),
text: "".to_string(),
start: deno_graph::Position {
line: 0,
character: 0,
@ -705,7 +704,6 @@ mod tests {
&text_info,
&Range {
specifier: ModuleSpecifier::parse("https://deno.land").unwrap(),
text: "".to_string(),
start: deno_graph::Position {
line: 0,
character: 0,

View file

@ -1163,7 +1163,7 @@ let c: number = "a";
)
.await
.unwrap();
assert_eq!(get_diagnostics_for_single(diagnostics).len(), 4);
assert_eq!(get_diagnostics_for_single(diagnostics).len(), 5);
let diagnostics = generate_deno_diagnostics(
&snapshot,
&enabled_config,

View file

@ -528,7 +528,7 @@ impl Document {
if let Some(Ok(module)) = &self.0.maybe_module {
return module.media_type;
}
let specifier_media_type = MediaType::from(&self.0.specifier);
let specifier_media_type = MediaType::from_specifier(&self.0.specifier);
if specifier_media_type != MediaType::Unknown {
return specifier_media_type;
}
@ -1102,7 +1102,7 @@ impl Documents {
}
if specifier.starts_with("asset:") {
if let Ok(specifier) = ModuleSpecifier::parse(&specifier) {
let media_type = MediaType::from(&specifier);
let media_type = MediaType::from_specifier(&specifier);
results.push(Some((specifier, media_type)));
} else {
results.push(None);
@ -1487,9 +1487,8 @@ fn analyze_module(
parsed_source,
Some(resolver),
)),
Err(err) => Err(deno_graph::ModuleGraphError::ParseErr(
specifier.clone(),
err.clone(),
Err(err) => Err(deno_graph::ModuleGraphError::ModuleError(
deno_graph::ModuleError::ParseErr(specifier.clone(), err.clone()),
)),
}
}

View file

@ -638,7 +638,7 @@ impl Inner {
fn is_diagnosable(&self, specifier: &ModuleSpecifier) -> bool {
if specifier.scheme() == "asset" {
matches!(
MediaType::from(specifier),
MediaType::from_specifier(specifier),
MediaType::JavaScript
| MediaType::Jsx
| MediaType::Mjs

View file

@ -193,7 +193,7 @@ impl CliModuleLoader {
ModuleCodeSource {
code,
found_url: specifier.clone(),
media_type: MediaType::from(specifier),
media_type: MediaType::from_specifier(specifier),
}
} else {
self.load_prepared_module(specifier, maybe_referrer)?

View file

@ -49,7 +49,7 @@ pub fn esm_code_with_node_globals(
let parsed_source = deno_ast::parse_program(deno_ast::ParseParams {
specifier: specifier.to_string(),
text_info: text_info.clone(),
media_type: deno_ast::MediaType::from(specifier),
media_type: deno_ast::MediaType::from_specifier(specifier),
capture_tokens: true,
scope_analysis: true,
maybe_syntax: None,

View file

@ -73,7 +73,7 @@ impl NodeResolution {
) -> (ModuleSpecifier, MediaType) {
match resolution {
Some(NodeResolution::CommonJs(specifier)) => {
let media_type = MediaType::from(&specifier);
let media_type = MediaType::from_specifier(&specifier);
(
specifier,
match media_type {
@ -85,7 +85,7 @@ impl NodeResolution {
)
}
Some(NodeResolution::Esm(specifier)) => {
let media_type = MediaType::from(&specifier);
let media_type = MediaType::from_specifier(&specifier);
(
specifier,
match media_type {

View file

@ -149,6 +149,8 @@ fn tag_to_version_info<'a>(
// explicit version.
if tag == "latest" && info.name == "@types/node" {
return get_resolved_package_version_and_info(
// WARNING: When bumping this version, check if anything needs to be
// updated in the `setNodeOnlyGlobalNames` call in 99_main_compiler.js
&VersionReq::parse_from_npm("18.0.0 - 18.11.18").unwrap(),
info,
parent,

View file

@ -723,7 +723,7 @@ fn lsp_hover_asset() {
"textDocument": {
"uri": "deno:/asset/lib.es2015.symbol.wellknown.d.ts"
},
"position": { "line": 109, "character": 13 }
"position": { "line": 111, "character": 13 }
}),
);
assert_eq!(
@ -737,8 +737,8 @@ fn lsp_hover_asset() {
"Enables basic storage and retrieval of dates and times."
],
"range": {
"start": { "line": 109, "character": 10, },
"end": { "line": 109, "character": 14, }
"start": { "line": 111, "character": 10, },
"end": { "line": 111, "character": 14, }
}
})
);
@ -3673,23 +3673,6 @@ export class DuckConfig {
}]
}]
}
}, {
"title": "Add all missing imports",
"kind": "quickfix",
"diagnostics": [{
"range": {
"start": { "line": 0, "character": 50 },
"end": { "line": 0, "character": 67 }
},
"severity": 1,
"code": 2304,
"source": "deno-ts",
"message": "Cannot find name 'DuckConfigOptions'."
}],
"data": {
"specifier": "file:///a/file00.ts",
"fixId": "fixMissingImport"
}
}, {
"title": "Add import from \"./file01.ts\"",
"kind": "quickfix",
@ -3718,6 +3701,23 @@ export class DuckConfig {
}]
}]
}
}, {
"title": "Add all missing imports",
"kind": "quickfix",
"diagnostics": [{
"range": {
"start": { "line": 0, "character": 50 },
"end": { "line": 0, "character": 67 }
},
"severity": 1,
"code": 2304,
"source": "deno-ts",
"message": "Cannot find name 'DuckConfigOptions'."
}],
"data": {
"specifier": "file:///a/file00.ts",
"fixId": "fixMissingImport"
}
}])
);
let res = client.write_request(
@ -3830,6 +3830,19 @@ fn lsp_code_actions_refactor() {
assert_eq!(
res,
json!([{
"title": "Move to a new file",
"kind": "refactor.move.newFile",
"isPreferred": false,
"data": {
"specifier": "file:///a/file.ts",
"range": {
"start": { "line": 0, "character": 0 },
"end": { "line": 1, "character": 0 }
},
"refactorName": "Move to a new file",
"actionName": "Move to a new file"
}
}, {
"title": "Extract to function in module scope",
"kind": "refactor.extract.function",
"isPreferred": false,
@ -3855,19 +3868,6 @@ fn lsp_code_actions_refactor() {
"refactorName": "Extract Symbol",
"actionName": "constant_scope_0"
}
}, {
"title": "Move to a new file",
"kind": "refactor.move.newFile",
"isPreferred": false,
"data": {
"specifier": "file:///a/file.ts",
"range": {
"start": { "line": 0, "character": 0 },
"end": { "line": 1, "character": 0 }
},
"refactorName": "Move to a new file",
"actionName": "Move to a new file"
}
}, {
"title": "Convert default export to named export",
"kind": "refactor.rewrite.export.named",
@ -4047,19 +4047,6 @@ fn lsp_code_actions_refactor_no_disabled_support() {
assert_eq!(
res,
json!([{
"title": "Extract to function in module scope",
"kind": "refactor.extract.function",
"isPreferred": false,
"data": {
"specifier": "file:///a/file.ts",
"range": {
"start": { "line": 0, "character": 0 },
"end": { "line": 14, "character": 0 }
},
"refactorName": "Extract Symbol",
"actionName": "function_scope_0"
}
}, {
"title": "Move to a new file",
"kind": "refactor.move.newFile",
"isPreferred": false,
@ -4072,6 +4059,19 @@ fn lsp_code_actions_refactor_no_disabled_support() {
"refactorName": "Move to a new file",
"actionName": "Move to a new file"
}
}, {
"title": "Extract to function in module scope",
"kind": "refactor.extract.function",
"isPreferred": false,
"data": {
"specifier": "file:///a/file.ts",
"range": {
"start": { "line": 0, "character": 0 },
"end": { "line": 14, "character": 0 }
},
"refactorName": "Extract Symbol",
"actionName": "function_scope_0"
}
}])
);
client.shutdown();
@ -4394,6 +4394,7 @@ fn lsp_completions_auto_import() {
panic!("completions items missing 'foo' symbol");
}
// the request here is one of the items in `list`
let res = client.write_request(
"completionItem/resolve",
json!({
@ -4411,10 +4412,11 @@ fn lsp_completions_auto_import() {
"specifier": "file:///a/file.ts",
"position": 12,
"name": "foo",
"source": "./b",
"source": "./b.ts",
"data": {
"exportName": "foo",
"moduleSpecifier": "./b",
"exportMapKey": "foo|6843|file:///a/b",
"moduleSpecifier": "./b.ts",
"fileName": "file:///a/b.ts"
},
"useCodeSnippet": false
@ -6357,53 +6359,68 @@ fn lsp_workspace_symbol() {
);
assert_eq!(
res,
json!([
{
"name": "fieldA",
"kind": 8,
"location": {
"uri": "file:///a/file.ts",
"range": {
"start": { "line": 1, "character": 2 },
"end": { "line": 1, "character": 17 }
}
json!([{
"name": "fieldA",
"kind": 8,
"location": {
"uri": "file:///a/file.ts",
"range": {
"start": { "line": 1, "character": 2 },
"end": { "line": 1, "character": 17 }
}
},
"containerName": "A"
}, {
"name": "fieldB",
"kind": 8,
"location": {
"uri": "file:///a/file.ts",
"range": {
"start": { "line": 2, "character": 2 },
"end": { "line": 2, "character": 17 }
}
},
"containerName": "A"
}, {
"name": "fieldC",
"kind": 8,
"location": {
"uri": "file:///a/file_01.ts",
"range": {
"start": { "line": 1, "character": 2 },
"end": { "line": 1, "character": 17 }
}
},
"containerName": "B"
}, {
"name": "fieldD",
"kind": 8,
"location": {
"uri": "file:///a/file_01.ts",
"range": {
"start": { "line": 2, "character": 2 },
"end": { "line": 2, "character": 17 }
}
},
"containerName": "B"
}, {
"name": "ClassFieldDecoratorContext",
"kind": 11,
"location": {
"uri": "deno:/asset/lib.decorators.d.ts",
"range": {
"start": {
"line": 331,
"character": 0,
},
"end": {
"line": 371,
"character": 1,
},
},
"containerName": "A"
}, {
"name": "fieldB",
"kind": 8,
"location": {
"uri": "file:///a/file.ts",
"range": {
"start": { "line": 2, "character": 2 },
"end": { "line": 2, "character": 17 }
}
},
"containerName": "A"
}, {
"name": "fieldC",
"kind": 8,
"location": {
"uri": "file:///a/file_01.ts",
"range": {
"start": { "line": 1, "character": 2 },
"end": { "line": 1, "character": 17 }
}
},
"containerName": "B"
}, {
"name": "fieldD",
"kind": 8,
"location": {
"uri": "file:///a/file_01.ts",
"range": {
"start": { "line": 2, "character": 2 },
"end": { "line": 2, "character": 17 }
}
},
"containerName": "B"
}
])
},
"containerName": "",
}])
);
client.shutdown();
}

View file

@ -675,7 +675,7 @@ Deno.test({ permissions: { read: true } }, async function seekMode() {
const file = await Deno.open(filename);
await assertRejects(
async () => {
await file.seek(1, -1);
await file.seek(1, -1 as unknown as Deno.SeekMode);
},
TypeError,
"Invalid seek mode",

View file

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

View file

@ -264,8 +264,7 @@ fn get_tsc_roots(
}
}
// todo(https://github.com/denoland/deno_graph/pull/253/): pre-allocate this
let mut result = Vec::new();
let mut result = Vec::with_capacity(graph.specifiers_count());
if graph.has_node_specifier {
// inject a specifier that will resolve node types
result.push((
@ -313,6 +312,7 @@ fn get_tsc_roots(
maybe_get_check_entry(module, check_js)
}
}));
result
}

View file

@ -15,6 +15,7 @@ use deno_graph::npm::NpmPackageNvReference;
use deno_graph::npm::NpmPackageReqReference;
use deno_graph::Dependency;
use deno_graph::Module;
use deno_graph::ModuleError;
use deno_graph::ModuleGraph;
use deno_graph::ModuleGraphError;
use deno_graph::Resolution;
@ -477,7 +478,8 @@ impl<'a> GraphDisplayContext<'a> {
Ok(())
}
Err(err) => {
if let ModuleGraphError::Missing(_, _) = *err {
if let ModuleGraphError::ModuleError(ModuleError::Missing(_, _)) = *err
{
writeln!(
writer,
"{} module could not be found",
@ -621,28 +623,29 @@ impl<'a> GraphDisplayContext<'a> {
) -> TreeNode {
self.seen.insert(specifier.to_string());
match err {
ModuleGraphError::InvalidTypeAssertion { .. } => {
self.build_error_msg(specifier, "(invalid import assertion)")
}
ModuleGraphError::LoadingErr(_, _, _) => {
self.build_error_msg(specifier, "(loading error)")
}
ModuleGraphError::ParseErr(_, _) => {
self.build_error_msg(specifier, "(parsing error)")
}
ModuleGraphError::ModuleError(err) => match err {
ModuleError::InvalidTypeAssertion { .. } => {
self.build_error_msg(specifier, "(invalid import assertion)")
}
ModuleError::LoadingErr(_, _, _) => {
self.build_error_msg(specifier, "(loading error)")
}
ModuleError::ParseErr(_, _) => {
self.build_error_msg(specifier, "(parsing error)")
}
ModuleError::UnsupportedImportAssertionType { .. } => {
self.build_error_msg(specifier, "(unsupported import assertion)")
}
ModuleError::UnsupportedMediaType { .. } => {
self.build_error_msg(specifier, "(unsupported)")
}
ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => {
self.build_error_msg(specifier, "(missing)")
}
},
ModuleGraphError::ResolutionError(_) => {
self.build_error_msg(specifier, "(resolution error)")
}
ModuleGraphError::UnsupportedImportAssertionType { .. } => {
self.build_error_msg(specifier, "(unsupported import assertion)")
}
ModuleGraphError::UnsupportedMediaType { .. } => {
self.build_error_msg(specifier, "(unsupported)")
}
ModuleGraphError::Missing(_, _)
| ModuleGraphError::MissingDynamic(_, _) => {
self.build_error_msg(specifier, "(missing)")
}
}
}

View file

@ -35,6 +35,7 @@ use serde::Serialize;
use std::fs;
use std::io::stdin;
use std::io::Read;
use std::path::Path;
use std::path::PathBuf;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
@ -245,12 +246,12 @@ pub fn create_linter(
}
fn lint_file(
file_path: &PathBuf,
file_path: &Path,
source_code: String,
lint_rules: Vec<&'static dyn LintRule>,
) -> Result<(Vec<LintDiagnostic>, String), AnyError> {
let file_name = file_path.to_string_lossy().to_string();
let media_type = MediaType::from(file_path);
let media_type = MediaType::from_path(file_path);
let linter = create_linter(media_type, lint_rules);

View file

@ -16,6 +16,7 @@ use crate::util::file_watcher::ResolutionResult;
use crate::util::fs::collect_specifiers;
use crate::util::path::get_extension;
use crate::util::path::is_supported_ext;
use crate::util::path::mapped_specifier_for_tsc;
use crate::worker::create_main_worker_for_test_or_bench;
use deno_ast::swc::common::comments::CommentKind;
@ -740,7 +741,6 @@ async fn test_specifier(
}
fn extract_files_from_regex_blocks(
current_dir: &Path,
specifier: &ModuleSpecifier,
source: &str,
media_type: MediaType,
@ -800,17 +800,17 @@ fn extract_files_from_regex_blocks(
writeln!(file_source, "{}", text.as_str()).unwrap();
}
let file_specifier = deno_core::resolve_url_or_path(
&format!(
"{}${}-{}{}",
specifier,
file_line_index + line_offset + 1,
file_line_index + line_offset + line_count + 1,
file_media_type.as_ts_extension(),
),
current_dir,
)
let file_specifier = ModuleSpecifier::parse(&format!(
"{}${}-{}",
specifier,
file_line_index + line_offset + 1,
file_line_index + line_offset + line_count + 1,
))
.unwrap();
let file_specifier =
mapped_specifier_for_tsc(&file_specifier, file_media_type)
.map(|s| ModuleSpecifier::parse(&s).unwrap())
.unwrap_or(file_specifier);
Some(File {
local: file_specifier.to_file_path().unwrap(),
@ -827,7 +827,6 @@ fn extract_files_from_regex_blocks(
}
fn extract_files_from_source_comments(
current_dir: &Path,
specifier: &ModuleSpecifier,
source: Arc<str>,
media_type: MediaType,
@ -855,7 +854,6 @@ fn extract_files_from_source_comments(
})
.flat_map(|comment| {
extract_files_from_regex_blocks(
current_dir,
specifier,
&comment.text,
media_type,
@ -871,7 +869,6 @@ fn extract_files_from_source_comments(
}
fn extract_files_from_fenced_blocks(
current_dir: &Path,
specifier: &ModuleSpecifier,
source: &str,
media_type: MediaType,
@ -885,7 +882,6 @@ fn extract_files_from_fenced_blocks(
let lines_regex = Regex::new(r"(?:\# ?)?(.*)")?;
extract_files_from_regex_blocks(
current_dir,
specifier,
source,
media_type,
@ -906,14 +902,12 @@ async fn fetch_inline_files(
let inline_files = if file.media_type == MediaType::Unknown {
extract_files_from_fenced_blocks(
ps.options.initial_cwd(),
&file.specifier,
&file.source,
file.media_type,
)
} else {
extract_files_from_source_comments(
ps.options.initial_cwd(),
&file.specifier,
file.source,
file.media_type,

View file

@ -200,7 +200,7 @@ fn path_with_extension(path: &Path, new_ext: &str) -> PathBuf {
// maintain casing
return path.to_path_buf();
}
let media_type: MediaType = path.into();
let media_type = MediaType::from_path(path);
if media_type == MediaType::Unknown {
return path.with_file_name(format!(
"{}.{}",

338548
cli/tsc/00_typescript.js vendored

File diff suppressed because one or more lines are too long

View file

@ -135,7 +135,7 @@ delete Object.prototype.__proto__;
// We need to use a custom document registry in order to provide source files
// with an impliedNodeFormat to the ts language service
/** @type {Map<string, ts.SourceFile} */
/** @type {Map<string, ts.SourceFile>} */
const documentRegistrySourceFileCache = new Map();
const { getKeyForCompilationSettings } = ts.createDocumentRegistry(); // reuse this code
/** @type {ts.DocumentRegistry} */
@ -362,9 +362,6 @@ delete Object.prototype.__proto__;
// TS2688: Cannot find type definition file for '...'.
// We ignore because type defintion files can end with '.ts'.
2688,
// TS2691: An import path cannot end with a '.ts' extension. Consider
// importing 'bad-module' instead.
2691,
// TS2792: Cannot find module. Did you mean to set the 'moduleResolution'
// option to 'node', or to add aliases to the 'paths' option?
2792,
@ -866,7 +863,10 @@ delete Object.prototype.__proto__;
case "configure": {
const { options, errors } = ts
.convertCompilerOptionsFromJson(request.compilerOptions, "");
Object.assign(options, { allowNonTsExtensions: true });
Object.assign(options, {
allowNonTsExtensions: true,
allowImportingTsExtensions: true,
});
if (errors.length) {
debug(ts.formatDiagnostics(errors, host));
}
@ -1213,6 +1213,46 @@ delete Object.prototype.__proto__;
ts.deno.setNodeBuiltInModuleNames(nodeBuiltInModuleNames);
// list of globals that should be kept in Node's globalThis
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",
"require",
"module",
"exports",
"gc",
"BufferEncoding",
"BufferConstructor",
"WithImplicitCoercion",
"Buffer",
"Console",
"ImportMeta",
"setTimeout",
"setInterval",
"setImmediate",
"Global",
"AbortController",
"AbortSignal",
"Blob",
"BroadcastChannel",
"MessageChannel",
"MessagePort",
"Event",
"EventTarget",
"performance",
"TextDecoder",
"TextEncoder",
"URL",
"URLSearchParams",
]);
for (const lib of libs) {
const specifier = `lib.${lib}.d.ts`;
// we are using internal APIs here to "inject" our custom libraries into

View file

@ -30,7 +30,8 @@ declare global {
function setIsNodeSourceFileCallback(
callback: (sourceFile: SourceFile) => boolean,
);
function setNodeBuiltInModuleNames(names: string[]);
function setNodeBuiltInModuleNames(names: readonly string[]);
function setNodeOnlyGlobalNames(names: readonly string[]);
}
}

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es5" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

372
cli/tsc/dts/lib.decorators.d.ts vendored Normal file
View file

@ -0,0 +1,372 @@
/*! *****************************************************************************
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"/>
/**
* The decorator context types provided to class element decorators.
*/
type ClassMemberDecoratorContext =
| ClassMethodDecoratorContext
| ClassGetterDecoratorContext
| ClassSetterDecoratorContext
| ClassFieldDecoratorContext
| ClassAccessorDecoratorContext
;
/**
* The decorator context types provided to any decorator.
*/
type DecoratorContext =
| ClassDecoratorContext
| ClassMemberDecoratorContext
;
/**
* Context provided to a class decorator.
* @template Class The type of the decorated class associated with this context.
*/
interface ClassDecoratorContext<
Class extends abstract new (...args: any) => any = abstract new (...args: any) => any,
> {
/** The kind of element that was decorated. */
readonly kind: "class";
/** The name of the decorated class. */
readonly name: string | undefined;
/**
* Adds a callback to be invoked after the class definition has been finalized.
*
* @example
* ```ts
* function customElement(name: string): ClassDecoratorFunction {
* return (target, context) => {
* context.addInitializer(function () {
* customElements.define(name, this);
* });
* }
* }
*
* @customElement("my-element")
* class MyElement {}
* ```
*/
addInitializer(initializer: (this: Class) => void): void;
}
/**
* Context provided to a class method decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of the decorated class method.
*/
interface ClassMethodDecoratorContext<
This = unknown,
Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
> {
/** The kind of class element that was decorated. */
readonly kind: "method";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Gets the current value of the method from the provided object.
*
* @example
* let fn = context.access.get(instance);
*/
get(object: This): Value;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*
* @example
* ```ts
* const bound: ClassMethodDecoratorFunction = (value, context) {
* if (context.private) throw new TypeError("Not supported on private methods.");
* context.addInitializer(function () {
* this[context.name] = this[context.name].bind(this);
* });
* }
*
* class C {
* message = "Hello";
*
* @bound
* m() {
* console.log(this.message);
* }
* }
* ```
*/
addInitializer(initializer: (this: This) => void): void;
}
/**
* Context provided to a class getter decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The property type of the decorated class getter.
*/
interface ClassGetterDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "getter";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Invokes the getter on the provided object.
*
* @example
* let value = context.access.get(instance);
*/
get(object: This): Value;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
/**
* Context provided to a class setter decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of the decorated class setter.
*/
interface ClassSetterDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "setter";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Invokes the setter on the provided object.
*
* @example
* context.access.set(instance, value);
*/
set(object: This, value: Value): void;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
/**
* Context provided to a class `accessor` field decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of decorated class field.
*/
interface ClassAccessorDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "accessor";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Invokes the getter on the provided object.
*
* @example
* let value = context.access.get(instance);
*/
get(object: This): Value;
/**
* Invokes the setter on the provided object.
*
* @example
* context.access.set(instance, value);
*/
set(object: This, value: Value): void;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}
/**
* Describes the target provided to class `accessor` field decorators.
* @template This The `this` type to which the target applies.
* @template Value The property type for the class `accessor` field.
*/
interface ClassAccessorDecoratorTarget<This, Value> {
/**
* Invokes the getter that was defined prior to decorator application.
*
* @example
* let value = target.get.call(instance);
*/
get(this: This): Value;
/**
* Invokes the setter that was defined prior to decorator application.
*
* @example
* target.set.call(instance, value);
*/
set(this: This, value: Value): void;
}
/**
* Describes the allowed return value from a class `accessor` field decorator.
* @template This The `this` type to which the target applies.
* @template Value The property type for the class `accessor` field.
*/
interface ClassAccessorDecoratorResult<This, Value> {
/**
* An optional replacement getter function. If not provided, the existing getter function is used instead.
*/
get?(this: This): Value;
/**
* An optional replacement setter function. If not provided, the existing setter function is used instead.
*/
set?(this: This, value: Value): void;
/**
* An optional initializer mutator that is invoked when the underlying field initializer is evaluated.
* @param value The incoming initializer value.
* @returns The replacement initializer value.
*/
init?(this: This, value: Value): Value;
}
/**
* Context provided to a class field decorator.
* @template This The type on which the class element will be defined. For a static class element, this will be
* the type of the constructor. For a non-static class element, this will be the type of the instance.
* @template Value The type of the decorated class field.
*/
interface ClassFieldDecoratorContext<
This = unknown,
Value = unknown,
> {
/** The kind of class element that was decorated. */
readonly kind: "field";
/** The name of the decorated class element. */
readonly name: string | symbol;
/** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */
readonly static: boolean;
/** A value indicating whether the class element has a private name. */
readonly private: boolean;
/** An object that can be used to access the current value of the class element at runtime. */
readonly access: {
/**
* Determines whether an object has a property with the same name as the decorated element.
*/
has(object: This): boolean;
/**
* Gets the value of the field on the provided object.
*/
get(object: This): Value;
/**
* Sets the value of the field on the provided object.
*/
set(object: This, value: Value): void;
};
/**
* Adds a callback to be invoked either before static initializers are run (when
* decorating a `static` element), or before instance initializers are run (when
* decorating a non-`static` element).
*/
addInitializer(initializer: (this: This) => void): void;
}

22
cli/tsc/dts/lib.decorators.legacy.d.ts vendored Normal file
View file

@ -0,0 +1,22 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;

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

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// Window Iterable APIs
/////////////////////////////
@ -34,6 +32,10 @@ interface BaseAudioContext {
createPeriodicWave(real: Iterable<number>, imag: Iterable<number>, constraints?: PeriodicWaveConstraints): PeriodicWave;
}
interface CSSKeyframesRule {
[Symbol.iterator](): IterableIterator<CSSKeyframeRule>;
}
interface CSSRuleList {
[Symbol.iterator](): IterableIterator<CSSRule>;
}
@ -137,6 +139,16 @@ interface IDBObjectStore {
createIndex(name: string, keyPath: string | Iterable<string>, options?: IDBIndexParameters): IDBIndex;
}
interface MIDIInputMap extends ReadonlyMap<string, MIDIInput> {
}
interface MIDIOutput {
send(data: Iterable<number>, timestamp?: DOMHighResTimeStamp): void;
}
interface MIDIOutputMap extends ReadonlyMap<string, MIDIOutput> {
}
interface MediaKeyStatusMap {
[Symbol.iterator](): IterableIterator<[BufferSource, MediaKeyStatus]>;
entries(): IterableIterator<[BufferSource, MediaKeyStatus]>;

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Map<K, V> {
clear(): void;

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -28,7 +26,7 @@ interface Array<T> {
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
find<S extends T>(predicate: (value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
/**
@ -349,7 +347,7 @@ interface ReadonlyArray<T> {
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (this: void, value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
find<S extends T>(predicate: (value: T, index: number, obj: readonly T[]) => value is S, thisArg?: any): S | undefined;
find(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): T | undefined;
/**

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es5" />
/// <reference lib="es2015.core" />
/// <reference lib="es2015.collection" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
interface SymbolConstructor {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface PromiseConstructor {
/**
* A reference to the prototype.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ProxyHandler<T extends object> {
/**
* A trap method for a function call.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Reflect {
/**
* Calls the function with the specified object as the this value

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface SymbolConstructor {
/**
* A reference to the prototype.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
interface SymbolConstructor {
@ -76,7 +74,7 @@ interface SymbolConstructor {
readonly toStringTag: unique symbol;
/**
* An Object whose own property names are property names that are excluded from the 'with'
* An Object whose truthy properties are properties that are excluded from the 'with'
* environment bindings of the associated objects.
*/
readonly unscopables: unique symbol;
@ -93,17 +91,21 @@ interface Symbol {
interface Array<T> {
/**
* Returns an object whose properties have the value 'true'
* Is an object whose properties have the value 'true'
* when they will be absent when used in a 'with' statement.
*/
[Symbol.unscopables](): {
copyWithin: boolean;
entries: boolean;
fill: boolean;
find: boolean;
findIndex: boolean;
keys: boolean;
values: boolean;
readonly [Symbol.unscopables]: {
[K in keyof any[]]?: boolean;
};
}
interface ReadonlyArray<T> {
/**
* Is an object whose properties have the value 'true'
* when they will be absent when used in a 'with' statement.
*/
readonly [Symbol.unscopables]: {
[K in keyof readonly any[]]?: boolean;
};
}

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.

View file

@ -14,9 +14,7 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015" />
/// <reference lib="es2016.array.include" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2016" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2016" />
/// <reference lib="es2017.object" />
/// <reference lib="es2017.sharedmemory" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2017" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ObjectConstructor {
/**
* Returns an array of values of the enumerable properties of an object

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.symbol.wellknown" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/**
* Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Int8ArrayConstructor {
new (): Int8Array;
}

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018.asynciterable" />
interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown> extends AsyncIterator<T, TReturn, TNext> {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.iterable" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2017" />
/// <reference lib="es2018.asynciterable" />
/// <reference lib="es2018.asyncgenerator" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
// http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/**
* Represents the completion of an asynchronous operation
*/

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface RegExpMatchArray {
groups?: {
[key: string]: string

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
type FlatArray<Arr, Depth extends number> = {
"done": Arr,
"recur": Arr extends ReadonlyArray<infer InnerArr>

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018" />
/// <reference lib="es2019.array" />
/// <reference lib="es2019.object" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2019" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
unknown: any

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
interface ObjectConstructor {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/** Removes the trailing white space and line terminator characters from a string. */
trimEnd(): string;

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Symbol {
/**
* Expose the [[Description]] internal slot of a symbol directly.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020.intl" />
interface BigIntToLocaleStringOptions {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2019" />
/// <reference lib="es2020.bigint" />
/// <reference lib="es2020.date" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020.intl" />
interface Date {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2018.intl" />
declare namespace Intl {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020.intl" />
interface Number {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface PromiseFulfilledResult<T> {
status: "fulfilled";
value: T;

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Atomics {
/**
* Adds a value to the value at the given position in the array, returning the original value.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
interface String {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
/// <reference lib="es2015.symbol" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2020" />
/// <reference lib="es2021.promise" />
/// <reference lib="es2021.string" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2021" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface DateTimeFormatPartTypesRegistry {
@ -85,6 +83,12 @@ declare namespace Intl {
style?: ListFormatStyle | undefined;
}
interface ResolvedListFormatOptions {
locale: string;
style: ListFormatStyle;
type: ListFormatType;
}
interface ListFormat {
/**
* Returns a string with a language-specific representation of the list.
@ -111,6 +115,15 @@ declare namespace Intl {
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/formatToParts).
*/
formatToParts(list: Iterable<string>): { type: "element" | "literal", value: string; }[];
/**
* Returns a new object with properties reflecting the locale and style
* formatting options computed during the construction of the current
* `Intl.ListFormat` object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/resolvedOptions).
*/
resolvedOptions(): ResolvedListFormatOptions;
}
const ListFormat: {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface AggregateError extends Error {
errors: any[]
}

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/**
* Replace all instances of a substring in a string, using a regular expression or search string.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface WeakRef<T extends object> {
readonly [Symbol.toStringTag]: "WeakRef";

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Returns the item located at the specified index.

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2021" />
/// <reference lib="es2022.array" />
/// <reference lib="es2022.error" />
@ -25,3 +23,4 @@ and limitations under the License.
/// <reference lib="es2022.object" />
/// <reference lib="es2022.sharedmemory" />
/// <reference lib="es2022.string" />
/// <reference lib="es2022.regexp" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ErrorOptions {
cause?: unknown;
}

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2022" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
/**

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ObjectConstructor {
/**
* Determines whether an object has a property with the specified name.

39
cli/tsc/dts/lib.es2022.regexp.d.ts vendored Normal file
View file

@ -0,0 +1,39 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface RegExpMatchArray {
indices?: RegExpIndicesArray;
}
interface RegExpExecArray {
indices?: RegExpIndicesArray;
}
interface RegExpIndicesArray extends Array<[number, number]> {
groups?: {
[key: string]: [number, number];
};
}
interface RegExp {
/**
* Returns a Boolean value indicating the state of the hasIndices flag (d) used with with a regular expression.
* Default is false. Read-only.
*/
readonly hasIndices: boolean;
}

View file

@ -14,14 +14,26 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Atomics {
/**
* A non-blocking, asynchronous version of wait which is usable on the main thread.
* Waits asynchronously on a shared memory location and returns a Promise
* @param typedArray A shared Int32Array or BigInt64Array.
* @param index The position in the typedArray to wait on.
* @param value The expected value to test.
* @param [timeout] The expected value to test.
*/
waitAsync(typedArray: BigInt64Array | Int32Array, index: number, value: bigint, timeout?: number): { async: false, value: "ok" | "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "not-equal" | "timed-out"> };
waitAsync(typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false, value: "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "timed-out"> };
/**
* A non-blocking, asynchronous version of wait which is usable on the main thread.
* Waits asynchronously on a shared memory location and returns a Promise
* @param typedArray A shared Int32Array or BigInt64Array.
* @param index The position in the typedArray to wait on.
* @param value The expected value to test.
* @param [timeout] The expected value to test.
*/
waitAsync(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false, value: "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "timed-out"> };
}

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface String {
/**
* Returns a new String consisting of the single UTF-16 code unit located at the specified index.

342
cli/tsc/dts/lib.es2023.array.d.ts vendored Normal file
View file

@ -0,0 +1,342 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;
}
interface ReadonlyArray<T> {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): number;
}
interface Int8Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Int8Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number;
}
interface Uint8Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number;
}
interface Uint8ClampedArray {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Uint8ClampedArray) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number;
}
interface Int16Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Int16Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number;
}
interface Uint16Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Uint16Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number;
}
interface Int32Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Int32Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number;
}
interface Uint32Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Uint32Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number;
}
interface Float32Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Float32Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number;
}
interface Float64Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends number>(predicate: (value: number, index: number, array: Float64Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number;
}
interface BigInt64Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends bigint>(predicate: (value: bigint, index: number, array: BigInt64Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): bigint | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): number;
}
interface BigUint64Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate findLast calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found, findLast
* immediately returns that element value. Otherwise, findLast returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends bigint>(predicate: (value: bigint, index: number, array: BigUint64Array) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): bigint | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): number;
}

20
cli/tsc/dts/lib.es2023.d.ts vendored Normal file
View file

@ -0,0 +1,20 @@
/*! *****************************************************************************
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="es2022" />
/// <reference lib="es2023.array" />

23
cli/tsc/dts/lib.es2023.full.d.ts vendored Normal file
View file

@ -0,0 +1,23 @@
/*! *****************************************************************************
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="es2023" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />

View file

@ -14,9 +14,10 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="decorators" />
/// <reference lib="decorators.legacy" />
/////////////////////////////
/// ECMAScript APIs
@ -761,7 +762,7 @@ interface Date {
toLocaleTimeString(): string;
/** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */
valueOf(): number;
/** Gets the time value in milliseconds. */
/** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */
getTime(): number;
/** Gets the year, using local time. */
getFullYear(): number;
@ -1503,11 +1504,6 @@ interface TypedPropertyDescriptor<T> {
set?: (value: T) => void;
}
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
declare type PromiseConstructorLike = new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) => PromiseLike<T>;
interface PromiseLike<T> {

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015" />
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />

View file

@ -16,29 +16,6 @@ and limitations under the License.
/// <reference no-default-lib="true"/>
interface Array<T> {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): T[];
@ -78,29 +55,6 @@ interface Array<T> {
}
interface ReadonlyArray<T> {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): T[];
@ -140,28 +94,6 @@ interface ReadonlyArray<T> {
}
interface Int8Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Int8Array;
@ -180,28 +112,6 @@ interface Int8Array {
}
interface Uint8Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLastIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Uint8Array;
@ -220,28 +130,6 @@ interface Uint8Array {
}
interface Uint8ClampedArray {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Uint8ClampedArray;
@ -261,29 +149,6 @@ interface Uint8ClampedArray {
interface Int16Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Int16Array;
@ -302,29 +167,6 @@ interface Int16Array {
}
interface Uint16Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Uint16Array;
@ -343,28 +185,6 @@ interface Uint16Array {
}
interface Int32Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Int32Array;
@ -383,28 +203,6 @@ interface Int32Array {
}
interface Uint32Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Uint32Array;
@ -423,28 +221,6 @@ interface Uint32Array {
}
interface Float32Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Float32Array;
@ -463,28 +239,6 @@ interface Float32Array {
}
interface Float64Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number;
/** Copies and reverses the elements in an array.*/
toReversed(): Float64Array;
@ -503,28 +257,6 @@ interface Float64Array {
}
interface BigInt64Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: bigint, index: number, obj: BigInt64Array) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: bigint, index: number, obj: BigInt64Array) => boolean, thisArg?: any): bigint;
/** Copies and reverses the elements in an array.*/
toReversed(): BigInt64Array;
@ -543,28 +275,6 @@ interface BigInt64Array {
}
interface BigUint64Array {
/**
* Returns the value of the last element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* 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.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findLast(predicate: (value: bigint, index: number, obj: BigUint64Array) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndexLast(predicate: (value: bigint, index: number, obj: BigUint64Array) => boolean, thisArg?: any): bigint;
/** Copies and reverses the elements in an array.*/
toReversed(): BigUint64Array;

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2022" />
/// <reference lib="es2023" />
/// <reference lib="esnext.array" />
/// <reference lib="esnext.intl" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="esnext" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

View file

@ -14,10 +14,8 @@ and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
interface NumberRangeFormatPart extends NumberFormatPart {
source: "startRange" | "endRange" | "shared"

Some files were not shown because too many files have changed in this diff Show more