1. Extract function parameter types:
Parameters<T> gives the parameter tuple type of a function. ConstructorParameters<T> does the same for class constructors.
function f(a: string, b: number) {}
type P = Parameters<typeof f>; // [string, number]Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Netflix · Typescript
Practice Typescript questions specifically asked in Netflix interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
7
Tagged for this company + subject
Company
Netflix
View company-wise questions
Subject
Typescript
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your Netflix Typescript round.
Parameters<T> gives the parameter tuple type of a function. ConstructorParameters<T> does the same for class constructors.
function f(a: string, b: number) {}
type P = Parameters<typeof f>; // [string, number]For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
Use `super(...)` as the first statement in the subclass constructor to run the base class initialization.
class A { constructor(public id: string) {} }
class B extends A { constructor(){ super('b'); } }In mapped types, “-?” removes optional, “+?” adds optional. Similarly, “-readonly” removes readonly and “+readonly” adds it.
type Requiredify<T> = { [K in keyof T]-?: T[K] };
// { a?: number } -> { a: number }Turning on `noImplicitAny` makes the compiler report an error whenever it would infer `any` for a variable or parameter. This helps catch missing annotations and accidental type holes early.
// tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true
}
}
// function sum(a, b) { return a + b } // ❌ errors: implicit anyInterfaces extend and merge naturally and work cleanly with classes. Use type aliases for unions, intersections, and advanced mapped/conditional types.
interface Animal { speak(): void }
class Dog implements Animal { speak() { /*...*/ } }You can reopen a module’s declaration in a `.d.ts` file and add missing types or members. This is great for patching third-party typings without editing `node_modules`.
/* types/lib-augment.d.ts */
declare module 'some-lib' {
export function fancy(): string;
}Interfaces describe the shape (what methods/properties exist). Classes provide the actual code (how they work) and can implement interfaces.
interface Repo { get(id: string): Promise<string> }
class MemoryRepo implements Repo { async get(id: string){ return id; } }