Skip to content

Commit

Permalink
Skip v-slot check to avoid false-positive error
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsn committed Apr 13, 2019
1 parent f428765 commit 2923e08
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server/src/modes/script/transformTemplate.ts
Expand Up @@ -143,11 +143,16 @@ export function getTemplateTransformFunctions(ts: T_TypeScript) {
return;
}

// Skip v-for directive
// Skip v-for directive (handled in `transformElement`)
if (isVFor(attr)) {
return;
}

// Skip v-slot and scope-slot for now
if (isVSlot(attr)) {
return;
}

// Other directives
const exp = transformDirective(attr, code, scope);
if (exp) {
Expand Down Expand Up @@ -523,6 +528,10 @@ export function getTemplateTransformFunctions(ts: T_TypeScript) {
return node.directive && node.key.name.name === 'for';
}

function isVSlot(node: AST.VAttribute | AST.VDirective): node is AST.VDirective {
return node.directive && (node.key.name.name === 'slot' || node.key.name.name === 'slot-scope');
}

function flatMap<T extends ts.Node, R>(list: ReadonlyArray<T>, fn: (value: T) => R[]): R[] {
return list.reduce<R[]>((acc, item) => {
return acc.concat(fn(item));
Expand Down

0 comments on commit 2923e08

Please sign in to comment.