Skip to content
This repository has been archived by the owner on Nov 9, 2019. It is now read-only.

Commit

Permalink
ts 2.5 and flow 0.57
Browse files Browse the repository at this point in the history
  • Loading branch information
Termina1 committed Oct 31, 2017
1 parent 43e1e97 commit 7f45133
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions flow/3.js
@@ -1,7 +1,6 @@
/* @flow */

// almost, exactly the same code as 3.ts,
// but no unsafe cast
// exactly the same code as 3.ts

type Foo = { type: 'foo' , foo: string };
type Bar = { type: 'bar' , bar: string };
Expand All @@ -11,7 +10,6 @@ type MyType = Foo | Bar;

export function test(t: MyType) {
if (t.type === 'foo') {
// no need to keep things in sync manually
// $ExpectError
console.log(t.bar) // error
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"flow-bin": "^0.27.0",
"typescript": "^2.0.0"
"flow-bin": "^0.57.3",
"typescript": "^2.5.0"
}
}
2 changes: 1 addition & 1 deletion ts/3.ts
Expand Up @@ -5,6 +5,6 @@ type MyType = Foo | Bar;

export function test(t: MyType) {
if (t.type === 'foo') {
console.log((<Bar>t).bar) // error, as expected
console.log(t.bar) // error, as expected
}
}

0 comments on commit 7f45133

Please sign in to comment.