Why typescript type inference is behaving like this?
Screenshot 1: Does not work!
Screenshot 2: Works!! 😵💫
5 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes, it can properly infer when I assign a variable to it.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I found this trick from here
https://github.com/microsoft/TypeScript/issues/35546#issuecomment-622261437
GitHub
T implicitly has type 'any' because it does not have a type annotat...
TypeScript Version: 3.7.3 Code type Schema = { [key: string]: Number | String | Boolean | (() => Model<any>) } type Model<T extends Schema> = { } function model&a...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View