class PersonStat { public id : string; protected description : string | Say | ((value : number) => string | Say); public defaultValue : number = 0; public maxValue : number = 10; public constructor (id : string, description? : string | Say | ((value : number) => string | Say)) { this.id = id; this.description = description == undefined ? "Not defined" : description; } public getDescription (value : number) : Say | string | ((value : number) => (string | Say)) { if (typeof this.description == "string" || this.description instanceof Say) { return this.description; } else { return this.description(value); } } }