QuizzesTyping the API Boundary — Concept Check
intermediate
javascript

Typing the API Boundary — Concept Check

Questions on Typing the API Boundary. The types at the network edge are a claim, not a fact. Validating there — and generating types from the backend rather than hand-writing them — is what keeps a full-stack app honest.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Typing the API Boundary — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A frontend developer notices that a field renamed in the backend causes the app to break in production. What practice could have prevented this issue?

    • AUsing TypeScript's 'any' type for flexibility
    • BIgnoring type mismatches during development
    • CGenerating client types from the server's OpenAPI schema
    • DHand-writing types on the client-side
  2. 2.What happens if you use 'as Problem' instead of 'ProblemSchema.parse' when fetching API data?

    • AIt claims the shape and might fail later with undefined errors
    • BIt ensures type safety at compile time
    • CIt provides runtime validation of the data
    • DIt automatically corrects data mismatches
  3. 3.A developer uses 'safeParse' to validate input data. What is the benefit of this approach?

    • AIt guarantees type safety at compile time
    • BIt allows handling validation failures gracefully
    • CIt prevents all runtime errors
    • DIt automatically fixes invalid data
  4. 4.Why is it important to model API errors explicitly in TypeScript?

    • ATo simplify error handling
    • BTo ensure all errors are logged
    • CTo avoid using try-catch blocks
    • DBecause fetch does not reject on 4xx/5xx errors
  5. 5.A developer manually maintains client-side types matching the backend. What risk does this practice pose?

    • AIt reduces the need for type validation
    • BTypes may drift apart, causing runtime errors
    • CIt improves development speed
    • DIt ensures the types are always up-to-date
  6. 6.When should you use 'safeParse' instead of 'parse' with a schema library?

    • AWhen runtime validation is unnecessary
    • BWhen a failure is expected and needs handling
    • CWhen performance is a concern
    • DWhen input data is always trusted
  7. 7.What is the role of a schema library in validating API boundaries?

    • AIt provides both runtime checks and static types
    • BIt only generates static types
    • CIt automatically fixes all type mismatches
    • DIt eliminates the need for type checking