Skip to content

Commit

Permalink
test: separate failing test for TS 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 25, 2019
1 parent a9a3030 commit ea113d2
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions types/test/options-test.ts
Expand Up @@ -76,28 +76,36 @@ Vue.component('union-prop', {
complexUnion: { type: [User, Number] as PropType<User | number> },
kittyUser: Object as PropType<ICat & IUser>,
callback: Function as PropType<ConfirmCallback>,
mixed: [RegExp, Array],
object: [Cat, User],
primitive: [String, Number],
regex: RegExp,
union: [User, Number] as PropType<User | number>
},
data() {
this.cat;
this.complexUnion;
this.kittyUser;
this.callback(true);
this.mixed;
this.object;
this.primitive;
this.regex.compile;
this.union;
return {
fixedSize: this.union,
}
}
});

// stopped working since TS 3.4
// Vue.component('union-prop-with-no-casting', {
// props: {
// mixed: [RegExp, Array],
// object: [Cat, User],
// primitive: [String, Number],
// regex: RegExp
// },
// data() {
// this.mixed;
// this.object;
// this.primitive;
// this.regex.compile;
// }
// })

Vue.component('prop-with-primitive-default', {
props: {
id: {
Expand Down

3 comments on commit ea113d2

@yyx990803
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @HerringtonDarkholme @DanielRosenwasser @ktsn

another regression since TS 3.4 - union props without explicit annotation breaks this inference.

@HerringtonDarkholme
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have noticed this but failed to find a solution. Commenting out is good enough for now.

@ktsn
Copy link
Member

@ktsn ktsn commented on ea113d2 Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyx990803 Sorry, totally forgot this one. I just found a solution. #10779

Please sign in to comment.