Skip to content

Commit 76f5a75

Browse files
committed
Final cleanup before posting as a proposal
1 parent a8bd31c commit 76f5a75

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pages/Tuple Kinds.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,19 @@ rotate<[boolean, boolean, string], [string, number]>([true, true, 'none', 12', '
230230
This function can be typed, but there is a dependency between `n` and the kind variables: `n === ...T.length` must be true for the type to be correct.
231231
I'm not sure whether this is code that should actually be allowed.
232232
233-
### Empty tuple types
234-
235-
Typescript does not allow users to write an empty tuple type.
236-
However, this proposal requires variadic kinds to be bindable to a empty tuple.
237-
So Typescript will need to support empty tuples, even if only internally.
233+
### Extensions to the other parts of typescript
234+
235+
1. Typescript does not allow users to write an empty tuple type.
236+
However, this proposal requires variadic kinds to be bindable to a empty tuple.
237+
So Typescript will need to support empty tuples, even if only internally.
238+
2. The type of rest parameters can currently only be an array.
239+
This proposal requires that it can also be a tuple.
240+
3. Functions with rest parameters of type tuple must be assignable to fixed-length functions with the same number of parameters as the rest parameter. For example:
241+
242+
```ts
243+
let f: (x: string, y: number) => number = (...tuple: [string, number]) => 12;
244+
let g: (...tuple: [string, number]) => number = (x,y) => 12;
245+
```
238246
239247
### Semantics on classes and interfaces
240248

0 commit comments

Comments
 (0)