Skip to content

Commit 7f1a598

Browse files
committed
Add test to make sure the rule works in .ts files
1 parent ae790c6 commit 7f1a598

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/lib/rules/require-typed-object-prop.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,44 @@ ruleTester.run('require-typed-object-prop', rule, {
583583
]
584584
}
585585
]
586+
},
587+
{
588+
// `.ts` file
589+
filename: 'test.ts',
590+
code: `
591+
export default Vue.extend({
592+
props: { foo: Object }
593+
});
594+
`,
595+
errors: [
596+
{
597+
messageId: 'expectedTypeAnnotation',
598+
line: 3,
599+
column: 23,
600+
endLine: 3,
601+
endColumn: 29,
602+
suggestions: [
603+
{
604+
messageId: 'addTypeAnnotation',
605+
data: { type: 'any' },
606+
output: `
607+
export default Vue.extend({
608+
props: { foo: Object as PropType<any> }
609+
});
610+
`
611+
},
612+
{
613+
messageId: 'addTypeAnnotation',
614+
data: { type: 'unknown' },
615+
output: `
616+
export default Vue.extend({
617+
props: { foo: Object as PropType<unknown> }
618+
});
619+
`
620+
}
621+
]
622+
}
623+
]
586624
}
587625
]
588626
})

0 commit comments

Comments
 (0)