Skip to content

Commit

Permalink
update getGlobalVariableAnalyzer to support changes to typescript int…
Browse files Browse the repository at this point in the history
…ernals in v4.7
  • Loading branch information
chrisdholt committed May 4, 2022
1 parent 097b7c0 commit fe1b26b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/api-extractor/src/analyzer/TypeScriptInternals.ts
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
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/api-extractor",
"comment": "update getGlobalVariableAnalyzer to support changes to typescript internals in v4.7",
"type": "patch"
}
],
"packageName": "@microsoft/api-extractor"
}

0 comments on commit fe1b26b

Please sign in to comment.