Advanced TypeScript Techniques

Test your skills in decorators,type inference,and advanced type manipulation.

1. Which utility type creates a new type with all properties of T set to optional?
2. Which of the following are examples of mapped types in TypeScript?
3. Conditional types in TypeScript can depend on type relationships to produce different types.
4. What is the conventional single-letter name for a generic type parameter in TypeScript (e.g., in `function identity<T>(arg: T): T`)?
5. Which utility type constructs a new type by omitting specified properties K from type T?
6. Which of the following are valid type guard functions in TypeScript?
7. Interfaces can be merged by declaring them multiple times, but type aliases cannot.
8. What is the resulting type of `type Result = ReturnType<() => number>`?
9. What does the `readonly` modifier do in a mapped type like `{ readonly [P in keyof T]: T[P] }`?
10. Which utility types transform the types of properties in an existing type?
11. The `unknown` type is a stricter alternative to `any` because it requires type checking before use.
12. What term describes a type that can be one of several types, denoted with the `|` operator (e.g., `string | number`)?
13. Which operator is used to get the union of keys from an object type T?
14. Which keyword is used to enforce that a generic type parameter must extend another type (e.g., `function f<T extends string>(arg: T)`)?
15. Which of the following are considered advanced generic techniques in TypeScript?
Answered 0 of 0 — 0 correct