diff --git a/packages/babel-plugin-jsx/src/buildProps.ts b/packages/babel-plugin-jsx/src/buildProps.ts index 59f5087..e10970d 100644 --- a/packages/babel-plugin-jsx/src/buildProps.ts +++ b/packages/babel-plugin-jsx/src/buildProps.ts @@ -125,7 +125,7 @@ const buildProps = (path: NodePath, state: State) => { const isComponent = checkIsComponent(path.get('openingElement')); const props = path.get('openingElement').get('attributes'); const directives: t.ArrayExpression[] = []; - const dynamicPropNames = new Set(); + const dynamicPropNames = new Set(); let slots: Slots = null; let patchFlag = 0; @@ -225,8 +225,7 @@ const buildProps = (path: NodePath, state: State) => { // must be v-model and is a component properties.push(t.objectProperty( arg || t.stringLiteral('modelValue'), - // @ts-ignore - value, + value as any, )); dynamicPropNames.add(propName); @@ -263,8 +262,7 @@ const buildProps = (path: NodePath, state: State) => { t.stringLiteral(`onUpdate:${propName}`), t.arrowFunctionExpression( [t.identifier('$event')], - // @ts-ignore - t.assignmentExpression('=', value, t.identifier('$event')), + t.assignmentExpression('=', value as any, t.identifier('$event')), ), )); diff --git a/packages/babel-plugin-jsx/src/parseDirectives.ts b/packages/babel-plugin-jsx/src/parseDirectives.ts index 004412f..df7cd91 100644 --- a/packages/babel-plugin-jsx/src/parseDirectives.ts +++ b/packages/babel-plugin-jsx/src/parseDirectives.ts @@ -27,7 +27,7 @@ const getType = (path: NodePath) => { const parseModifiers = (value: t.Expression) => { let modifiers: string[] = []; if (t.isArrayExpression(value)) { - modifiers = (value as t.ArrayExpression).elements + modifiers = value.elements .map((el) => (t.isStringLiteral(el) ? el.value : '')).filter(Boolean); } return modifiers; @@ -61,7 +61,7 @@ const parseDirectives = (args: { || (directiveName === 'model' && !isComponent); if (t.isArrayExpression(value)) { - const { elements } = value as t.ArrayExpression; + const { elements } = value; const [first, second, third] = elements; if (t.isStringLiteral(second)) { arg = second; @@ -86,7 +86,7 @@ const parseDirectives = (args: { !!modifiersSet.size && t.objectExpression( [...modifiersSet].map( (modifier) => t.objectProperty( - t.identifier(modifier as string), + t.identifier(modifier), t.booleanLiteral(true), ), ), diff --git a/packages/babel-plugin-jsx/src/transform-vue-jsx.ts b/packages/babel-plugin-jsx/src/transform-vue-jsx.ts index fba592c..527b9fe 100644 --- a/packages/babel-plugin-jsx/src/transform-vue-jsx.ts +++ b/packages/babel-plugin-jsx/src/transform-vue-jsx.ts @@ -39,7 +39,7 @@ const getChildren = ( const expression = transformJSXExpressionContainer(path); if (t.isIdentifier(expression)) { - const { name } = expression as t.Identifier; + const { name } = expression; const { referencePaths = [] } = path.scope.getBinding(name) || {}; referencePaths.forEach((referencePath) => { walksScope(referencePath, name, SlotFlags.DYNAMIC); @@ -109,7 +109,7 @@ const transformJSXElement = ( !!patchFlag && optimize && t.numericLiteral(patchFlag), !!dynamicPropNames.size && optimize && t.arrayExpression( - [...dynamicPropNames.keys()].map((name) => t.stringLiteral(name as string)), + [...dynamicPropNames.keys()].map((name) => t.stringLiteral(name)), ), ].filter(Boolean as any)); diff --git a/packages/babel-plugin-jsx/src/utils.ts b/packages/babel-plugin-jsx/src/utils.ts index 78461e6..4424c7e 100644 --- a/packages/babel-plugin-jsx/src/utils.ts +++ b/packages/babel-plugin-jsx/src/utils.ts @@ -187,8 +187,9 @@ const transformJSXText = (path: NodePath): t.StringLiteral | null => */ const transformJSXExpressionContainer = ( path: NodePath, -): (t.Expression - ) => path.get('expression').node as t.Expression; +): ( + t.Expression +) => path.get('expression').node as t.Expression; /** * Transform JSXSpreadChild