What does TypeScript’s ‘using await’ (async explicit resource management) enable differently from regular ‘using’? TypeScript ProfessionalHard Try Now
What does the following ‘infer’ usage extract? type PromiseValue = T extends Promise ? PromiseValue : T; TypeScript ProfessionalHard Try Now
What does the following function overload pattern enable? function process(input: string): string; function process(input: number): number; function process(input: string | number): string | number { return input; } TypeScript ProfessionalHard Try Now
What does the following type utility compute? type DeepPartial = T extends object ? { [K in keyof T]?: DeepPartial } : T; TypeScript ProfessionalHard Try Now
What is the difference between ‘interface’ declaration merging and type alias intersection when both add the same property with incompatible types? TypeScript ProfessionalHard Try Now
What does the following module augmentation achieve? // In express.d.ts import ‘express’; declare module ‘express’ { interface Request { user?: { id: string }; } } TypeScript ProfessionalHard Try Now
What does the following generic constraint pattern achieve? type Covariant = () => T; type Contravariant = (arg: T) => void; // Which is wider: Covariant or Covariant if Dog extends Animal? TypeScript ProfessionalHard Try Now
What does this declaration show about TypeScript’s ‘this’ parameter? function toArray(this: { items: number[] }): number[] { return this.items; } TypeScript ProfessionalHard Try Now
What does the following type achieve and what is its practical use? type Simplify = T extends infer O ? { [K in keyof O]: O[K] } : never; TypeScript ProfessionalHard Try Now
What does the following ‘const’ type parameter (TypeScript 5.0) infer? function identity(value: T): T { return value; } const result = identity({ x: 1, y: ‘hello’ }); TypeScript ProfessionalHard Try Now
What does the following mapped type with key filtering produce? type FunctionProperties = { [K in keyof T as T[K] extends Function ? K : never]: T[K] }; TypeScript ProfessionalHard Try Now
What is a ‘higher-kinded type’ and why can’t TypeScript natively represent it? TypeScript ProfessionalHard Try Now
What does the following conditional type produce for T = string | number? type StringOnly = T extends string ? T : never; type Result = StringOnly; TypeScript ProfessionalHard Try Now
What does this type-level programming pattern produce? type LastOf = UnionToIntersection T : never> extends () => infer R ? R : never; TypeScript ProfessionalHard Try Now
What is the difference between ‘abstract new (…args: any[]) => T’ and ‘new (…args: any[]) => T’ as a type? TypeScript ProfessionalHard Try Now
What does the following decorator factory pattern achieve in TypeScript 5.0 stage-3 decorators? function log(target: any, context: ClassMethodDecoratorContext) { return function(this: any, …args: any[]) { console.log(`Calling ${String(context.name)}`); return target.call(this, …args); }; } TypeScript ProfessionalHard Try Now
What does the following pattern achieve? type Prettify = { [K in keyof T]: T[K] } & {}; TypeScript ProfessionalHard Try Now
What does the following type-level Fibonacci implementation use? type BuildArr = Arr[‘length’] extends N ? Arr : BuildArr; type Add = […BuildArr, …BuildArr][‘length’]; TypeScript ProfessionalHard Try Now