6

Hey so this just came up and i have no idea how could i ddg this so ill just ask here.

I know you can use namespace{} in typescript but is there something similar in js (es6)? We are making a game and the variable names are getting scarce so it would be nice if we could like menu.offset or something. I know static variables in classes are a thing but im asking about namespace-y stuff here.

Comments
  • 0
    @namenlossss yeah thats what we r doing but it would be neat to have intellisense
  • 0
    Namespace is a typescript thing, analogous to a "private" module.

    Your best bet is to just use es6 modules.
  • 1
    Eh... Why don't you try an IIFE (Immediately Invoked Function Expression) for your private stuff. That's what every module system in JavaScript does internally anyway.
    You can always check the transpiled code of TypeScript to see how they did it.
    Also try any module system which is supported by Webpack. I would definitely use the new ES6 modules. Let Webpack handle all the headache.
Add Comment