Skip to content

build: update to TypeScript 5.9 beta #30740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ http_archive(
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")

rules_ts_dependencies(
# Obtained by: curl --silent https://registry.npmjs.org/typescript/5.8.3 | jq -r '.dist.integrity'
ts_integrity = "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
# Obtained by: curl --silent https://registry.npmjs.org/typescript/5.9.0-beta | jq -r '.dist.integrity'
ts_integrity = "sha512-p91qoTdwWKj9YEBYavmGiBn0DF4OBElzw4pW4oPbK4HeCfr/SDz9+yviVWshZXGvGvFCJ3AVQ+J7F1UZXc23QQ==",
ts_version_from = "//:package.json",
)

Expand Down Expand Up @@ -273,7 +273,7 @@ esbuild_register_toolchains(

git_repository(
name = "rules_angular",
commit = "88ddcf8cccbfef57f8cc3dda4881f18ec739428e",
commit = "8bf9ae3fa3017ec12877908533001daed9c6ce83",
remote = "https://github.com/devversion/rules_angular.git",
)

Expand Down
8 changes: 4 additions & 4 deletions goldens/public-api/angular_devkit/schematics/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export interface DirEntry {
// @public (undocumented)
export interface DryRunCreateEvent {
// (undocumented)
content: Buffer;
content: ArrayBufferLike;
// (undocumented)
kind: 'create';
// (undocumented)
Expand Down Expand Up @@ -334,7 +334,7 @@ export class DryRunSink extends HostSink {
// @public (undocumented)
export interface DryRunUpdateEvent {
// (undocumented)
content: Buffer;
content: ArrayBufferLike;
// (undocumented)
kind: 'update';
// (undocumented)
Expand Down Expand Up @@ -495,13 +495,13 @@ export class HostSink extends SimpleSinkBase {
// (undocumented)
_done(): Observable<void>;
// (undocumented)
protected _filesToCreate: Map<Path, Buffer<ArrayBufferLike>>;
protected _filesToCreate: Map<Path, ArrayBufferLike>;
// (undocumented)
protected _filesToDelete: Set<Path>;
// (undocumented)
protected _filesToRename: Set<[Path, Path]>;
// (undocumented)
protected _filesToUpdate: Map<Path, Buffer<ArrayBufferLike>>;
protected _filesToUpdate: Map<Path, ArrayBufferLike>;
// (undocumented)
protected _force: boolean;
// (undocumented)
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@
},
"homepage": "https://github.com/angular/angular-cli",
"devDependencies": {
"@angular/animations": "20.2.0-next.0",
"@angular/animations": "20.2.0-next.1",
"@angular/cdk": "20.1.0-rc.0",
"@angular/common": "20.2.0-next.0",
"@angular/compiler": "20.2.0-next.0",
"@angular/compiler-cli": "20.2.0-next.0",
"@angular/core": "20.2.0-next.0",
"@angular/forms": "20.2.0-next.0",
"@angular/localize": "20.2.0-next.0",
"@angular/common": "20.2.0-next.1",
"@angular/compiler": "20.2.0-next.1",
"@angular/compiler-cli": "20.2.0-next.1",
"@angular/core": "20.2.0-next.1",
"@angular/forms": "20.2.0-next.1",
"@angular/localize": "20.2.0-next.1",
"@angular/material": "20.1.0-rc.0",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#7cdb4cce7349f791492eee3ac1f84e2a0e243287",
"@angular/platform-browser": "20.2.0-next.0",
"@angular/platform-server": "20.2.0-next.0",
"@angular/router": "20.2.0-next.0",
"@angular/service-worker": "20.2.0-next.0",
"@angular/platform-browser": "20.2.0-next.1",
"@angular/platform-server": "20.2.0-next.1",
"@angular/router": "20.2.0-next.1",
"@angular/service-worker": "20.2.0-next.1",
"@bazel/bazelisk": "1.26.0",
"@bazel/buildifier": "8.2.1",
"@eslint/compat": "1.3.1",
Expand Down Expand Up @@ -140,7 +140,7 @@
"tar": "^7.0.0",
"ts-node": "^10.9.1",
"tslib": "2.8.1",
"typescript": "5.8.3",
"typescript": "5.9.0-beta",
"undici": "7.11.0",
"unenv": "^1.10.0",
"verdaccio": "6.1.5",
Expand Down Expand Up @@ -173,6 +173,6 @@
}
},
"resolutions": {
"typescript": "5.8.3"
"typescript": "5.9.0-beta"
}
}
2 changes: 1 addition & 1 deletion packages/angular/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"postcss": "^8.4.0",
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
"tslib": "^2.3.0",
"typescript": ">=5.8 <5.9",
"typescript": ">=5.8 <6.0",
"vitest": "^3.1.1"
},
"peerDependenciesMeta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
[
async () => {
// Add invalid block syntax
await harness.appendToFile('src/app/app.component.html', '@one');
await harness.appendToFile('src/app/app.component.html', '@if-one');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this test, because in the latest version Angular is a bit more permissive about parsing unsupported blocks.

},
async ({ logs }) => {
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@one'),
message: jasmine.stringContaining('@if-one'),
}),
);

Expand All @@ -165,42 +165,42 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
async ({ logs }) => {
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@one'),
message: jasmine.stringContaining('@if-one'),
}),
);

