Sometimes a generic function needs to guarantee that T has certain properties (like length or id). Use T extends { id: number } to constrain it, and K extends keyof T to ensure a key actually exists on an object!
ADVERTISEMENT
We use cookies to collect and analyse information on site performance and usage, and to enhance and customise content and advertisements. Learn more
Required for basic website functionality.
Help us understand how visitors interact with the site.
Used to show relevant ads and measure ad performance.