This repo is a minimalist testcase reproducing a bug with TypeScript's type inference for tuples: microsoft/TypeScript#32761
The bug doesn't happen on the TypeScript playground, only with actual files.
To reproduce, run:
node_modules/.bin/tsc --lib esnext hello.ts
Observed: error TS2345: Argument of type '(string | number)[][]' is not assignable to parameter of type 'Iterable<[string | number, string | number]>'.
Expected: x
is inferred to be of type MyOrderedMap<number, string>
, just
like happens on the TypeScript playground, e.g. go to this URL and try
hovering over the x
:
I have reproduced this with TypeScript versions:
- 3.5.1, which is what the Playground reports it's running
- 3.5.3, which is
typescript@latest
as of this writing - 3.6.0-beta, which is
typescript@beta
as of this writing - 3.6.0-dev.20190808, which is
typescript@next
as of this writing