-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TS] Using type only imports to use types "normally"? #40
Comments
@MarcusRiemer Happy to take on this advice. Can you explain what you mean by dangerous about adding to the typeRoots? I'm not a TypeScript export so any help is appreciated. |
"Dangerous" in the sense of "Marcus was once bitten by a globally declared conflicting If I understand correctly the |
fwiw: I ran through most of the Typescript setup process (including Rollup, excluding building via docker) with the |
What I did was add:
To the top of my I debated adding |
That's also how I solved it (with the old style reference) |
The typescript setup guide tells the user to add
"typeRoots": ["./node_modules"]
to thetsconfig.json
. This seems a little dangerous to me and from my PoV this could also be solved by using Type-Only imports from Typescript 3.8.I went ahead and changed
declare namespace nkruntime
(see https://github.com/heroiclabs/nakama-common/blob/master/index.d.ts#L15) toexport namespace nkruntime
and then a correspondingimport { nkruntime } from "nakama-runtime";
in my typescript file.For me this works fine and nicely streamlines the development to be less "unusual".
The text was updated successfully, but these errors were encountered: