-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
Description
Version
2.5.16
Reproduction link
Vue.component('union-prop', {
props: {
anything: null,
primitive: [String, Number],
object: [Cat, User],
regex: RegExp,
mixed: [RegExp, Array],
union: [User, Number] as {new(): User | Number}[] // requires annotation
},
data() {
this.anything;
this.primitive;
this.object;
this.union;
this.regex.compile;
this.mixed;
return {
fixedSize: this.union,
}
}
});
Steps to reproduce
Paste it into options-test.ts
and run yarn test:types
What is expected?
No errors, type should be any
What is actually happening?
Type 'null' is not assignable to type 'PropValidator'
It works with strictNullChecks
disabled, but the type is {}
instead of any