Narrowing & Guards interview questions

18 real Narrowing & Guards questions from the TypeScript bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is Type narrowing?

Mid
  1. A.narrowing a value to a class type using the instanceof operator
  2. B.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  3. C.narrowing by checking whether a given property key exists on an object
  4. D.refining a broader type to a more specific one within a particular code branch
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Mid
  1. A.Type narrowing — narrowing a union by checking a value's primitive type with typeof
  2. B.Type narrowing — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  3. C.Type narrowing — narrowing by checking whether a given property key exists on an object
  4. D.Type narrowing — refining a broader type to a more specific one within a particular code branch
Reveal the answer + AI explanation — free account

4. What is typeof guard?

Junior
  1. A.narrowing by checking whether a given property key exists on an object
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  4. D.narrowing a union by checking a value's primitive type with typeof
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.typeof guard — refining a broader type to a more specific one within a particular code branch
  2. B.typeof guard — narrowing a union by checking a value's primitive type with typeof
  3. C.typeof guard — narrowing a value to a class type using the instanceof operator
  4. D.typeof guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
Reveal the answer + AI explanation — free account

7. What is instanceof guard?

Mid
  1. A.refining a broader type to a more specific one within a particular code branch
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.narrowing a union by checking a value's primitive type with typeof
  4. D.a function whose return type is arg is T, telling the compiler the argument is a specific type
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.instanceof guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  2. B.instanceof guard — a function whose return type is arg is T, telling the compiler the argument is a specific type
  3. C.instanceof guard — narrowing a value to a class type using the instanceof operator
  4. D.instanceof guard — narrowing a union by checking a value's primitive type with typeof
Reveal the answer + AI explanation — free account

10. What is in operator guard?

Mid
  1. A.narrowing a union by checking a value's primitive type with typeof
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.a function whose return type is arg is T, telling the compiler the argument is a specific type
  4. D.narrowing by checking whether a given property key exists on an object
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.in operator guard — narrowing a union by checking a value's primitive type with typeof
  2. B.in operator guard — narrowing by checking whether a given property key exists on an object
  3. C.in operator guard — refining a broader type to a more specific one within a particular code branch
  4. D.in operator guard — narrowing a value to a class type using the instanceof operator
Reveal the answer + AI explanation — free account

13. What is Discriminated union?

Senior
  1. A.a function whose return type is arg is T, telling the compiler the argument is a specific type
  2. B.narrowing a value to a class type using the instanceof operator
  3. C.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  4. D.narrowing a union by checking a value's primitive type with typeof
Reveal the answer + AI explanation — free account

14. Which term means: "a union of object types sharing a literal tag property that the compiler uses to narrow between them"?

Senior
  1. A.instanceof guard
  2. B.in operator guard
  3. C.User-defined type guard
  4. D.Discriminated union
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Senior
  1. A.Discriminated union — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  2. B.Discriminated union — refining a broader type to a more specific one within a particular code branch
  3. C.Discriminated union — a function whose return type is arg is T, telling the compiler the argument is a specific type
  4. D.Discriminated union — narrowing a value to a class type using the instanceof operator
Reveal the answer + AI explanation — free account

16. What is User-defined type guard?

Senior
  1. A.a union of object types sharing a literal tag property that the compiler uses to narrow between them
  2. B.narrowing a union by checking a value's primitive type with typeof
  3. C.a function whose return type is arg is T, telling the compiler the argument is a specific type
  4. D.narrowing a value to a class type using the instanceof operator
Reveal the answer + AI explanation — free account

17. Which term means: "a function whose return type is arg is T, telling the compiler the argument is a specific type"?

Senior
  1. A.instanceof guard
  2. B.Discriminated union
  3. C.in operator guard
  4. D.User-defined type guard
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Senior
  1. A.User-defined type guard — narrowing a union by checking a value's primitive type with typeof
  2. B.User-defined type guard — a function whose return type is arg is T, telling the compiler the argument is a specific type
  3. C.User-defined type guard — a union of object types sharing a literal tag property that the compiler uses to narrow between them
  4. D.User-defined type guard — narrowing a value to a class type using the instanceof operator
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Narrowing & Guards free