I know in typescript I can do this, to get the names of properties:
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T];
type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
This worked great: (see here)
My only problem was when I changed my methods to properties (see here): (
Length(): number {return Math.sqrt(this.X * this.X + this.Y * this.Y) }
to
get Length(): number {return Math.sqrt(this.X * this.X + this.Y * this.Y) }
)Is there a way to exclude get-only properties or properties in general?
What I would need would be something like:
T[K] extends (GetOnlyProperty | Function)
instead of
T[K] extends Function