tsconfig / bases

Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment
MIT License
6.4k stars 240 forks source link

tsconfig/recommended does not allow for "newer" ES features... #250

Closed koraysels closed 9 months ago

koraysels commented 9 months ago

I am getting errors when doing stuff like

enum Direction {
    North = "NORTH",
    South = "SOUTH",
    East = "EAST",
    West = "WEST"
}
console.log(Object.values(Direction)); // NORTH,SOUTH,EAST,WEST
enums.ts:10:20 - error TS2550: Property 'values' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2017' or later.

10 console.log(Object.values(Direction)); // NORTH,SOUTH,EAST,WEST
                      ~~~~~~

So can anyone explain what is the deal here? Are we not recommending modern JavaScript API's? What is in fact the recommended tsconfig.json as of now ? I am very confused but also, I want to understand.

orta commented 9 months ago

Recommended only sets some strictness flags, and doesn't set your runtime, so you can mix it with one which does set your runtime expectations.