-
Notifications
You must be signed in to change notification settings - Fork 640
[api-extractor] Support for import() type #1916
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] Support for import() type #1916
Conversation
d9c7dc9
to
127c9a3
Compare
Sorry for the delay - I will look at this PR soon. |
FYI we recently reformatted the master branch using Prettier, which creates merge conflicts for existing PRs. We'll try to fix up the existing PRs for people, but if you want to do it yourself, here's the steps:
|
d052f14
to
2c7d763
Compare
Done |
ba73107
to
6ed9c43
Compare
This may not work for some regular case, e.g. // node_modules/foo/index.d.ts
export declare class Foo {}
// src/bar.d.ts
export { Foo } from 'foo';
// src/index.d.ts
export declare class A {
prop: import('./bar').Foo;
} In this case, it's not external import (detected here), and not a local symbol (it's defined inside external The result is, declaration // dts-rollup.d.ts
export declare class Foo {}
export declare class A {
prop: Foo;
} This is the similar case that I met when trying to use |
In my implementation adventure-yunfei#4 trying to resolve #2005, I introduced Analyzer always analyze the whole
That may decouple the generator from the analyzer. |
d7c526e
to
d73c4f8
Compare
There are new changes in my branch, but I guess something wrong with github because the changes are not showing up in this pull request. My branch has sha1 @adventure-yunfei, I like your plans for decoupling the analyzer from the generator. Now I've implemented a new Symbols now are resolved recursively, checking at each iteration if they proceed from an external module. I've replicated your example in |
0350dd7
to
829600a
Compare
...s/api-extractor-scenarios/etc/test-outputs/dynamicImportType3/api-extractor-scenarios.api.md
Outdated
Show resolved
Hide resolved
d3a312e
to
51e3fcc
Compare
a558cb7
to
e2a2d08
Compare
@JamesBurnside, I have investigated the problem that you encountered and I believe it should be solved with the commit that I just pushed. The problem is that the modified ImportType is missing the separator after. First I tried removing Finally, I made another change. Now DtsEmitHelpers has a function to modify ImportType that is shared between api report and dts generators. |
Just tested this in my repo and yep this fixed the spacing issue! |
…_support_simplicity # Conflicts: # apps/api-extractor/src/analyzer/AstImport.ts # build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml
…_support_simplicity # Conflicts: # common/config/rush/pnpm-lock.yaml # common/config/rush/repo-state.json
I have resolved the conflicts from PR 1796. I want to read over the code once more before we merge this, but overall this looks to be in good shape. 👍 |
@octogonz what do you think? Can we get a 🚢 ? 🙏 |
…_support_simplicity # Conflicts: # apps/api-extractor/src/generators/DtsEmitHelpers.ts
…ntifier() with more robust logic
🎈Released with API Extractor 7.18.0 |
@javier-garcia-meteologica thanks again for contributing this difficult feature! I am so happy to finally be getting through the backlog of AE PRs -- it's been keeping me awake at night for the past year. 😁 |
Provides a solution for #1050.
Transforms
into
It also contains a workaround for jsdom/jsdom#2304EDIT: The jest issue went away after doing a git rebase