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] Improve analysis of types exposed via global variables #1767

Merged
merged 8 commits into from
Mar 28, 2020

Conversation

octogonz
Copy link
Collaborator

@octogonz octogonz commented Mar 6, 2020

This is an initial prototype of a solution for #1765

Also fixes #1095

Also fixes #1316

Reverts half-baked workaround from #1098

I've also improved --diagnostics switch to report when globals are encountered. Example output:

============================================================

Ignoring reference to global variable "Object" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/index.d.ts:47:41
Ignoring reference to global variable "TypedPropertyDescriptor" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/index.d.ts:47:91 
Ignoring reference to global variable "Map" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/index.d.ts:26:27
Ignoring reference to global variable "Promise" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/index.d.ts:30:27
Ignoring reference to global variable "jest" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/index.d.ts:35:24
Ignoring reference to global variable "IAmbientInterfaceExample" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/index.d.ts:41:21
Ignoring reference to global variable "Symbol" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/EcmaScriptSymbols.d.ts:21:10      
Ignoring reference to global variable "Intl" in D:/Git/rushstack/build-tests/api-extractor-test-01/lib/ReferenceLibDirective.d.ts:3:52     

Writing: D:\Git\rushstack\build-tests\api-extractor-test-01\temp\api-extractor-test-01.api.json

@octogonz octogonz marked this pull request as ready for review March 28, 2020 23:05
@octogonz octogonz force-pushed the octogonz/ae-global-variable-analysis branch from 05fc1ee to 2e11017 Compare March 28, 2020 23:06
workingPackageFolderPath?: string
}

export class SourceFileLocationFormatter {
Copy link
Member

Choose a reason for hiding this comment

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

It'd be cool to genericize this. Maybe add it to the Terminal API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's not a bad idea. API Extractor's usage is coupled to the compiler API, so I think I would approach this work item from some other tool that wants to report file/line information.

Terminal doesn't seem like the right place, because it's about writing to a terminal. Path might not be a bad choice, or maybe something more specific like SourceFilePath. It could possibly also include a generalized equivalent of getLineAndCharacterOfPosition().

But again, I'd want to introduce that API as part of solving some problem that actually needs it, so we know what the requirements are.

@octogonz octogonz merged commit 187529f into master Mar 28, 2020
@octogonz octogonz deleted the octogonz/ae-global-variable-analysis branch March 28, 2020 23:55
@octogonz
Copy link
Collaborator Author

This fix was published with API Extractor 7.7.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants