Your code will work fine if you remove "declare" keyword
namespace abc {
export function abc (): xyz {
console.log('Hello');
return xyz(200);
}
}
export default abc
declare is used to tell TypeScript that the variable has been created
elsewhere. If you use declare, nothing is added to the JavaScript that
is generated - it is simply a hint to the compiler.
What does 'declare' do in 'export declare class Actions'?
The implementation can be in the another place in your case. The code below works fine too.
declare namespace abc {
export function abc ();
}
namespace abc {
function abc (): xyz {
console.log('Hello');
return xyz(200);
}
}
export default abc
https://www.typescriptlang.org/docs/handbook/declaration-files/by-example.html