You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are cases where TSC decides it's okay to inline import calls.
In most cases, API-Extractor seems to handle these correctly when generating its rollups, but there are some cases where it fails to do so, potentially hoisting relative file path imports as-is into the rollup.
A contrived example
A package contains the following file structure:
src
* index.ts
* Bar.ts
* foo
* Foo.ts
```
Bar.ts
```typescript
export enum Bar {
A = 'A',
}
foo/Foo.ts
exporttypeFoo=import('../Bar').Bar.A;
index.ts
export{Foo}from'./foo/Foo';
TSC generates the following foo/Foo.d.ts:
exporttypeFoo=import('../Bar').Bar.A;
API-Extractor then generates the following (untrimmed) rollup:
exportdeclaretypeFoo=import('../Bar').Bar.A;
Note that the untrimmed rollup file lives one level higher in the directory hierarchy than foo, but it hoisted the ../Bar import unmodified, resulting in an invalid rollup.
There are cases where TSC decides it's okay to inline
import
calls.In most cases, API-Extractor seems to handle these correctly when generating its rollups, but there are some cases where it fails to do so, potentially hoisting relative file path imports as-is into the rollup.
A contrived example
A package contains the following file structure:
foo/Foo.ts
index.ts
TSC generates the following
foo/Foo.d.ts
:API-Extractor then generates the following (untrimmed) rollup:
Note that the untrimmed rollup file lives one level higher in the directory hierarchy than
foo
, but it hoisted the../Bar
import unmodified, resulting in an invalid rollup.The above example has also been captured here: https://github.com/Josmithr/api-extractor-playground/tree/relative-path-import-repro
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: