I decided to declare all the types that I'll need across my project into a single d.ts file.
allTypes.d.ts
declare namespace PROJECT { interface MY_INTERFACE { // ... } } And just by declaring that namespace, I'm already able to use in all my project files as:
const something: PROJECT.MY_INTERFACE = { // ... }; And this has been working so far.
But now I need to declare a new type that is based on a existing JS object.
@constants/COLLECTIONS.ts
export const COLLECTIONS = { PROP_A: "PROP_A", PROP_B: "PROP_B", PROP_C: "PROP_C", }; So I had to do the following in my allTypes.d.ts file.
allTypes.d.ts
import { COLLECTIONS } from "@constants/COLLECTIONS"; declare namespace PROJECT { interface MY_INTERFACE { // ... } type SOME_TYPE = keyof typeof COLLECTIONS // THIS IS WORKING FINE } The problem is that just by doing that import on the top-level of my allTypes.d.ts, my PROJECT namespace is no longer visible for the files of my project.
How can I solve this?


