KiaraGrouwstra / typical

playground for type-level primitives in TypeScript
MIT License
173 stars 5 forks source link

Tuple spread #21

Closed goodmind closed 6 years ago

goodmind commented 6 years ago

It's possibly to better open TypeScript issue, but since you added tuple length support I ask here.

const func = (x, y) => x + y;
const payload: [number, number] = [1, 2];
payload.length // 2
func(...payload);
// Expected 2 arguments, but got 0 or more.

Is this supposed to error even if we know tuple's length?

KiaraGrouwstra commented 6 years ago

@goodmind: This bug was reported at https://github.com/Microsoft/TypeScript/issues/4130 -- I tried a fix at https://github.com/Microsoft/TypeScript/pull/18004, though it was considered too hacky.

goodmind commented 6 years ago

@tycho01 thanks, subscribed to both