Type Helper to select fields

Hello there ! A picture is worth a thousands words. I'm trying to write this helper, but it breaks inference. Does anyone know of something that could work ?
export type Select<T> = {
[P in keyof T]?: boolean;
};
export type Select<T> = {
[P in keyof T]?: boolean;
};
No description
3 Replies
Doron Torangy
Doron Torangy12mo ago
any news about the solution for this?
Angelelz
Angelelz12mo ago
The problem here is that there is no connection between the Select helper and the columns type Typescript is not able to bridge the connection there, typescript just sees that Select is some Record<string, boolean>
Doron Torangy
Doron Torangy12mo ago
There is a solution here https://discord.com/channels/1043890932593987624/1129395697200939038 but there are still cases where is not perfect
Want results from more Discord servers?
Add your server