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] Support Typescript 5.5 #4805

Open
colinaaa opened this issue Jun 25, 2024 · 3 comments · May be fixed by #4815
Open

[api-extractor] Support Typescript 5.5 #4805

colinaaa opened this issue Jun 25, 2024 · 3 comments · May be fixed by #4815

Comments

@colinaaa
Copy link

Summary

After upgrading to the latest Typescript version (5.5.2) with isolatedDeclarations enabled, the api-extractor failed to run.

> api-extractor run --verbose

api-extractor 7.47.0  - https://api-extractor.com/

Using configuration from ./api-extractor.json

ERROR: Error parsing tsconfig.json content: Unknown compiler option 'isolatedDeclarations'.

Repro steps

  1. Create a new TS 5.5 project.
  2. Enable isolatedDeclarations
  3. Run api-extractor

Expected result:

No error.

Actual result:

Failed to run api-extractor.

Details

As mentioned in docs, this could be fixed by upgrading the TypeScript compiler in api-extractor.

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.47.0
Operating system? Mac
API Extractor scenario? reporting (.api.md)
Would you consider contributing a PR? Yes
TypeScript compiler version? 5.5.2
Node.js version (node -v)? 20.15.0
@iclanton
Copy link
Member

iclanton commented Jun 26, 2024

@colinaaa - Would you be willing to raise a PR making the necessary changes?

@colinaaa
Copy link
Author

I tried to upgrade to TS 5.5. And the following errors showed up:

  [build:typescript] common/temp/default/node_modules/.pnpm/@[email protected][email protected]/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts:17:3594 - (TS2694) Namespace 'ts' has no exported member 'InputFiles'.
  [build:typescript] common/temp/default/node_modules/.pnpm/@[email protected][email protected]/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts:17:3610 - (TS2694) Namespace 'ts' has no exported member 'UnparsedSource'.
  [build:lint] eslint/eslint-plugin/src/hoistJestMockPatterns.ts - Parsing error: Cannot use 'in' operator to search for 'illegalDecorators' in 93

Looks like it also needs typescript-eslint/typescript-eslint#8996 to work with TS 5.5.

Should I just upgrade typescript-eslint-related dependencies from ~6.19.0 to 7.14.1(the version that supports TS 5.5)?

@colinaaa
Copy link
Author

Also, the Simplified Reference Directive Declaration Emit change of TS 5.5 seems to cause errors for tests.

E.g.:

In build-tests/api-extractor-test-01/dist/api-extractor-test-01.d.ts:

- /// <reference types="jest" />
- /// <reference lib="es2015.symbol.wellknown" />
- /// <reference lib="es2018.intl" />

These Reference Directive Declaration are eliminated, which makes api-extractor-test-02 failed:

==> Starting build.js for api-extractor-test-02
---> node node_modules/typescript/lib/tsc
../api-extractor-test-01/dist/api-extractor-test-01.d.ts(59,24): error TS2503: Cannot find namespace 'jest'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: High priority
Development

Successfully merging a pull request may close this issue.

2 participants