Last active
May 7, 2019 04:53
-
-
Save odiak/deefeeea77592feb011e74d15ffaee6d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function f1(...args: number[] & {0: any}) { | |
| } | |
| f1() // type error! | |
| f1(1) | |
| f1(1, 2, 3) | |
| const a1: number[] = [1, 2, 3] | |
| const a2: number[] = [] | |
| f1(...a1) // type error! (unexpected) | |
| f1(...a2) // type error! | |
| function f2<A extends number[]>(...args: Exclude<A, []>) { | |
| } | |
| f2() // type error! | |
| f2(1) | |
| f2(1, 2, 3) | |
| f2(...a1) | |
| f2(...a2) // NOT type error! (unexpected) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment