Open SamCB-CT opened 1 year ago
Based on the current definition:
function toPairs<T, K extends string | number>(dict: Record<K, T>): Array<readonly [string, T]>
The first element in each pair is a string but it should use the generic type K. For example:
string
K
type Keys = 'foo' | 'bar' | 'baz'; const input: Record<Keys, number> = {foo: 42, bar: 0, baz: -1}; const output = D.toPairs(input);
The definition for output in the .d.ts becomes:
output
.d.ts
declare const output: (readonly [string, number])[];
But I'd expect it to be:
declare const output: (readonly [Keys, number])[];
Typescript Playground Example
By updating the definition to:
function toPairs<T, K extends string | number>(dict: Record<K, T>): Array<readonly [K, T]>;
This seems to fix it (see playground) but I'm not enough across how the gentype rescript stuff works to be able to make a PR.
Based on the current definition:
The first element in each pair is a
string
but it should use the generic typeK
. For example:The definition for
output
in the.d.ts
becomes:But I'd expect it to be:
Typescript Playground Example
By updating the definition to:
This seems to fix it (see playground) but I'm not enough across how the gentype rescript stuff works to be able to make a PR.