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] Unable to determine semantic information for declaration #3674

Open
weidezhong-msft opened this issue Oct 5, 2022 · 5 comments
Projects

Comments

@weidezhong-msft
Copy link

I am hitting ERROR: Internal Error: Unable to determine semantic information for declaration: when running api-extractor
The bolded code [name, value] seems to be causing the problem.
const diagnosticSeverityOverrides = pythonAnalysisSection.diagnosticSeverityOverrides;
if (diagnosticSeverityOverrides) {
for (const [name, value] of Object.entries(diagnosticSeverityOverrides)) {
const ruleName = this.getDiagnosticRuleName(name);
const severity = this.getSeverityOverrides(value as string);
if (ruleName && severity) {
serverSettings.diagnosticSeverityOverrides![ruleName] = severity!;
}
}
}

Repro steps

Expected result:

Actual result: Internal Error: Unable to determine semantic information for declaration: when running api-extractor

InternalError (d:\repos\rushstack\libraries\node-core-library\src\InternalError.ts:49)
getSymbolForDeclaration (d:\repos\rushstack\apps\api-extractor\src\analyzer\TypeScriptHelpers.ts:119)
_fetchAstDeclaration (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:510)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:467)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeChildTree (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:473)
_analyzeAstSymbol (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:312)
(d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:326)
forEachDeclarationRecursive (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstDeclaration.ts:204)
forEachDeclarationRecursive (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbol.ts:179)
_analyzeAstSymbol (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:321)
analyze (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:154)
(d:\repos\rushstack\apps\api-extractor\src\analyzer\ExportAnalyzer.ts:338)
_collectAllExportsRecursive (d:\repos\rushstack\apps\api-extractor\src\analyzer\ExportAnalyzer.ts:326)
fetchAstModuleExportInfo (d:\repos\rushstack\apps\api-extractor\src\analyzer\ExportAnalyzer.ts:247)
fetchAstModuleExportInfo (d:\repos\rushstack\apps\api-extractor\src\analyzer\AstSymbolTable.ts:128)
analyze (d:\repos\rushstack\apps\api-extractor\src\collector\Collector.ts:251)
invoke (d:\repos\rushstack\apps\api-extractor\src\api\Extractor.ts:256)
onExecute (d:\repos\rushstack\apps\api-extractor\src\cli\RunAction.ts:137)
_execute (d:\repos\rushstack\libraries\ts-command-line\src\providers\CommandLineAction.ts:104)
onExecute (d:\repos\rushstack\libraries\ts-command-line\src\providers\CommandLineParser.ts:277)
onExecute (d:\repos\rushstack\apps\api-extractor\src\cli\ApiExtractorCommandLine.ts:44)
executeWithoutErrorHandling (d:\repos\rushstack\libraries\ts-command-line\src\providers\CommandLineParser.ts:230)
execute (d:\repos\rushstack\libraries\ts-command-line\src\providers\CommandLineParser.ts:152)
(d:\repos\rushstack\apps\api-extractor\src\start.ts:17)
Module._compile (internal/modules/cjs/loader:1105)
Module._extensions..js (internal/modules/cjs/loader:1159)
Module.load (internal/modules/cjs/loader:981)
Module._load (internal/modules/cjs/loader:822)
Module.require (internal/modules/cjs/loader:1005)
require (internal/modules/cjs/helpers:102)
(d:\repos\rushstack\apps\api-extractor\bin\api-extractor:2)
Module._compile (internal/modules/cjs/loader:1105)
Module._extensions..js (internal/modules/cjs/loader:1159)
Module.load (internal/modules/cjs/loader:981)
Module._load (internal/modules/cjs/loader:822)
executeUserEntryPoint (internal/modules/run_main:77)
(internal/main/run_main_module:17)

Details

Standard questions

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

Question Answer
@microsoft/api-extractor version? latest built from the rush repo
Operating system? Windows 11
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? Yes
TypeScript compiler version? 4.4.4
Node.js version (node -v)? 16.16.0
@D4N14L D4N14L changed the title [api-extractor] [api-extractor] Unable to determine semantic information for declaration Oct 5, 2022
@D4N14L D4N14L added this to Needs Investigation in Bug Triage Oct 5, 2022
@zelliott
Copy link
Contributor

zelliott commented Oct 6, 2022

Is the code that you shared above (i.e. const diagnosticSeverityOverrides...) within your codebase (I think so)? If so, then the issue may be that API Extractor is running on .ts files in your codebase (as the code you shared looks like its from a .ts file). API Extractor expects to process .d.ts files, not .ts files. If you invoke API Extractor with the --diagnostics flag (https://api-extractor.com/pages/setup/invoking/), then it should print out the list of files that it's processing, and you can validate if there are any .ts files in that list.

Additionally, if you're able to share the repo that you're running API Extractor on as well as steps to run API Extractor in that repo, that would help me diagnose what's going on.

@weidezhong-msft
Copy link
Author

weidezhong-msft commented Oct 6, 2022 via email

@weidezhong-msft
Copy link
Author

weidezhong-msft commented Oct 6, 2022 via email

@zelliott
Copy link
Contributor

zelliott commented Oct 6, 2022

I think you're probably running into the same issue as #3510.

@weidezhong-msft
Copy link
Author

It does appear to be the same issue, but I have to use path mapping in my repo. If I want to temporarily workaround the issue, where should I look at in api-extractor?

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

No branches or pull requests

2 participants