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] d.ts Rollup incorrectly removes "as" from imports, which can cause errors #3645

Open
bdwain opened this issue Sep 25, 2022 · 0 comments

Comments

@bdwain
Copy link

bdwain commented Sep 25, 2022

API Extractor's d.ts rollup removes the "as" from imports and renames the references to those imports, but this can cause issues, such as when those types are used in generics.

Repro steps

If I have something in my code like

import { Action as ReduxAction } from 'redux'

interface Foo<Action extends ReduxAction> {...}

api extractor's d.ts rollup will change it to

import { Action } from 'redux'

interface Foo<Action extends Action> {...}

which is a typescript error

 error TS2313: Type parameter 'Action' has a circular constraint.

Details

I would expect it to either leave the imports named as they are (and if there are duplicates of those imports, oh well), or to find a common name for all of them that does not cause issues (which seems more difficult)

Standard questions

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

Question Answer
@microsoft/api-extractor version? 7.31.2
Operating system? Mac
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? No
TypeScript compiler version? "Analysis will use the bundled TypeScript version 4.7.4"
Node.js version (node -v)? 14.18.1
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