javascriptnode.jstypescriptredistsconfig

Error TS18028 while compiling ts to js, tsconfig is almost empty


I initialised a TS package with no preset.

tsconfig.json

{
  "compilerOptions": {
    "types": ["node"]
  }
}
dev command

"dev": "tsc-watch --noClear index.ts --outDir ./ --onSuccess \"node ./index.js\""

Everything was going well until I installed the redis package. After that I started to have this error.

error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.

And can't understand how to resolve it. No changes to the tsconfig did anything.


Solution

  • Fixed it this way

    dev command
    
    "dev": "tsc-watch -p ./tsconfig.json --noClear --outDir ./ --onSuccess \"node ./index.js\"",
    
    tsconfig.json
    
    {
      "files": ["index.ts"],
      "compilerOptions": {
        "types": ["node"],
        "target": "ESNext",
        "module": "CommonJS"
      }
    }