#Force treat file as a global script
14 messages · Page 1 of 1 (latest)
If I have a file
type Foo=string;
export {}
can I force TS to still expose type Foo as a global and not treat it as module?
declare global {
type Foo = string
}
I see. I was hoping for a way to force this w/o making changes to the file itself - it's an online editor and changes come from user input. Detecting where to put declare global and then obfuscate it in the editor would be rather hard.
Hmm, not quite sure I get the full picture.
Wouldn't you want your user to write vanilla TS so they aren't confused about "why does it work in TS but not in your editor" or vice versa?
the intent is that the user has two editor panes(pane=file basically) - and these panes should share types between each other.
trying to think of a way to achieve that even if something is imported(an external lib)
it's all about ts types so don't really care about compiled runtime js, just the types
What about just concating the two files?
yeah, was thinking in that direction too - didn't find a way to do that yet so thought perhaps there's some ts compiler option that would do that
I would think you can just concat the content before feeding it to the TS compiler.