microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.82k stars 592 forks source link

[api-extractor] fails with "Error: Internal Error: The "result" symbol has a ts.SyntaxKind.Parameter declaration which is not (yet?) supported by API Extractor" #1460

Open ninok opened 5 years ago

ninok commented 5 years ago

Please prefix the issue title with the project name i.e. [rush], [api-extractor] etc.

Is this a feature or a bug?

Please describe the actual behavior.

Error: Internal Error: The "result" symbol has a ts.SyntaxKind.Parameter declaration which is not (yet?) supported by API Extractor
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate.

git clone git@github.com:heremaps/harp.gl.git
cd harp.gl
git checkout test-apiextractor-geoutils
yarn
yarn workspace @here/harp-geoutils build
cd @here/harp-geoutils
api-extractor run

What is the expected behavior? No error

If this is a bug, please provide the tool version, Node.js version, and OS.

Output of 'api-extractor run --diagnostics`: diagnostics.txt

Api extractor configuration: api-extractor.json

ninok commented 5 years ago

Might be related to https://github.com/microsoft/web-build-tools/issues/1455 even though the error message is slightly different (i.e. ts.SyntaxKind.Parameter instead of ts.SyntaxKind.SourceFile)

octogonz commented 5 years ago

(Note to self)

Instead of this:

git clone git@github.com:heremaps/harp.gl.git

Do this:

git clone https://github.com/heremaps/harp.gl
octogonz commented 5 years ago

The problem is with this declaration from Projection.d.ts:

    /**
     * Reproject a world position from the given source [[Projection]].
     *
     * @param sourceProjection The source projection.
     * @param worldPos A valid position in the world space defined by the source projection.
     * @param result The resulting position reprojected using this [[Projection]].
     */
    reprojectPoint<WorldCoordinates extends Vector3Like>(sourceProjection: Projection, worldPos: Vector3Like, result: WorldCoordinates): typeof result;

The return value of this function is typeof result, which is referring back to the type of one of the other parameters. API Extractor's analyzer doesn't currently support this construct.

We can improve that.

However, you can also workaround it by substituting WorldCoordinates for typeof result.

I have to ask, though -- WHYYYY would you write it this way? :-P

dej611 commented 4 years ago

Same happens with the leaflet types definition, probably for the same reason: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/leaflet/index.d.ts