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]: --typescript-compiler-folder is not properly handled within Extractor._checkCompilerCompatibility() call #2565

Open
Hotell opened this issue Mar 23, 2021 · 1 comment

Comments

@Hotell
Copy link

Hotell commented Mar 23, 2021

Run:
api-extractor run --local --typescript-compiler-folder ./node_modules/typescript --verbose

Summary

When --typescript-compiler-folder flag is used api-extractor prints miss-leading warning.

Analysis will use the bundled TypeScript version 4.1.5
...
...
*** The target project appears to use TypeScript 4.2.3 which is newer than the bundled compiler engine; consider upgrading API Extractor. ...
  1. https://github.com/microsoft/rushstack/blob/master/apps/api-extractor/src/cli/RunAction.ts#L141
  • typescriptCompilerFolder value is properly set: /<PATH>/node_modules/typescript
  1. https://github.com/microsoft/rushstack/blob/master/apps/api-extractor/src/api/CompilerState.ts#L140-L144
  • program is properly created with user provided tsc binary.
  1. https://github.com/microsoft/rushstack/blob/master/apps/api-extractor/src/api/Extractor.ts#L211
  • _checkCompilerCompatibility() is being called without proper tsc path that is being used
  1. miss-leading warning are printed out to user

Repro steps

Expected result:
Provide correct info to user that his specified version of TSC is used

Actual result:
Miss leading warnings what TSC is being used

Details

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.13.2
Operating system? Mac
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? Maybe
TypeScript compiler version? 4.2.3
Node.js version (node -v)? 15
@DLehenbauer
Copy link

@hottell - I think the warning is correct. Per docs, api-extractor always uses the bundled compiler. The `--typescript-compiler-folder' option allows you to substitute system typings from your project's toolchain.

See compiler version incompatibilities on this page:
https://api-extractor.com/pages/setup/invoking/

It's also there in the last sentence of the usage, but you have to read carefully:

  --typescript-compiler-folder PATH
                        API Extractor uses its own TypeScript compiler engine 
                        to analyze your project. If your project is built 
                        with a significantly different TypeScript version, 
                        sometimes API Extractor may report compilation errors 
                        due to differences in the system typings (e.g. lib.
                        dom.d.ts). You can use the 
                        "--typescriptCompilerFolder" option to specify the 
                        folder path where you installed the TypeScript 
                        package, and API Extractor's compiler will use those 
                        system typings instead.

@iclanton iclanton moved this to Needs triage in Bug Triage Oct 2, 2023
@iclanton iclanton moved this from Needs triage to AE/AD in Bug Triage Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

No branches or pull requests

2 participants