Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardTypeScriptdeclaration mergingSingle-choice MCQ

Both lines on the last two statements type-check. Why does function/namespace merging make this work?

function greet(name: string): string { return "hi " + name; } namespace greet { export const version = "1.0"; } const r: string = greet("ada"); const v: string = greet.version;