Last active
July 28, 2018 10:18
-
-
Save Bannerets/f3ad3ebc12840dc3f444938b4b7d9472 to your computer and use it in GitHub Desktop.
flow wtf #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ignore] | |
[include] | |
[libs] | |
[lints] | |
[options] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
// file1.js | |
export type Inc<N> = $Call< | |
& (0 => 1) | |
& (1 => 2) | |
& (2 => 3) | |
& (3 => 4), N> | |
export type Dec<N> = $Call< | |
& (1 => 0) | |
& (2 => 1) | |
& (3 => 2) | |
& (4 => 3), N> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
// file2.js | |
import type { Inc, Dec } from './file1' | |
type A = Inc<Inc<0>> | |
;(2: A) // 2, correct | |
type B = Dec<A> | |
;(1: B) // error? | |
;(0: B) // no error. 0? wtf? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment