1. What is keyof operator?

keyof operator takes interface or type and returns literal or numerical union of keys, which can be used as a type.

type ExampleType = { name: string, age: number } type KeysOfExampleType = keyof ExampleType // "name" | "age" type TypeWithSameKeysAsExample = { [key in keyof ExampleType]: string } const obj: {value: KeysOfExampleType}: { value: "something" // Type 'something' is not assignable to type 'keyof ExampleType`` } const obj2: TypeWithSameKeysAsExample = {} // Type '{}' is missing the following properties from type 'TypeWithSameKeysAsExample': name, age
Struggling to find common date to meet with your friends? Try our new tool commondate.xyz
devFlipCards 2025

Do you accept cookies?

Cookies are small amounts of data saved locally on you device, which helps our website - it saves your settings like theme or language. It helps in adjusting ads and in traffic analysis. By using this site, you consent cookies usage.

Struggling to find common date to meet with your friends? Try our new tool
commondate.xyz