Can TypeScript specify keys that are allowed to not exist, but cannot be assigned to `undefined`?
Summary I want to disallow any explicit undefined value while still allowing implicit undefined values. Background In JavaScript, we have this behavior where accessing a key that does not exist yields undefined, while accessing a key that does exist can also yield undefined. For example, [1, 2, undefined, 4][2] -> undefined [1, 2, 3, 4][99] […]
Why does typescript give “object is possibly undefined” when object is defined in constructor?
Title says it all. I don’t see how this.authService could possibly be undefined after this.authService = new AuthService() in the constructor (or something incredibly close). The base class uses a base class of GenericApiService – why I have to use the const and pass to super before assignment.