dethcrypto / dethcrypto/TypeChain

Missing 'type' in some imports, causing issues with Sveltekit compiler configuration

Open
#732 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.8k
Forks
376
PR merge metrics
No merged PRs in 30d

Description

When trying to use the generated code for contract factories, in combination with SvelteKit, the following error appears:

'Overrides' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled. ts(1444).

On the following line (of a Dummy__factory.ts file):

`import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers";`

Which can be solved by adding "type" to "Overrides":

`import { Signer, utils, Contract, ContractFactory, type Overrides } from "ethers";`

The default configuration in SvelteKit indeed activates both isolatedModules and preserveValueImports in its tsconfig.json "compilerOptions", see: https://kit.svelte.dev/docs/types#generated-types-default-tsconfig-json

If there is no impact/downsides to using type-only import, implementing the suggestion above would make the experience better for Svelte-kit projects.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.