mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): support @vue-ignore comment on more type sources
This commit is contained in:
parent
a476692ed2
commit
a23e99bedf
|
@ -137,6 +137,18 @@ describe('resolveType', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('intersection type with ignore', () => {
|
||||||
|
expect(
|
||||||
|
resolve(`
|
||||||
|
type Foo = { foo: number }
|
||||||
|
type Bar = { bar: string }
|
||||||
|
defineProps<Foo & /* @vue-ignore */ Bar>()
|
||||||
|
`).props,
|
||||||
|
).toStrictEqual({
|
||||||
|
foo: ['Number'],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// #7553
|
// #7553
|
||||||
test('union type', () => {
|
test('union type', () => {
|
||||||
expect(
|
expect(
|
||||||
|
|
|
@ -165,6 +165,12 @@ function innerResolveTypeElements(
|
||||||
scope: TypeScope,
|
scope: TypeScope,
|
||||||
typeParameters?: Record<string, Node>,
|
typeParameters?: Record<string, Node>,
|
||||||
): ResolvedElements {
|
): ResolvedElements {
|
||||||
|
if (
|
||||||
|
node.leadingComments &&
|
||||||
|
node.leadingComments.some(c => c.value.includes('@vue-ignore'))
|
||||||
|
) {
|
||||||
|
return { props: {} }
|
||||||
|
}
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
case 'TSTypeLiteral':
|
case 'TSTypeLiteral':
|
||||||
return typeElementsToMap(ctx, node.members, scope, typeParameters)
|
return typeElementsToMap(ctx, node.members, scope, typeParameters)
|
||||||
|
@ -414,12 +420,6 @@ function resolveInterfaceMembers(
|
||||||
)
|
)
|
||||||
if (node.extends) {
|
if (node.extends) {
|
||||||
for (const ext of node.extends) {
|
for (const ext of node.extends) {
|
||||||
if (
|
|
||||||
ext.leadingComments &&
|
|
||||||
ext.leadingComments.some(c => c.value.includes('@vue-ignore'))
|
|
||||||
) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const { props, calls } = resolveTypeElements(ctx, ext, scope)
|
const { props, calls } = resolveTypeElements(ctx, ext, scope)
|
||||||
for (const key in props) {
|
for (const key in props) {
|
||||||
|
|
Loading…
Reference in New Issue