How to fix Cannot find name 'undefined' in TypeScript | DevErrors