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

Type-only imports #39

Open
jackmellis opened this issue May 23, 2022 · 2 comments
Open

Type-only imports #39

jackmellis opened this issue May 23, 2022 · 2 comments

Comments

@jackmellis
Copy link

Hi, we've been using this library to generate our abi type defs and it's pretty great. There are just a couple issues we often come across (and have to fix by hand in every generated file right now).

We're enforcing type-only import syntax (i.e. setting "importsNotUsedAsValues": "error" in our tsconfig) but the generated files just use regular imports which means we get tonnes of errors for the generated files.

error TS1371: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.

  1 import {
    ~~~~~~~~
  2   ContractTransaction,
    ~~~~~~~~~~~~~~~~~~~~~~
...
  6   BigNumberish,
    ~~~~~~~~~~~~~~~
  7 } from 'ethers';
    ~~~~~~~~~~~~~~~~

Would it be easy enough to just change all imports to import type?

@joshstevens19
Copy link
Owner

joshstevens19 commented May 23, 2022

Hey thanks for rasing the issue so your saying you want the import to be like:

  import type {
    ContractTransaction,
    BigNumberish,
  } from 'ethers';

@jackmellis
Copy link
Author

Yep 👍

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

No branches or pull requests

2 participants