silvermine / toolbox

MIT License
2 stars 6 forks source link

Add a type for the "plain object" version of a class #90

Open lukelafountaine opened 1 month ago

lukelafountaine commented 1 month ago

It might be something like this:

type NonFunctionPropertyNames<T> = {
   [K in keyof T]: T[K] extends Function ? never : K;
}[keyof T];

export type PublicNonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
lukelafountaine commented 1 month ago

cc @onebytegone