chore: replace some type casts and fix variable and filename typos (#93)
This commit is contained in:
committed by
Evan You
parent
23ff681418
commit
fbabae0c0a
@@ -39,7 +39,7 @@ export type DirectiveTransform = (
|
||||
needRuntime: boolean
|
||||
}
|
||||
|
||||
// A structural directive transform is a techically a NodeTransform;
|
||||
// A structural directive transform is a technically a NodeTransform;
|
||||
// Only v-if and v-for fall into this category.
|
||||
export type StructuralDirectiveTransform = (
|
||||
node: ElementNode,
|
||||
@@ -191,11 +191,11 @@ function createTransformContext(
|
||||
if (identifiers[id] === undefined) {
|
||||
identifiers[id] = 0
|
||||
}
|
||||
;(identifiers[id] as number)++
|
||||
identifiers[id]!++
|
||||
}
|
||||
|
||||
function removeId(id: string) {
|
||||
;(context.identifiers[id] as number)--
|
||||
context.identifiers[id]!--
|
||||
}
|
||||
|
||||
return context
|
||||
|
||||
@@ -191,7 +191,7 @@ export function buildProps(
|
||||
let hasDynamicKeys = false
|
||||
const dynamicPropNames: string[] = []
|
||||
|
||||
const anaylizePatchFlag = ({ key, value }: Property) => {
|
||||
const analyzePatchFlag = ({ key, value }: Property) => {
|
||||
if (key.type === NodeTypes.SIMPLE_EXPRESSION && key.isStatic) {
|
||||
if (value.type !== NodeTypes.SIMPLE_EXPRESSION || !value.isStatic) {
|
||||
const name = key.content
|
||||
@@ -288,10 +288,10 @@ export function buildProps(
|
||||
const { props, needRuntime } = directiveTransform(prop, context)
|
||||
if (isArray(props)) {
|
||||
properties.push(...props)
|
||||
properties.forEach(anaylizePatchFlag)
|
||||
properties.forEach(analyzePatchFlag)
|
||||
} else {
|
||||
properties.push(props)
|
||||
anaylizePatchFlag(props)
|
||||
analyzePatchFlag(props)
|
||||
}
|
||||
if (needRuntime) {
|
||||
runtimeDirectives.push(prop)
|
||||
|
||||
@@ -76,7 +76,7 @@ export const transformIf = createStructuralDirectiveTransform(
|
||||
// locate the adjacent v-if
|
||||
const siblings = context.parent!.children
|
||||
const comments = []
|
||||
let i = siblings.indexOf(node as any)
|
||||
let i = siblings.indexOf(node)
|
||||
while (i-- >= -1) {
|
||||
const sibling = siblings[i]
|
||||
if (__DEV__ && sibling && sibling.type === NodeTypes.COMMENT) {
|
||||
|
||||
Reference in New Issue
Block a user