mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): add support for @vue-ignore in runtime type resolution (#13906)
This commit is contained in:
parent
5358bca4a8
commit
ba7f7f90f6
|
@ -149,6 +149,17 @@ describe('resolveType', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('TSPropertySignature with ignore', () => {
|
||||
expect(
|
||||
resolve(`
|
||||
type Foo = string
|
||||
defineProps<{ foo: /* @vue-ignore */ Foo }>()
|
||||
`).props,
|
||||
).toStrictEqual({
|
||||
foo: ['Unknown'],
|
||||
})
|
||||
})
|
||||
|
||||
// #7553
|
||||
test('union type', () => {
|
||||
expect(
|
||||
|
|
|
@ -1515,6 +1515,13 @@ export function inferRuntimeType(
|
|||
isKeyOf = false,
|
||||
typeParameters?: Record<string, Node>,
|
||||
): string[] {
|
||||
if (
|
||||
node.leadingComments &&
|
||||
node.leadingComments.some(c => c.value.includes('@vue-ignore'))
|
||||
) {
|
||||
return [UNKNOWN_TYPE]
|
||||
}
|
||||
|
||||
try {
|
||||
switch (node.type) {
|
||||
case 'TSStringKeyword':
|
||||
|
|
Loading…
Reference in New Issue