export type Get < T > = ( ) => T ; export type Set < T > = ( value : T ) => void ; export const createGetterSetter = < T extends object > ( name ) : [ Get < T > , Set < T > ] => { let value ; const get = ( ) => { if ( ! value ) throw new Error ( `${ name } was not set.` ) ; return value ; } ; const set = ( newValue ) => { value = newValue ; } ; return [ get , set ] ; } ;