Skip to content

[api-extractor] Support Typescript 5.4 #4581

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

Closed
davidlj95 opened this issue Mar 15, 2024 · 6 comments · Fixed by #4587
Closed

[api-extractor] Support Typescript 5.4 #4581

davidlj95 opened this issue Mar 15, 2024 · 6 comments · Fixed by #4587
Labels
help wanted If you're looking to contribute, this issue is a good place to start!

Comments

@davidlj95
Copy link

davidlj95 commented Mar 15, 2024

Summary

After upgrading a project to latest Typescript version (5.4.2), can't run API Extractor any more as it requires a toolchain Typescript older than 5.3.3.

As stated in docs opening an issue to request the Typescript version update 😃

* Will try a PR later if have some time, seems last update to support 5.3 didn't require much changes

The message for sake of completeness:

*** The target project appears to use TypeScript 5.4.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
Warning: You have changed the public API signature for this project. Please copy the file "/home/runner/work/ngx/ngx/projects/ngx-meta/api-extractor/temp/ngx-meta.api.md" to "/home/runner/work/ngx/ngx/projects/ngx-meta/api-extractor/ngx-meta.api.md", or perform a local build (which does this automatically). See the Git repo documentation for more info.

API Extractor completed with warnings

Repro steps

N/A

Details

N/A

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.42.3 (latest when writing this)
Operating system? Linux
API Extractor scenario? N/A
Would you consider contributing a PR? Yes
TypeScript compiler version? 5.4.2
Node.js version (node -v)? 20.11.1
@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Mar 15, 2024
@davidlj95 davidlj95 changed the title [api-extractor] Update to Typescript 5.4 [api-extractor] Support Typescript 5.4 Mar 15, 2024
@iclanton
Copy link
Member

@octogonz has handled these in the past, although I'm sure he'd appreciate some help!

@iclanton iclanton added the help wanted If you're looking to contribute, this issue is a good place to start! label Mar 18, 2024
@iclanton iclanton moved this from Needs triage to High priority in Bug Triage Mar 18, 2024
@octogonz
Copy link
Collaborator

I read the Announcing TypeScript 5.4 release notes, and none of those changes sound like they would impact API Extractor's ability to analyze .d.ts files. 👍

Let me create a PR to upgrade the version and we'll see if any internal APIs got broken.

@octogonz
Copy link
Collaborator

octogonz commented Mar 18, 2024

Here's a PR: #4587

Everything built but there are some incorrect .d.ts rollups in 05c3afa that I think are caused by changes in the formatting of the compiler output. We need to investigate that.

@davidlj95
Copy link
Author

Awesome! Thanks @iclanton & @octogonz ❤️

@octogonz
Copy link
Collaborator

Everything built but there are some incorrect .d.ts rollups in 05c3afa that I think are caused by changes in the formatting of the compiler output. We need to investigate that.

The prop2 appearing in that diff is actually caused by the TypeScript compiler, not API Extractor: microsoft/TypeScript#57841

However I still need to investigate why it didn't appear in the .d.ts rollup prior to TypeScript 5.4.

@octogonz
Copy link
Collaborator

However I still need to investigate why it didn't appear in the .d.ts rollup prior to TypeScript 5.4.

The compiler was improved to avoid emitting these parameter destructuring aliases in TypeScript 4.8 (576d198 in our repo), however that turned out to cause regressions in some edge cases, thus TypeScript 5.4.2 reverted this change with microsoft/TypeScript#57020. (Interestingly, the TypeScript maintainers thought these edge cases probably could be handled, however the computational cost would not have justified the benefit. Of course, API Extractor has different requirements from a compiler, e.g. if we were motivated we could consider implementing this feature for .api.md and .api.json but not the .d.ts rollup.)

In short, the diff in 05c3afa is by design.

@github-project-automation github-project-automation bot moved this from High priority to Closed in Bug Triage Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants