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]: update getGlobalVariableAnalyzer to support changes to typescript internals in v4.7 #3394

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/api-extractor/src/analyzer/TypeScriptInternals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ export class TypeScriptInternals {

public static getGlobalVariableAnalyzer(program: ts.Program): IGlobalVariableAnalyzer {
const anyProgram: any = program;
if (!anyProgram.getDiagnosticsProducingTypeChecker) {
throw new InternalError('Missing Program.getDiagnosticsProducingTypeChecker');
const typeCheckerInstance: any =
anyProgram.getDiagnosticsProducingTypeChecker ?? anyProgram.getTypeChecker;

if (!typeCheckerInstance) {
throw new InternalError('Missing Program.getDiagnosticsProducingTypeChecker or Program.getTypeChecker');
}
const typeChecker: any = anyProgram.getDiagnosticsProducingTypeChecker();
const typeChecker: any = typeCheckerInstance();
if (!typeChecker.getEmitResolver) {
throw new InternalError('Missing TypeChecker.getEmitResolver');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/api-extractor",
"comment": "Update the global variable analyzer to add support for changes to the TypeScript internals coming in v4.7",
"type": "patch"
}
],
"packageName": "@microsoft/api-extractor"
}