Skip to content

Commit

Permalink
Also type casts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 16, 2021
1 parent 95c0689 commit dd82738
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
Expand Up @@ -49,6 +49,7 @@ function isInType(path) {
switch (path.parent.type) {
case "TSTypeAnnotation":
case "TSTypeAliasDeclaration":
case "TSTypeReference":
case "TypeAnnotation":
case "TypeAlias":
return true;
Expand Down
@@ -0,0 +1,3 @@
import { A } from "x";

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

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

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

0 comments on commit dd82738

Please sign in to comment.