json_typegen icon indicating copy to clipboard operation
json_typegen copied to clipboard

Implement `use_type: "tuple"`

Open evestera opened this issue 4 years ago • 0 comments

Currently tuples are only used when all source arrays have the same length and combining the shapes of the array would lose type information. E.g. you can end up with [["a", 1], ["b", 2]] is inferred to Array<[string, number]>, but [[1, 2], [3, 4]] is inferred as number[][].

We already have the hint use_type: "map". We should similarly have use_type: "tuple" and with that make it possible to end up with types like [string, string] and [number, number, number?].

evestera avatar Mar 16 '21 15:03 evestera