Here is my code
async getAll(): Promise {
return await dbQuery(); // dbQuery returns User[]
}
class User {
id: number;
na
Following up on GregL's answer, I'd like to add support for arrays and make sure that if you've got one, all the objects in the array have no extra props:
type Impossible = {
[P in K]: never;
};
export type NoExtraProperties = U extends Array
? NoExtraProperties[]
: U & Impossible>;
Note: The type recursion is only possible if you've got TS 3.7 (included) or above.