Typescript Error Is Not A Function