TypeChain
                                
                                 TypeChain copied to clipboard
                                
                                    TypeChain copied to clipboard
                            
                            
                            
                        Missing 'type' in some imports, causing issues with Sveltekit compiler configuration
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.
Just found a similar issue : https://github.com/dethcrypto/TypeChain/pull/636
I'm on typechain 8.1.0 and @typechain/ethers-v5 10.1.0, and since I see other imports using "import type", maybe something changed in ethers library, where "Overrides" became a type? I'm currently on ethers version 5.6.8.
Update: It appears that only "Factory" generated files suffer from the issue, so it makes me think something could've been accidentally left out / forgotten in #636 refactoring.
I inspected some other files and also "BigNumberish" is sometimes included without the "type" specification. Otherwise the other generated files look fine.