Typescript Check If Variable Is Defined