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
|
// #7553
|
||||||
test('union type', () => {
|
test('union type', () => {
|
||||||
expect(
|
expect(
|
||||||
|
|
|
@ -1515,6 +1515,13 @@ export function inferRuntimeType(
|
||||||
isKeyOf = false,
|
isKeyOf = false,
|
||||||
typeParameters?: Record<string, Node>,
|
typeParameters?: Record<string, Node>,
|
||||||
): string[] {
|
): string[] {
|
||||||
|
if (
|
||||||
|
node.leadingComments &&
|
||||||
|
node.leadingComments.some(c => c.value.includes('@vue-ignore'))
|
||||||
|
) {
|
||||||
|
return [UNKNOWN_TYPE]
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
case 'TSStringKeyword':
|
case 'TSStringKeyword':
|
||||||
|
|
Loading…
Reference in New Issue