Skip to content

Commit

Permalink
union-interface-test: Improve typings (#2660)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 16, 2020
1 parent 0a18798 commit df96f2a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/execution/__tests__/union-interface-test.js
Expand Up @@ -21,41 +21,41 @@ import { execute } from '../execute';
class Dog {
name: string;
barks: boolean;
mother: Dog | null;
father: Dog | null;
mother: Dog | void;
father: Dog | void;
progeny: Array<Dog>;

constructor(name: string, barks: boolean) {
this.name = name;
this.barks = barks;
this.mother = null;
this.father = null;
this.progeny = [];
}
}

class Cat {
name: string;
meows: boolean;
mother: ?Cat;
father: ?Cat;
mother: Cat | void;
father: Cat | void;
progeny: Array<Cat>;

constructor(name, meows) {
constructor(name: string, meows: boolean) {
this.name = name;
this.meows = meows;
this.mother = null;
this.father = null;
this.progeny = [];
}
}

class Person {
name: string;
pets: ?Array<Dog | Cat>;
friends: ?Array<Dog | Cat | Person>;

constructor(name, pets, friends) {
pets: Array<Dog | Cat> | void;
friends: Array<Dog | Cat | Person> | void;

constructor(
name: string,
pets?: Array<Dog | Cat>,
friends?: Array<Dog | Cat | Person> | void,
) {
this.name = name;
this.pets = pets;
this.friends = friends;
Expand Down

0 comments on commit df96f2a

Please sign in to comment.