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] ERROR: Failed to fetch entity for import() type node: import("../_namespaces/ts").PrivateIdentifier #3612

Open
jakebailey opened this issue Sep 2, 2022 · 3 comments

Comments

@jakebailey
Copy link
Member

Summary

I am in the final stages of converting TypeScript itself into modules (from its current state as giant namespaces). To reproduce something similar to our current d.ts files, I am running api-extractor on our d.ts files to try and roll things up.

Repro steps

  1. Clone https://github.com/jakebailey/TypeScript/tree/typeformer-2
  2. npm ci and run npx gulp moduleBuild
  3. Run npx @microsoft/api-extractor run --local --config ./src/typescript/api-extractor.json --diagnostics

Expected result: Not crash, and hopefully a nice d.ts file

Actual result: ERROR: Failed to fetch entity for import() type node: import("../_namespaces/ts").PrivateIdentifier

Coming from here:

if (!referencedAstEntity) {
// This should never happen
throw new Error('Failed to fetch entity for import() type node: ' + importTypeNode.getText());
}

(I'm afraid even though it should never happen, it does happen. 😢 )

Note that I force push over that branch frequently, as it is auto-generated using a big script that converts the codebase.

Details

I honestly don't know enough about api-extractor to know what's going wrong here.

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.30.0
Operating system? inux
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? Yes / No
TypeScript compiler version? 4.7.4
Node.js version (node -v)? 14.20.0
@jakebailey
Copy link
Member Author

I'm currently investigating why we are even emitting these import nodes in the first place; most things can be imported normally, but sometimes we don't for some reason.

@jakebailey
Copy link
Member Author

I hand replaced all of the weird import nodes, which got me further, but to another error:

ERROR: Internal Error: Unable to follow symbol for "ModifierSyntaxKind"
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

@jakebailey
Copy link
Member Author

jakebailey commented Sep 3, 2022

Ah, no, the previous comment is my error incurred by hand-replacing things (a little too annoying to script). It wasn't imported properly, though it's an odd error given it is an internal error rather than something else. It seems like these import nodes are the main problem.

It did in fact finish running after fixing my oops, which is a great sign! I'll have to check to see how the output looks; very exciting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

No branches or pull requests

1 participant