Skip to content

Commit c2366ea

Browse files
authored
feat: update TypeScript to 6.0.3 (#32944)
Updates the TypeScript compiler and type definitions from 5.9.2 → 6.0.3 (via `denoland/TypeScript@branch_v6.0.3_patch`). Closes #32746 Closes #32295 Closes #32070
1 parent 0c69465 commit c2366ea

117 files changed

Lines changed: 37612 additions & 13061 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/build.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use deno_runtime::*;
88

99
fn compress_decls(out_dir: &Path) {
1010
let decls = [
11-
"lib.deno_webgpu.d.ts",
1211
"lib.deno.ns.d.ts",
1312
"lib.deno.unstable.d.ts",
1413
"lib.deno.window.d.ts",
@@ -21,6 +20,7 @@ fn compress_decls(out_dir: &Path) {
2120
"lib.deno_fetch.d.ts",
2221
"lib.deno_websocket.d.ts",
2322
"lib.deno_webstorage.d.ts",
23+
"lib.deno_webgpu.d.ts",
2424
"lib.deno_canvas.d.ts",
2525
"lib.deno_crypto.d.ts",
2626
"lib.deno_cache.d.ts",
@@ -92,6 +92,7 @@ fn compress_decls(out_dir: &Path) {
9292
"lib.es2022.intl.d.ts",
9393
"lib.es2022.object.d.ts",
9494
"lib.es2022.regexp.d.ts",
95+
"lib.es2022.sharedmemory.d.ts",
9596
"lib.es2022.string.d.ts",
9697
"lib.es2023.array.d.ts",
9798
"lib.es2023.collection.d.ts",
@@ -124,12 +125,13 @@ fn compress_decls(out_dir: &Path) {
124125
"lib.esnext.decorators.d.ts",
125126
"lib.esnext.disposable.d.ts",
126127
"lib.esnext.error.d.ts",
127-
"lib.esnext.float16.d.ts",
128128
"lib.esnext.full.d.ts",
129129
"lib.esnext.intl.d.ts",
130-
"lib.esnext.iterator.d.ts",
130+
"lib.esnext.object.d.ts",
131131
"lib.esnext.promise.d.ts",
132+
"lib.esnext.regexp.d.ts",
132133
"lib.esnext.sharedmemory.d.ts",
134+
"lib.esnext.string.d.ts",
133135
"lib.esnext.temporal.d.ts",
134136
"lib.esnext.typedarrays.d.ts",
135137
"lib.node.d.ts",
@@ -258,6 +260,17 @@ fn compress_sources(out_dir: &Path) {
258260
}
259261
}
260262

263+
fn emit_dts_rerun_if_changed() {
264+
let dts_dir = Path::new("tsc/dts");
265+
for entry in std::fs::read_dir(dts_dir).unwrap() {
266+
let entry = entry.unwrap();
267+
let path = entry.path();
268+
if path.extension().and_then(|s| s.to_str()) == Some("ts") {
269+
println!("cargo:rerun-if-changed={}", path.display());
270+
}
271+
}
272+
}
273+
261274
fn main() {
262275
// Skip building from docs.rs.
263276
if env::var_os("DOCS_RS").is_some() {
@@ -283,6 +296,11 @@ fn main() {
283296

284297
process_node_types(&out_dir);
285298

299+
// Always emit rerun-if-changed for dts files (they are included via
300+
// include_str! in debug mode). Without this, cargo may use stale
301+
// cached artifacts when dts files change.
302+
emit_dts_rerun_if_changed();
303+
286304
if !cfg!(debug_assertions) && std::env::var("CARGO_FEATURE_HMR").is_err() {
287305
compress_sources(&out_dir);
288306
}

cli/lib/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn otel_runtime_config() -> OtelRuntimeConfig {
1414
}
1515

1616
const GIT_COMMIT_HASH: &str = env!("GIT_COMMIT_HASH");
17-
const TYPESCRIPT: &str = "5.9.2";
17+
const TYPESCRIPT: &str = "6.0.3";
1818
pub const DENO_VERSION: &str = env!("DENO_VERSION");
1919
// TODO(bartlomieju): ideally we could remove this const.
2020
const IS_CANARY: bool = option_env!("DENO_CANARY").is_some();

cli/lsp/tsc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6567,6 +6567,8 @@ mod tests {
65676567
json!(diagnostics),
65686568
json!([
65696569
{
6570+
"category": 1,
6571+
"code": 2339,
65706572
"start": {
65716573
"line": 2,
65726574
"character": 16,
@@ -6575,11 +6577,9 @@ mod tests {
65756577
"line": 2,
65766578
"character": 17
65776579
},
6578-
"fileName": specifier,
6579-
"messageText": "Property \'a\' does not exist on type \'typeof import(\"https://deno.land/x/example/a\")\'.",
6580+
"messageText": "Property \'a\' does not exist on type \'typeof import(\"https://deno.land/x/example/a\", { with: { \"resolution-mode\": \"import\" } })\'.",
65806581
"sourceLine": " if (a.a === \"b\") {",
6581-
"code": 2339,
6582-
"category": 1,
6582+
"fileName": specifier,
65836583
}
65846584
]),
65856585
);

cli/snapshot/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Copyright 2018-2026 the Deno authors. MIT license.
22

3-
pub static TS_VERSION: &str = "5.9.2";
3+
pub static TS_VERSION: &str = "6.0.3";

cli/tsc/00_typescript.js

Lines changed: 17524 additions & 2003 deletions
Large diffs are not rendered by default.

cli/tsc/dts/lib.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ License at http://www.apache.org/licenses/LICENSE-2.0
77
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
88
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
99
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10-
MERCHANTABLITY OR NON-INFRINGEMENT.
10+
MERCHANTABILITY OR NON-INFRINGEMENT.
1111
1212
See the Apache Version 2.0 License for specific language governing permissions
1313
and limitations under the License.
1414
***************************************************************************** */
1515

1616

17-
/// <reference no-default-lib="true"/>
18-
1917
/// <reference lib="es5" />
2018
/// <reference lib="dom" />
2119
/// <reference lib="webworker.importscripts" />

cli/tsc/dts/lib.decorators.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ License at http://www.apache.org/licenses/LICENSE-2.0
77
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
88
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
99
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10-
MERCHANTABLITY OR NON-INFRINGEMENT.
10+
MERCHANTABILITY OR NON-INFRINGEMENT.
1111
1212
See the Apache Version 2.0 License for specific language governing permissions
1313
and limitations under the License.
1414
***************************************************************************** */
1515

1616

17-
/// <reference no-default-lib="true"/>
18-
1917
/**
2018
* The decorator context types provided to class element decorators.
2119
*/

cli/tsc/dts/lib.decorators.legacy.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ License at http://www.apache.org/licenses/LICENSE-2.0
77
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
88
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
99
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10-
MERCHANTABLITY OR NON-INFRINGEMENT.
10+
MERCHANTABILITY OR NON-INFRINGEMENT.
1111
1212
See the Apache Version 2.0 License for specific language governing permissions
1313
and limitations under the License.
1414
***************************************************************************** */
1515

1616

17-
/// <reference no-default-lib="true"/>
18-
1917
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
2018
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
2119
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;

cli/tsc/dts/lib.deno_webgpu.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ declare class GPUSupportedLimits {
2323
readonly maxTextureArrayLayers: number;
2424
readonly maxBindGroups: number;
2525
// TODO(@crowlKats): support max_bind_groups_plus_vertex_buffers
26-
readonly maxBindGroupsPlusVertexBuffers?: number;
26+
readonly maxBindGroupsPlusVertexBuffers: number;
2727
readonly maxBindingsPerBindGroup: number;
2828
readonly maxDynamicUniformBuffersPerPipelineLayout: number;
2929
readonly maxDynamicStorageBuffersPerPipelineLayout: number;
@@ -41,7 +41,7 @@ declare class GPUSupportedLimits {
4141
readonly maxVertexAttributes: number;
4242
readonly maxVertexBufferArrayStride: number;
4343
// TODO(@crowlKats): support max_inter_stage_shader_variables
44-
readonly maxInterStageShaderVariables?: number;
44+
readonly maxInterStageShaderVariables: number;
4545
readonly maxColorAttachments: number;
4646
readonly maxColorAttachmentBytesPerSample: number;
4747
readonly maxComputeWorkgroupStorageSize: number;
@@ -698,7 +698,7 @@ type GPUStorageTextureAccess =
698698

699699
/** @category GPU */
700700
interface GPUStorageTextureBindingLayout {
701-
access: GPUStorageTextureAccess;
701+
access?: GPUStorageTextureAccess;
702702
format: GPUTextureFormat;
703703
viewDimension?: GPUTextureViewDimension;
704704
}

cli/tsc/dts/lib.dom.asynciterable.d.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,12 @@ License at http://www.apache.org/licenses/LICENSE-2.0
77
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
88
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
99
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10-
MERCHANTABLITY OR NON-INFRINGEMENT.
10+
MERCHANTABILITY OR NON-INFRINGEMENT.
1111
1212
See the Apache Version 2.0 License for specific language governing permissions
1313
and limitations under the License.
1414
***************************************************************************** */
1515

1616

17-
/// <reference no-default-lib="true"/>
18-
19-
/////////////////////////////
20-
/// Window Async Iterable APIs
21-
/////////////////////////////
22-
23-
interface FileSystemDirectoryHandleAsyncIterator<T> extends AsyncIteratorObject<T, BuiltinIteratorReturn, unknown> {
24-
[Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<T>;
25-
}
26-
27-
interface FileSystemDirectoryHandle {
28-
[Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>;
29-
entries(): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>;
30-
keys(): FileSystemDirectoryHandleAsyncIterator<string>;
31-
values(): FileSystemDirectoryHandleAsyncIterator<FileSystemHandle>;
32-
}
33-
34-
interface ReadableStreamAsyncIterator<T> extends AsyncIteratorObject<T, BuiltinIteratorReturn, unknown> {
35-
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
36-
}
37-
38-
interface ReadableStream<R = any> {
39-
[Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
40-
values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
41-
}
17+
// This file's contents are now included in the main types file.
18+
// The file has been left for backward compatibility.

0 commit comments

Comments
 (0)