Open weidezhong-msft opened 2 years ago
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.
Thanks for the quick response. I have since changed the code to reduce the number of exports. I am no longer getting the “Unable to determine semantic information for declaration” error, but I am getting a new error. See the attached log for details. I did find some .ts files in the list. I have also attached api-extractor.json and the entry file pylanceServerWrapper.d.ts.
Error: D:/repos/pyrx-officepy/packages/pyright/packages/pyright-internal/src/common/core.ts:1:1 - (ae-wrong-input-file-type) Incorrect file type; API Extractor expects to analyze compiler outputs with the .d.ts file extension. Troubleshooting tips: https://api-extractor.com/link/dts-error
The repo is internal to Microsoft. I can only share it within Microsoft.
From: Zack Elliott @.> Sent: Thursday, October 6, 2022 7:49 AM To: microsoft/rushstack @.> Cc: Weide Zhong @.>; Author @.> Subject: Re: [microsoft/rushstack] [api-extractor] Unable to determine semantic information for declaration (Issue #3674)
Is the code that you referenced 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. 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.
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/rushstack/issues/3674#issuecomment-1270195083, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATJ2NHHR4TP7LPKZQAMUXPDWB3RELANCNFSM6AAAAAAQ5ZIUGM. You are receiving this because you authored the thread.Message ID: @.**@.>>
I think the problem is due to my tsconfig.json repathing child package reference to the output folder, because pyright-internal is a child package, and it is locally built.
The source code is here. This is what api-extractor knows about the location. D:/repos/pyrx-officepy/packages/pyright/packages/pyright-internal/src/common/core.ts
The d.ts file is actually here. D:\repos\pyrx-officepy\packages\pylance-officepy\out\pyright\packages\pyright-internal\src\common\core.d.ts
How can api-extractor be configured to use the compiler’s path mapping?
"compilerOptions": {
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"lib": ["es2017"],
"outDir": "./out",
"paths": {
"pylance-internal/*": ["../pylance-internal/src/*"],
"pyright-internal/*": ["../pyright/packages/pyright-internal/src/*"],
"pylance-officepy/*": ["../pylance-officepy/src/*"]
}
},
From: Weide Zhong Sent: Thursday, October 6, 2022 9:52 AM To: microsoft/rushstack @.>; microsoft/rushstack @.> Cc: Author @.***> Subject: RE: [microsoft/rushstack] [api-extractor] Unable to determine semantic information for declaration (Issue #3674)
Thanks for the quick response. I have since changed the code to reduce the number of exports. I am no longer getting the “Unable to determine semantic information for declaration” error, but I am getting a new error. See the attached log for details. I did find some .ts files in the list. I have also attached api-extractor.json and the entry file pylanceServerWrapper.d.ts.
Error: D:/repos/pyrx-officepy/packages/pyright/packages/pyright-internal/src/common/core.ts:1:1 - (ae-wrong-input-file-type) Incorrect file type; API Extractor expects to analyze compiler outputs with the .d.ts file extension. Troubleshooting tips: https://api-extractor.com/link/dts-error
The repo is internal to Microsoft. I can only share it within Microsoft.
From: Zack Elliott @.**@.>> Sent: Thursday, October 6, 2022 7:49 AM To: microsoft/rushstack @.**@.>> Cc: Weide Zhong @.**@.>>; Author @.**@.>> Subject: Re: [microsoft/rushstack] [api-extractor] Unable to determine semantic information for declaration (Issue #3674)
Is the code that you referenced 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. 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.
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/rushstack/issues/3674#issuecomment-1270195083, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATJ2NHHR4TP7LPKZQAMUXPDWB3RELANCNFSM6AAAAAAQ5ZIUGM. You are receiving this because you authored the thread.Message ID: @.**@.>>
I think you're probably running into the same issue as https://github.com/microsoft/rushstack/issues/3510.
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?
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)