TypeScript

TypeScript

Test your TypeScript knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. How to define an al parameter in TypeScript?

    • name[]
    • name{}
    • name?
    • name=
  2. Which type represents values that never occur?

    • void
    • undefined
    • never
    • null
  3. Which interface keyword is correct in TypeScript?

    • declare
    • interface
    • class
    • type
  4. What is the purpose of enum in TypeScript?

    • Create constant arrays
    • Handle API requests
    • Store multiple types
    • Define a set of constants
  5. Which type is used when you don't want to return anything?

    • null
    • undefined
    • void
    • never
  6. What is Type Inference in TypeScript?

    • Manually declaring types
    • TypeScript guesses the type
    • Adding external libraries
    • Ignoring types
  7. What does a union type allow in TypeScript?

    • Multiple values
    • One of several types
    • Only one fixed type
    • Functions as types
  8. Which syntax represents a union type?

    • string number
    • string | number
    • string & number
    • string, number
  9. What is an intersection type?

    • A type that combines multiple types
    • A single type
    • Type with conditions
    • None of the above
  10. What is a type alias?

    • A function shortcut
    • A reusable custom type name
    • A JavaScript class
    • An external file
  11. What does a TypeScript conditional type look like?

    • A extends B ? X : Y
    • if A then B else C
    • typeof A == B ? C : D
    • A ? B : C
  12. Which utility type makes all properties al?

    • Partial<T>
    • Required<T>
    • Readonly<T>
    • Pick<T>
  13. What is the purpose of keyof in TypeScript?

    • Get object values
    • Get property names as a union
    • Clone types
    • Filter arrays
  14. What is declaration merging?

    • Combining interfaces
    • Merging modules and classes
    • Overriding types
    • All of the above
  15. Which keyword is used in user-defined type guards?

    • guard
    • is
    • as
    • typeof