To ensure your code works properly, consider removing the "declare" keyword.
namespace abc {
export function abc (): xyz {
console.log('Hello');
return xyz(200);
}
}
export default abc
The use of "declare" in TypeScript indicates that the variable has already been defined elsewhere. When "declare" is used, it does not add anything to the generated JavaScript; instead, it serves as a hint for the compiler.
Understanding the role of 'declare' in 'export declare class Actions'
In your specific case, the implementation can be placed elsewhere. The following code also functions correctly:
declare namespace abc {
export function abc ();
}
namespace abc {
function abc (): xyz {
console.log('Hello');
return xyz(200);
}
}
export default abc
More information on declaration files and practical examples