From c20506e5949b52f905899edab627baca333b5a0a Mon Sep 17 00:00:00 2001 From: Peach Date: Sun, 31 Oct 2021 01:54:42 +0800 Subject: [PATCH] Fix binding access for plugin-transform-typescript (#13900) --- packages/babel-plugin-transform-typescript/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/babel-plugin-transform-typescript/src/index.ts b/packages/babel-plugin-transform-typescript/src/index.ts index 2975ae471c3c..81fdf21a1704 100644 --- a/packages/babel-plugin-transform-typescript/src/index.ts +++ b/packages/babel-plugin-transform-typescript/src/index.ts @@ -305,9 +305,8 @@ export default declare((api: ConfigAPI, opts: Options): Plugin => { // just bail if there is no binding, since chances are good that if // the import statement was injected then it wasn't a typescript type // import anyway. - if (!importsToRemove.has(binding.path)) { + if (binding && !importsToRemove.has(binding.path)) { if ( - binding && isImportTypeOnly({ binding, programPath: path,