rushstack
rushstack copied to clipboard
[api-extractor] can't link to native API with @link in a @throws tag
Summary
@link when used in a @throws section with a native error, will lead api-extractor to print a warning in the console.
Repro steps
When writing
// index.ts
/**
* @throws {@link TypeError} param is expected to be a string, something else was passed
*/
function myFunction(param: string) {
if (typeof param !== 'string') {
throw TypeError('param is expected to be a string')
}
api-extractor will output the following warning :
Warning: index.ts:2:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "[packageName]" does not have an export "TypeError"
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.34.7 |
| Operating system? | Windows 10 |
| API Extractor scenario? | rollups (.d.ts) |
| Would you consider contributing a PR? | No |
| TypeScript compiler version? | 4.8.4 |
Node.js version (node -v)? |
18.12.1 |
Same here.
Actually it looks like AE doesn't resolve links to native API at all. I'm not sure if it did when I first opened this issue.
sample code :
interface NotAnArray {
/**
* Same as {@link Array.prototype.flatMap}
*/
flatMap<returnType>(callback: (resource: resource) => returnType | returnType[]): returnType[];
(ae-unresolved-link) The @link reference could not be resolved: The package "[package name]" does not have an export "Array"
update on affected setup :
| Question | Answer |
|---|---|
@microsoft/api-extractor version? |
7.42.3 |
| Operating system? | Windows 10 and Ubuntu 22.04 WSL |
| API Extractor scenario? | rollups (.d.ts) |
| Would you consider contributing a PR? | No |
| TypeScript compiler version? | 5.4.2 and 5.3.3 |
Node.js version (node -v)? |
20.11.0 |