So, it will never return any value from the function. Modern code should use the ES Module syntax, as it has all the features provided by namespaces, and starting with ECMAScript 2015 it became part of the specification. Edit: reading the OP more clearly, it makes more sense why this exists but I guess I just wanted to highlight that oftentimes this is in a separate declare.d.ts file so it's sort of hard to debug sometimes. to your account. Why is it not allowed to use this the same name in both cases and what can I do to have them both with the same name?