Closed
Description
This were working without error in TypeScript 3.0.1 but is not working on 3.2.4.
The select
function is intended to accept only property names of type string in the last argument, but in 3.2.4 it does not accept any string.
It gives error: [ts] Argument of type '"value"' is not assignable to parameter of type 'XX extends XX ? "value" : never'. [2345]
export type FilterPropsByType<T, TT> = {
[K in keyof T]: T[K] extends TT ? K : never
}[keyof T];
function select<
T extends string | number,
TList extends object,
TValueProp extends FilterPropsByType<TList, T>
>(
property: T, list: TList[], valueProp: TValueProp
)
{
//
}
export function func<XX extends string>(x: XX, tipos: { value: XX }[]) {
select(x, tipos, 'value');
}