I have a typescript module myApi with a nested module myRequest which allows me to use different functions for my API requests based on the build target of myApi (i.e. browser or node).
the return types of my request functions are defined in myRequest. Unfortunately, when I import a function from myApi, it will not keep track of the return types and just cast them to any.
if I look at the exported typescript d.ts file I see that at the top of the file the bundler (parcel) generates a statement
import {returnType} from "./myRequest"
but when I try to follow these types my IDE tells me that no definition has been found for myRequest.
I would expect an option in typescript to re-export imported types such that they appear with their full type definition in types.d.ts rather than just as an import statement.
I tried to add an export * from "myRequest" to the index.ts of myApi but that did not make a difference.
I also tried to set "isolatedModules":true in my tsconfig.json file without results.
How can I have typescript keep track of the types in my nested module?