Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your 1 isn't equivalent to my example, line 11 is not constraining the type.



I know it's not equivalent, it was just an example to show what `any` does (and that it's more than "just a set of all possible types").

The `T extends Record<any, any>` on line 11 is a type parameter constraint though. Are you referring to something else when you say "constraining the type"?


It works differently based on where those anys are and what that Record<any, any> refers to due to type variance.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: