[go: nahoru, domu]

Skip to content
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

feat(core): support TypeScript 5.5 #56096

Closed
wants to merge 1 commit into from
Closed

Conversation

crisbeto
Copy link
Member

Updates the repo to add support for TypeScript 5.5. Includes resolving some compilation errors and broken tests.

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label May 27, 2024
crisbeto added a commit to crisbeto/dev-infra that referenced this pull request May 27, 2024
Currently some places import the `ts_library` from the node_modules while others import it from `defaults.bzl`. This causes a mismatch in the `target` that ends up being used and breaking angular/angular#56096.

These changes switch the imports to go through `defaults.bzl`.
crisbeto added a commit to crisbeto/dev-infra that referenced this pull request May 27, 2024
Currently some places import the `ts_library` from the node_modules while others import it from `defaults.bzl`. This causes a mismatch in the `target` that ends up being used and breaking angular/angular#56096.

These changes switch the imports to go through `defaults.bzl`.
crisbeto added a commit to crisbeto/dev-infra that referenced this pull request May 27, 2024
Currently the default `target` for the code compiled with `ts_library` is set through the `ts_library` exposed in `defaults.bzl`, however the code under the `bazel` directory isn't allowed to use `defaults.bzl` which meant that it was defaulting to es2015.

These changes add a `defaults.bzl` specific to the `bazel` directory which allows us to maintain the defaults in a single place.

This came up due to a breakage in angular/angular#56096.
crisbeto added a commit to crisbeto/dev-infra that referenced this pull request May 27, 2024
Currently the default `target` for the code compiled with `ts_library` is set through the `ts_library` exposed in `defaults.bzl`, however the code under the `bazel` directory isn't allowed to use `defaults.bzl` which meant that it was defaulting to es2015.

These changes add a `defaults.bzl` specific to the `bazel` directory which allows us to maintain the defaults in a single place.

This came up due to a breakage in angular/angular#56096.
crisbeto added a commit to crisbeto/dev-infra that referenced this pull request May 27, 2024
Currently the default `target` for the code compiled with `ts_library` is set through the `ts_library` exposed in `defaults.bzl`, however the code under the `bazel` directory isn't allowed to use `defaults.bzl` which meant that it was defaulting to es2015.

These changes add a `defaults.bzl` specific to the `bazel` directory which allows us to maintain the defaults in a single place.

This came up due to a breakage in angular/angular#56096.
crisbeto added a commit to crisbeto/dev-infra that referenced this pull request May 27, 2024
Currently the default `target` for the code compiled with `ts_library` is set through the `ts_library` exposed in `defaults.bzl`, however the code under the `bazel` directory isn't allowed to use `defaults.bzl` which meant that it was defaulting to es2015.

These changes add a `defaults.bzl` specific to the `bazel` directory which allows us to maintain the defaults in a single place.

This came up due to a breakage in angular/angular#56096.
devversion pushed a commit to angular/dev-infra that referenced this pull request May 27, 2024
Currently the default `target` for the code compiled with `ts_library` is set through the `ts_library` exposed in `defaults.bzl`, however the code under the `bazel` directory isn't allowed to use `defaults.bzl` which meant that it was defaulting to es2015.

These changes add a `defaults.bzl` specific to the `bazel` directory which allows us to maintain the defaults in a single place.

This came up due to a breakage in angular/angular#56096.
@crisbeto crisbeto force-pushed the ts-5.5 branch 15 times, most recently from 4a8f2d4 to 9001876 Compare May 28, 2024 12:27
// changing since TypeScript will `switchToScriptVersionCache` when a file is opened.
// Note that this emulates what we have to do in the server/extension as well.
// TODO: remove this once PR #41475 lands
this.tsProject.markAsDirty();
Copy link
Member Author

Choose a reason for hiding this comment

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

Context here is that the markAsDirty method doesn't exist anymore and the TODO above mentioned that it should've been removed a long time ago.

@@ -3375,7 +3375,7 @@ runInEachFileSystem((os: string) => {

env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toMatch(/function Test_Factory\(t\) { i0\.ɵɵinvalidFactory\(\)/ms);
expect(jsContents).toMatch(/function Test_Factory\(t\) { i0\.ɵɵinvalidFactory\(\)/m);
Copy link
Member Author

Choose a reason for hiding this comment

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

The s flag wasn't doing anything here so I removed it.

newText,
{
// Not passing the implied Node format appears not break program reuse in TS 5.5.
impliedNodeFormat: undefined,
Copy link
Member Author

Choose a reason for hiding this comment

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

This one took a while to track down, but for some reason omitting the impliedNodeFormat prevented the program from being reused. It showed up in our own unit tests as well.

@@ -83,6 +83,10 @@ export function typeToValue(
return typeOnlyImport(typeNode, firstDecl);
}

if (!ts.isImportDeclaration(firstDecl.parent)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is necessary, because import clauses can now be inside ImportDeclaration or JSDocImportTag.

@@ -171,7 +171,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDE
type: Directive,
args: [{
standalone: true,
selector: '[direct]',
Copy link
Member

Choose a reason for hiding this comment

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

The trailing comma removal is adding a large amount to the diff for this PR. Is this something that is expected and can we fix that somehow? Keeping the trailing commas would better align with the formatting throughout the rest of the repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the sort of thing that TS changes once in a while for no reason. We might be able to get it back, but I'm not sure it's worth the hassle just for this one PR.

Updates the repo to add support for TypeScript 5.5. Includes resolving some compilation errors and broken tests.
@crisbeto crisbeto marked this pull request as ready for review May 28, 2024 13:55
@pullapprove pullapprove bot requested review from alxhub and devversion May 28, 2024 13:55
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels May 28, 2024
@pkozlowski-opensource pkozlowski-opensource added the area: core Issues related to the framework runtime label May 28, 2024
@ngbot ngbot bot added this to the Backlog milestone May 28, 2024
@crisbeto
Copy link
Member Author
crisbeto commented May 29, 2024

This is still missing approvals for bazel, devtools and dev-infra. Everybody who can approve it for them is away. I'm skipping PullApprove for the remainder, since the changes are trivial:

  • For bazel it's a change in the peerDependencies.
  • For devltools it's a fix for an incorrect type.
  • For dev-infra it's due to the version bump.

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker PullApprove: disable and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 29, 2024
@crisbeto crisbeto removed the request for review from devversion May 29, 2024 05:50
@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit e5a6f91.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime detected: feature PR contains a feature commit PullApprove: disable target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants