Typescript Check If Variable Is Objective Necessary