// Add more invalid block syntax
await harness.appendToFile('src/app/app.component.html', '@two');
await harness.appendToFile('src/app/app.component.html', '@if-two');
},
async ({ logs }) => {
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@one'),
message: jasmine.stringContaining('@if-one'),
}),
);
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@two'),
message: jasmine.stringContaining('@if-two'),
}),
);

// Add more invalid block syntax
await harness.appendToFile('src/app/app.component.html', '@three');
await harness.appendToFile('src/app/app.component.html', '@if-three');
},
async ({ logs }) => {
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@one'),
message: jasmine.stringContaining('@if-one'),
}),
);
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@two'),
message: jasmine.stringContaining('@if-two'),
}),
);
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@three'),
message: jasmine.stringContaining('@if-three'),
}),
);

Expand All @@ -211,17 +211,17 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
({ logs }) => {
expect(logs).not.toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@one'),
message: jasmine.stringContaining('@if-one'),
}),
);
expect(logs).not.toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@two'),
message: jasmine.stringContaining('@if-two'),
}),
);
expect(logs).not.toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringContaining('@three'),
message: jasmine.stringContaining('@if-three'),
}),
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class JavaScriptTransformer {
{
// The below is disable as with Yarn PNP this causes build failures with the below message
// `Unable to deserialize cloned data`.
transferList: process.versions.pnp ? undefined : [data.buffer],
transferList: process.versions.pnp ? undefined : [data.buffer as ArrayBuffer],
},
)) as Uint8Array;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ export function subscribeToWorkflow(
);
break;
case 'update':
logs.push(`${colors.cyan('UPDATE')} ${eventPath} (${event.content.length} bytes)`);
logs.push(
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
`${colors.cyan('UPDATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem ideal from a type safety perspective.
Is there some information/context on the changes needed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as far as I could tell, the types didn't really change but TS is being better at enforcing them. I did start to update the types, but it ended up spanning a ton of files so decided to keep the change simple for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. makes sense.
Can you add some TODOs in there so we can clean this up later on?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I've added TODOs on all those as unknown as cases.

);
files.add(eventPath);
break;
case 'create':
logs.push(`${colors.green('CREATE')} ${eventPath} (${event.content.length} bytes)`);
logs.push(
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
`${colors.green('CREATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
);
files.add(eventPath);
break;
case 'delete':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class TestProjectHost extends NodeJsSyncHost {
content = content.buffer.slice(content.byteOffset, content.byteOffset + content.byteLength);
}

this.scopedSync().write(normalize(fileName), content);
this.scopedSync().write(normalize(fileName), content as ArrayBufferLike);
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"ng-packagr": "0.0.0-NG-PACKAGR-PEER-DEP",
"protractor": "^7.0.0",
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
"typescript": ">=5.8 <5.9"
"typescript": ">=5.8 <6.0"
},
"peerDependenciesMeta": {
"@angular/core": {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/core/src/virtual-fs/host/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TextDecoder, TextEncoder } from 'node:util';
import { FileBuffer } from './interface';

export function stringToFileBuffer(str: string): FileBuffer {
return new TextEncoder().encode(str).buffer;
return new TextEncoder().encode(str).buffer as FileBuffer;
}

export function fileBufferToString(fileBuffer: FileBuffer): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/angular_devkit/schematics/src/sink/dryrun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export interface DryRunDeleteEvent {
export interface DryRunCreateEvent {
kind: 'create';
path: string;
content: Buffer;
content: ArrayBufferLike;
}
export interface DryRunUpdateEvent {
kind: 'update';
path: string;
content: Buffer;
content: ArrayBufferLike;
}
export interface DryRunRenameEvent {
kind: 'rename';
Expand Down
10 changes: 6 additions & 4 deletions packages/angular_devkit/schematics/src/sink/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { SimpleSinkBase } from './sink';
export class HostSink extends SimpleSinkBase {
protected _filesToDelete: Set<Path> = new Set();
protected _filesToRename: Set<[Path, Path]> = new Set();
protected _filesToCreate: Map<Path, Buffer<ArrayBufferLike>> = new Map();
protected _filesToUpdate: Map<Path, Buffer<ArrayBufferLike>> = new Map();
protected _filesToCreate: Map<Path, ArrayBufferLike> = new Map();
protected _filesToUpdate: Map<Path, ArrayBufferLike> = new Map();

constructor(
protected _host: virtualFs.Host,
Expand Down Expand Up @@ -58,13 +58,15 @@ export class HostSink extends SimpleSinkBase {
}

protected _overwriteFile(path: Path, content: Buffer): Observable<void> {
this._filesToUpdate.set(path, content);
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
this._filesToUpdate.set(path, content as unknown as ArrayBufferLike);

return EMPTY;
}

protected _createFile(path: Path, content: Buffer): Observable<void> {
this._filesToCreate.set(path, content);
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
this._filesToCreate.set(path, content as unknown as ArrayBufferLike);

return EMPTY;
}
Expand Down
10 changes: 8 additions & 2 deletions packages/angular_devkit/schematics_cli/bin/schematics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,16 @@ export async function main({
);
break;
case 'update':
loggingQueue.push(`${colors.cyan('UPDATE')} ${eventPath} (${event.content.length} bytes)`);
loggingQueue.push(
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
`${colors.cyan('UPDATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
);
break;
case 'create':
loggingQueue.push(`${colors.green('CREATE')} ${eventPath} (${event.content.length} bytes)`);
loggingQueue.push(
// TODO: `as unknown` was necessary during TS 5.9 update. Figure out a long-term solution.
`${colors.green('CREATE')} ${eventPath} (${(event.content as unknown as Buffer).length} bytes)`,
);
break;
case 'delete':
loggingQueue.push(`${colors.yellow('DELETE')} ${eventPath}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/ngtools/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"homepage": "https://github.com/angular/angular-cli/tree/main/packages/ngtools/webpack",
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-ANGULAR-FW-PEER-DEP",
"typescript": ">=5.8 <5.9",
"typescript": ">=5.8 <6.0",
"webpack": "^5.54.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
load("//tools:defaults.bzl", "ts_project")

# files fetched on 2025-03-03 from
# https://github.com/microsoft/TypeScript/releases/tag/v5.8.2
# files fetched on 2025-07-18

# Commands to download:
# curl https://raw.githubusercontent.com/microsoft/TypeScript/v5.8.2/lib/typescript.d.ts -o packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts
# curl https://raw.githubusercontent.com/microsoft/TypeScript/v5.8.2/lib/typescript.js -o packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js
# Commands to update from node_modules:
# cp node_modules/typescript/lib/typescript.d.ts packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts
# cp node_modules/typescript/lib/typescript.js packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js

licenses(["notice"]) # Apache 2.0

Expand Down
Loading