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

TypeScript import type and node/no-extraneous-import #324

Open
Toilal opened this issue Feb 27, 2022 · 1 comment
Open

TypeScript import type and node/no-extraneous-import #324

Toilal opened this issue Feb 27, 2022 · 1 comment

Comments

@Toilal
Copy link

Toilal commented Feb 27, 2022

It seems node/no-extraneous-import should not report when using TypeScript import type ....

import type is used for compilation only, so there's no risk at all to hit runtime errors because of unavailable dependency.

@fasttime
Copy link

fasttime commented Apr 4, 2022

Note that if you are shipping a package with .d.ts type definition files, then imported types may be necessary for your type declarations to work. This is why many packages with native type definition files have dependencies (not devDependencies) on other type-only packages. For example, Jest has a runtime dependency on @types/node (link). So ultimately, type definition files can only be omitted as dependencies if they are used exclusively in sources that are transpiled (and not included in the build).

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