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

A function declaration and a same-named namespace are merged so the function carries static-like members. Reordering the two declarations changes whether the code compiles. Why does the namespace generally have to come AFTER the function declaration for the value-side merge to work?

function lib(x: number) { return x; } namespace lib { export const version = '1.0'; }