Advanced
TypeScript
Q99 / 100
In TypeScript's control flow analysis, what does "Object.freeze(obj)" do to the inferred type of obj's properties when obj is a literal?
Correct! Well done.
Incorrect.
The correct answer is B) Object.freeze is typed to return "Readonly<T>", making properties readonly at the type level in addition to immutable at runtime
B
Correct Answer
Object.freeze is typed to return "Readonly<T>", making properties readonly at the type level in addition to immutable at runtime
Explanation
The standard lib typing for Object.freeze returns "Readonly<T>", so TypeScript treats the frozen object's properties as readonly going forward.
Progress
99/100