A. Type error: 'port' should be a number, not a string
B. No error, code is correct
C. Syntax error: 'satisfies' cannot be used here
D. Runtime error: 'host' is missing
Solution
Step 1: Check the type of each property in serverConfig
The port property is a string "8080" but Config expects a number.
Step 2: Understand what satisfies checks
satisfies verifies type compatibility and will raise a type error because of the wrong type for port.
Final Answer:
Type error: 'port' should be a number, not a string -> Option A
Quick Check:
Type mismatch causes error with satisfies [OK]
Hint: Check property types carefully with satisfies [OK]
Common Mistakes:
Ignoring type mismatch on properties
Thinking satisfies changes the value type
Assuming no error if extra properties exist
5.
You want to create a constant object settings that must have theme as a string and notifications as a boolean. You also want to keep extra properties without losing their types. Which code correctly uses satisfies to achieve this?
hard
A. const settings = { theme: "dark", notifications: true, version: 2 } as { theme: string; notifications: boolean };