Import types from seperate file without typescript generation export
So I am working on a project and want to import my types from a seperate file, but if I do that, typescript will generate this at the bottom of my js file.
export {};
Is there any way to circumvent that without defining the types in the same file?5 Replies
whats the issue with export {};
SyntaxError: export declarations may only appear at top level of a module
I am trying to write a browser extension.
I guess I could remove it manually, but that would be really annoying when always recompiling while modifing the codeidk too much about ts but i do have a ts project and here in the image u can see i am showing the ts and the js file . i am using this js file export some common enums
and below in the js file u can see there are no export {} unlike yours
not sure why
also since you r exporting file of types, is it nescessary to be compiled?
if not just tell ts compiler to ignote the file ig
You have a different es compile version (its the
object.defineProperty(exports [...])
) and there is still an import at the top of my file :)
Ok, in my case it seems that setting the module type to 'preserve' seemed to do the trick