question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enforce import type for type imports

See original GitHub issue

For the next major, we should enforce using the new import type feature of TypeScript to import types everywhere. This will let babel drop import statements when only types are used from a file and result in smaller file size/better tree shaking.

To do this, we can add "importsNotUsedAsValues": "error" in the tsconfig.json and then fix all of the type errors (it’d be just changing import to import type).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
satya164commented, Jun 29, 2020

@BatDroid try updating @babel/core and metro-react-native-babel-preset as well, and if it doesn’t work, try deleting yarn.lock entirely.

2reactions
satya164commented, Jun 26, 2020

Feel free

Read more comments on GitHub >

github_iconTop Results From Across the Web

consistent-type-imports | typescript-eslint
TypeScript allows specifying a type keyword on imports to indicate that the export exists only in the type system, not at runtime.
Read more >
typescript-eslint/consistent-type-imports.md at main - GitHub
TypeScript allows specifying a type keyword on imports to indicate that the export exists only in the type system, not at runtime.
Read more >
eslint - Is there a way to automatically fix `import type` errors ...
As the project grew, I decided it is a good idea in terms of optimization to enforce import type when an import is...
Read more >
Documentation - TypeScript 3.8
import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there's no remnant of...
Read more >
Enforce @typescript-eslint/consistent-type-imports - Tuleap
Starting from TypeScript 3.8, new syntax import type and export type have been added. TypeScript analyses types for "the whole project" at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found