From da9550ee063e1e21c956f60c889effef6f589e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sat, 25 May 2024 14:37:06 +0800 Subject: [PATCH] fix type --- packages/babel-plugin-jsx/src/utils.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/babel-plugin-jsx/src/utils.ts b/packages/babel-plugin-jsx/src/utils.ts index 6e1d24d..704ed69 100644 --- a/packages/babel-plugin-jsx/src/utils.ts +++ b/packages/babel-plugin-jsx/src/utils.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import htmlTags from 'html-tags'; +import htmlTags, { type HtmlTags } from 'html-tags'; import svgTags from 'svg-tags'; import { type NodePath } from '@babel/traverse'; import type { State } from './interface'; @@ -60,7 +60,7 @@ export const checkIsComponent = ( return ( !state.opts.isCustomElement?.(tag) && shouldTransformedToSlots(tag) && - !htmlTags.includes(tag as htmlTags.htmlTags) && + !htmlTags.includes(tag as HtmlTags) && !svgTags.includes(tag) ); }; @@ -99,10 +99,7 @@ export const getTag = ( const namePath = path.get('openingElement').get('name'); if (namePath.isJSXIdentifier()) { const { name } = namePath.node; - if ( - !htmlTags.includes(name as htmlTags.htmlTags) && - !svgTags.includes(name) - ) { + if (!htmlTags.includes(name as HtmlTags) && !svgTags.includes(name)) { return name === FRAGMENT ? createIdentifier(state, FRAGMENT) : path.scope.hasBinding(name)