mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-03-15 15:05:18 +08:00
fix type
This commit is contained in:
parent
68dfcdd598
commit
da9550ee06
@ -1,5 +1,5 @@
|
|||||||
import * as t from '@babel/types';
|
import * as t from '@babel/types';
|
||||||
import htmlTags from 'html-tags';
|
import htmlTags, { type HtmlTags } from 'html-tags';
|
||||||
import svgTags from 'svg-tags';
|
import svgTags from 'svg-tags';
|
||||||
import { type NodePath } from '@babel/traverse';
|
import { type NodePath } from '@babel/traverse';
|
||||||
import type { State } from './interface';
|
import type { State } from './interface';
|
||||||
@ -60,7 +60,7 @@ export const checkIsComponent = (
|
|||||||
return (
|
return (
|
||||||
!state.opts.isCustomElement?.(tag) &&
|
!state.opts.isCustomElement?.(tag) &&
|
||||||
shouldTransformedToSlots(tag) &&
|
shouldTransformedToSlots(tag) &&
|
||||||
!htmlTags.includes(tag as htmlTags.htmlTags) &&
|
!htmlTags.includes(tag as HtmlTags) &&
|
||||||
!svgTags.includes(tag)
|
!svgTags.includes(tag)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -99,10 +99,7 @@ export const getTag = (
|
|||||||
const namePath = path.get('openingElement').get('name');
|
const namePath = path.get('openingElement').get('name');
|
||||||
if (namePath.isJSXIdentifier()) {
|
if (namePath.isJSXIdentifier()) {
|
||||||
const { name } = namePath.node;
|
const { name } = namePath.node;
|
||||||
if (
|
if (!htmlTags.includes(name as HtmlTags) && !svgTags.includes(name)) {
|
||||||
!htmlTags.includes(name as htmlTags.htmlTags) &&
|
|
||||||
!svgTags.includes(name)
|
|
||||||
) {
|
|
||||||
return name === FRAGMENT
|
return name === FRAGMENT
|
||||||
? createIdentifier(state, FRAGMENT)
|
? createIdentifier(state, FRAGMENT)
|
||||||
: path.scope.hasBinding(name)
|
: path.scope.hasBinding(name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user