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.

TypeScript 3.8 "import type" is not supported

See original GitHub issue

Do you want to request a feature or report a bug?

Feature request.

What is the current behavior?

Import type are not recognized by metro’s babel version (it uses 7.8.4 instead of 7.9 which supports them).

image

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

Using npm to install metro-react-native-babel-preset (version: 0.59.0).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
Grohdencommented, May 18, 2020

@WhippetsAintDogs thx for your comment:

it uses 7.8.4 instead of 7.9 which supports them

I was trying to find out on the repo where metro declares this specific babel version, but it seems that it doesn’t.

It uses ^7.0.0, which probably means that any 7.x.y works. So after updating my own package.json with:

    "@babel/core": "7.9.6",
    "@babel/runtime": "7.9.6",

It worked without any problems… till now 🤔

0reactions
WhippetsAintDogscommented, May 18, 2020

@Grohden, you’re right. Regenerating metro’s part in my package-lock fixed it.

Thanks !

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
Do I need to use the "import type" feature of TypeScript 3.8 if ...
Long answer: As TypeScript 3.8 release notes say: import type only imports declarations to be used for type annotations and declarations.
Read more >
Support TypeScript 3.8 type-only imports/exports in resolve ...
@Anton Lobov I want to clarify. This will involve an implementation to allow auto-import using type-only syntax for TS 3.8+? I saw the...
Read more >
Leveraging Type-Only imports and exports with TypeScript 3.8
This new feature of TypeScript added the possibility to import an element only as a type, precisely for cases where a type is...
Read more >
type-only imports — A new TypeScript feature that benefits ...
Example 1 — Ambiguous re-export · Babel removes everything from our types module because it only contained types, which have no use in...
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