What does the ‘as’ clause in a mapped type key remapping enable? type Example = { [K in keyof T as K extends string ? K : never]: T[K] } TypeScript AssociateHard Try Now
What does the following type compute? type Tail = T extends [any, …infer Rest] ? Rest : never; TypeScript AssociateHard Try Now
What does the following code demonstrate? function merge(a: T, b: U): T & U { return { …a, …b }; } TypeScript AssociateHard Try Now
What is a const enum in TypeScript and how does it differ from a regular enum? TypeScript AssociateHard Try Now
What does the following produce? type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; TypeScript AssociateHard Try Now
What does ‘using’ declaration in TypeScript 5.2 (Explicit Resource Management) provide? TypeScript AssociateHard Try Now
What does the following mapped type key remapping do? type Getters = { [K in keyof T as `get${Capitalize}`]: () => T[K] }; TypeScript AssociateHard Try Now
What does ‘contra-variance’ mean for function parameter types in TypeScript? TypeScript AssociateHard Try Now
What does ‘co-variance’ mean for function return types in TypeScript? TypeScript AssociateHard Try Now
What does the following type-level operation produce? type Head = T extends [infer H, …any[]] ? H : never; TypeScript AssociateHard Try Now
What does the following TypeScript achieve? function assertNever(x: never): never { throw new Error(‘Unexpected value: ‘ + x); } TypeScript AssociateHard Try Now