Skip to content

Commit

Permalink
add tests for different issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ville Saukkonen committed Dec 26, 2018
1 parent 84fa03c commit ec5199f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/friendly_errors/issue_7210.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @flow
type Foo = {| +foo: ?string |};
const test = (bar: Foo): Foo => ({ foo: 'foo', ...bar});
9 changes: 9 additions & 0 deletions tests/friendly_errors/issue_7242.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @flow

type Ob = {|+foo: {| +bar: string |}|};
declare var update: Ob;
({ foo: { bar: 'valid' }, ...update }: Ob); // Ok

type NestedOb = {|+foo: {| +bar: {| +foo: number |} |}|};
declare var update2: NestedOb;
({ foo: { bar: { foo: 123 } }, ...update2 }: NestedOb); // Ok
Empty file.
1 change: 1 addition & 0 deletions tests/inexact-object-spread/inexact-object-spread.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Found 0 errors
15 changes: 15 additions & 0 deletions tests/inexact-object-spread/issue_6751.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* @flow */

type A = { foo: ?string };

function foo(a: A) {
}

const a: A = { foo: 'foo' };
const b = { foo: 'foo' };

foo({ ...a, foo: 'foo' }); // OK
foo({ foo: 'foo', ...a }); // OK

foo({ ...b, foo: 'foo' }); // OK
foo({ foo: 'foo', ...b }); // OK
11 changes: 11 additions & 0 deletions tests/spread/issue_6108.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @flow

type A = {
a: number
};

type B = {
a: string
};

const testFn = (input: A): B => ({...input, a: 'uh oh :/'});

0 comments on commit ec5199f

Please sign in to comment.