type TempDataDesc = { hasInited : boolean ; } ; function createData ( ) { return { hasInited : false , } ; } export class TempData { private _temp : TempDataDesc ; constructor ( ) { this . _temp = createData ( ) ; } set < T extends keyof TempDataDesc > ( name , value ) { this . _temp [ name ] = value ; } get < T extends keyof TempDataDesc > ( name ) { return this . _temp [ name ] ; } clear ( ) { this . _temp = createData ( ) ; } }