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

[api-extractor] Missing support for TS 4.9 satisfies operator #3890

Closed
AlCalzone opened this issue Jan 12, 2023 · 6 comments
Closed

[api-extractor] Missing support for TS 4.9 satisfies operator #3890

AlCalzone opened this issue Jan 12, 2023 · 6 comments
Labels
effort: easy Probably a quick fix. Want to contribute? :-) upgrade A component is outdated and needs to be upgraded

Comments

@AlCalzone
Copy link

Summary

When using the new satisfies operator, api-extractor prints a warning - (TS2304) Cannot find name 'satisfies'. due to its outdated TypeScript dependency.

Repro steps

Use api-documenter on TypeScript code that uses the satisfies operator.

Expected result: No warning or error

Actual result: - (TS2304) Cannot find name 'satisfies'. in the generated output.

Details

How do you think we should fix this?

Upgrade TypeScript

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.33.7
Operating system? Linux
API Extractor scenario? reporting (.api.md)
Would you consider contributing a PR? No
TypeScript compiler version? 4.9.4, analysis uses the bundled 4.8.4
Node.js version (node -v)? 16.19.0
@octogonz
Copy link
Collaborator

Let's upgrade API Extractor's version of TypeScript

@octogonz octogonz added effort: easy Probably a quick fix. Want to contribute? :-) upgrade A component is outdated and needs to be upgraded labels Jan 22, 2023
@octogonz
Copy link
Collaborator

octogonz commented Jan 24, 2023

Looking at the TypeScript 4.9 release notes, these are the new features that could potentially cause incompatibilities:

  1. Auto-Accessors in Classes impacts API Extractor: ideally we should model this as a property API, but as a short term work around we could merely report a warning saying it's unsupported
  2. File-Watching Now Uses File System Events might impact Heft
  3. Internal API changes impact ESLint: Linting crashes with Parsing error: node.getStart is not a function. The fix will be to upgrade @typescript-eslint/parser

Issues 2 and 3 are only important if we upgrade the entire monorepo at once. If we upgrade API Extractor by itself, then we only need to worry about issue 1. In particular, I have validated that all the API Extractor build tests pass when using TypeScript 4.9.

Let me do a little research about auto-accessors and follow up.

@dmichon-msft @iclanton @D4N14L

@johncarmack1984
Copy link

johncarmack1984 commented Jan 27, 2023

Looking forward to this release, glad to see the issue's got eyes on it :)

@AlCalzone
Copy link
Author

I don't want to bother, but is there anything blocking this?

The next version of TypeScript is now out, with new type-level features: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#support-for-export-type

@octogonz
Copy link
Collaborator

Use api-documenter on TypeScript code that uses the satisfies operator.

@AlCalzone I tried for a while to find a way to reproduce this error, however I could not find any way to get the compiler to emit a satisfies expression in the output .d.ts file. The reason is that in your .ts source file, the satisfies keyword asks the compiler to check an initializer value, but these values are not normally emitted into the .d.ts typings.

That said, API Extractor 7.35.0 was recently released using TypeScript 5.0 (see PR #4103). That should solve your problem and any other issues where new syntax was not parsed by API Extractor. If not, please reopen this issue and provide more detailed repro steps. Thanks!

@AlCalzone
Copy link
Author

Thanks. I can no longer reproduce on 7.35.0.

@iclanton iclanton moved this to Closed in Bug Triage Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: easy Probably a quick fix. Want to contribute? :-) upgrade A component is outdated and needs to be upgraded
Projects
Archived in project
Development

No branches or pull requests

3 participants