heroiclabs / nakama

Distributed server for social and realtime games and apps.
https://heroiclabs.com
Apache License 2.0
8.58k stars 1.06k forks source link

Why is Typescript compilerOptions target es5 ? #1215

Closed exotexot closed 1 month ago

exotexot commented 1 month ago

Honestly, es5 is horrible. Any attempt to increase my target from es5 to anything higher (es6, esnext) will prevent nakama container from starting properly.

{
    "compilerOptions": {
        "target": "es5",
        "typeRoots": ["./node_modules/@types", "./types"],
        "outFile": "./build/index.js",
        "strict": true,
        "esModuleInterop": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true
    },
    "include": ["src/*.ts"],
    "exclude": ["node_modules", "**/*.spec.ts", "data"]
}
linear[bot] commented 1 month ago

NK-552 Why is Typescript compilerOptions target es5 ?

zyro commented 1 month ago

Nakama uses goja to power the TypeScript/JavaScript runtime, so we are bound to its features and constraints as far as this runtime goes. As they add more capabilities we will update to ensure the improvements are reflected in Nakama. 👍

May I also suggest that "Honestly, es5 is horrible." is hard to work with, and it would be more useful to list specific problems you've run into or things you were unable to do? Even if it's something we can't help with directly, perhaps we can offer alternative suggestions or at least track them for future improvements.

exotexot commented 1 month ago

I agree, my comment wasn't very helpful. I'm just coming from modern JS frameworks, React, NextJS, etc ...

And I do miss some features like SpreadOperator and other modern SyntaxSugar :)

But I agree, there are ways to work around it of course. In the meantime I've also searched here in the GitHub issues, and I saw you answering this question before. So I do apologise for my bad behaviour!