Skip to content

Commit 058de13

Browse files
committed
fix(typescript-plugin): filter out builtin directives starting with lowercase v
1 parent 2ccb444 commit 058de13

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/typescript-plugin/lib/requests/getComponentDirectives.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { VueVirtualCode } from '@vue/language-core';
22
import type { RequestContext } from './types';
33
import { getVariableType } from './utils';
44

5+
const builtInDirectives = new Set([
6+
'vBind',
7+
'vIf',
8+
'vOn',
9+
'vOnce',
10+
'vShow',
11+
'vSlot',
12+
]);
13+
514
export function getComponentDirectives(
615
this: RequestContext,
716
fileName: string
@@ -20,5 +29,5 @@ export function getComponentDirectives(
2029
return directives.type.getProperties()
2130
.map(({ name }) => name)
2231
.filter(name => name.startsWith('v') && name.length >= 2 && name[1] === name[1].toUpperCase())
23-
.filter(name => !['vBind', 'vIf', 'vOn', 'VOnce', 'vShow', 'VSlot'].includes(name));
32+
.filter(name => !builtInDirectives.has(name));
2433
}

0 commit comments

Comments
 (0)