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.2 #51334

Closed
wants to merge 1 commit into from
Closed

Conversation

crisbeto
Copy link
Member

Updates the project to support TypeScript 5.2.

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Aug 11, 2023
@crisbeto crisbeto force-pushed the ts-5.2 branch 3 times, most recently from cd2286b to 46c0725 Compare August 11, 2023 11:59
Updates the project to support TypeScript 5.2.
@@ -306,21 +306,27 @@ describe('type definitions', () => {
const definitions = getTypeDefinitions({
templateOverride: `<div *ngFor="let item of heroes as her¦oes2; trackBy: test;"></div>`,
});
expectAllDefinitions(definitions, new Set(['Array']), possibleArrayDefFiles);
expectAllDefinitions(
Copy link
Member Author

Choose a reason for hiding this comment

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

Note for reviewer: this test had a legitimate behavior difference where the returned definition is now ['Hero', 'Array'], instead of ['Array']. As far as I can tell, this has nothing to do with our implementation since it's basically a direct call into the TS language service here:

return this.tsLS.getTypeDefinitionAtPosition(tcbPath, positionInFile) ?? [];

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: minor This PR is targeted for the next minor release labels Aug 14, 2023
@crisbeto crisbeto marked this pull request as ready for review August 14, 2023 08:29
@ngbot ngbot bot modified the milestone: Backlog Aug 14, 2023
// TODO: temporarily disabled until ESM issue is resolved.
// import * as compilerCli from '@angular/compiler-cli';
// import * as localize from '@angular/localize';

Copy link
Member Author

Choose a reason for hiding this comment

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

cc @devversion since this had to be disabled due to compiler-cli and localize not using ESM.

Copy link
Member

Choose a reason for hiding this comment

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

It's good that we have this captured in code now.

Copy link
Member

Choose a reason for hiding this comment

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

For later context: We knew this was always not fully compatible- the test just didn't show this because we had moduleResolution still set to node and not nodenext

// TODO: temporarily disabled until ESM issue is resolved.
// import * as compilerCli from '@angular/compiler-cli';
// import * as localize from '@angular/localize';

Copy link
Member

Choose a reason for hiding this comment

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

It's good that we have this captured in code now.

// TODO: temporarily disabled until ESM issue is resolved.
// import * as compilerCli from '@angular/compiler-cli';
// import * as localize from '@angular/localize';

Copy link
Member

Choose a reason for hiding this comment

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

For later context: We knew this was always not fully compatible- the test just didn't show this because we had moduleResolution still set to node and not nodenext

@@ -32,6 +32,11 @@ export class OpenBuffer {
set contents(newContents: string) {
const snapshot = this.scriptInfo.getSnapshot();
this.scriptInfo.editContent(0, snapshot.getLength(), newContents);

// As of TypeScript 5.2 we need to trigger graph update manually in order to satisfy the
Copy link
Member

Choose a reason for hiding this comment

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

Not an expert on the LS, but the comment on the assertion. I can't fully reason where we end up hitting this assertion in the context of set contents?

Copy link
Member Author

Choose a reason for hiding this comment

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

We hit it on the specific line in the link. In the set contents we have a call to ts.server.ScriptInfo.editContent which goes through a few other methods before hitting updateGraphWorker. My understanding is that because the program shape might've changed, it need to be recomputed.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder how expensive updateGraph is when the program shape hasn't changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Capturing what I mentioned over DM: this code is only used in tests so even if there is some overhead, it's not as big of a deal.

Copy link
Contributor

@JiaLiPassion JiaLiPassion left a comment

Choose a reason for hiding this comment

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

LGTM!

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 18, 2023
@crisbeto crisbeto removed the request for review from josephperrott August 18, 2023 04:58
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 9cc52b9.

MarkTechson pushed a commit to MarkTechson/angular that referenced this pull request Aug 18, 2023
Updates the project to support TypeScript 5.2.

PR Close angular#51334
JeanMeche added a commit to JeanMeche/angular that referenced this pull request Aug 20, 2023
Node 16 support is dropped per angular/angular-cli#25675
TS 5.2 is supported per angular#51334
thomasturrell pushed a commit to thomasturrell/angular that referenced this pull request Aug 29, 2023
Updates the project to support TypeScript 5.2.

PR Close angular#51334
JeanMeche added a commit to JeanMeche/angular that referenced this pull request Sep 13, 2023
Node 16 support is dropped per angular/angular-cli#25675
TS 5.2 is supported per angular#51334
JeanMeche added a commit to JeanMeche/angular that referenced this pull request Sep 13, 2023
Node 16 support is dropped per angular/angular-cli#25675
TS 5.2 is supported per angular#51334
@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 Sep 18, 2023
LayZeeDK pushed a commit to LayZeeDK/angular__angular that referenced this pull request Sep 20, 2023
Updates the project to support TypeScript 5.2.

PR Close angular#51334
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
Updates the project to support TypeScript 5.2.

PR Close angular#51334
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 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

5 participants