I'm trying to create a file for the types that are globally used around my app.
reduxState.d.ts
declare namespace MyProject {
type Type1 = someType;
interface SomeInterface {
someProperty: someType
}
}
With the code above, I can already see my namespace and its members available across my project files.
So what is the difference between the code above, and the following code, that uses export for the namespace members?
declare namespace MyProject {
export type Type1 = someType;
export interface SomeInterface {
someProperty: someType
}
}
They both seem to work just fine. What is the difference?
From: https://www.typescriptlang.org/docs/handbook/namespaces.html#namespacing
Because we want the interfaces and classes here to be visible outside the namespace, we preface them with export.
In this excerpt from the DOC, it seems that they are referring to a namespace that is declared within a ts and not a d.ts file. Is that why you need the export in that case?
Does it make sense at all to use export within a d.ts file?