A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-127.ts
1interfaceUser{name:string}
2interfaceUser{age:number}
3constu:User={name:'A',age:2}
4console.log(Object.keys(u).length)
Type Erasure
Answer & explanation
Console output
2
Why
TypeScript merges the two `User` interface declarations into one type at compile time, but this merging produces no runtime code. The object literal has exactly the keys `name` and `age` that you wrote, so `Object.keys(u).length` is 2. Declaration merging is a pure type-space feature.