Throw a better error when transforming imported bindings in types (#13739)

* Throw a better error when transforming imported bindings in types

* Also type casts

* Update error message
This commit is contained in:
Nicolò Ribaudo
2021-09-16 23:14:41 +02:00
committed by GitHub
parent 2ffb19828f
commit 8fb50429ea
15 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import A from "x";
export function fn(x: A.b[2]) {
return A.method(x);
}

View File

@@ -0,0 +1,6 @@
{
"externalHelpers": true,
"sourceType": "module",
"plugins": ["transform-modules-commonjs", "syntax-flow"],
"throws": "Cannot transform the imported binding \"A\" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow."
}