I came up with this error message by transcribing TS in JS using gulp - typescript. I am trying to use the ES5 function for getters / seters.
error TS1056: Accessors are available only when configuring ECMAScript 5 or higher
How to get a transcompiler for targeting on es5?
I googled for solutions that suggest setting target = es5
and passing it to typescript. I did the following using tsconfig.json
tsconfig.js
{ "compilerOptions": { "target": "es5" }, "files": [] }
gulp task
import gulp from 'gulp'; import gulpif from 'gulp-if'; import livereload from 'gulp-livereload'; import typescript from 'gulp-typescript'; import args from './lib/args'; const tsProject = typescript.createProject('tsconfig.json'); console.log(tsProject); gulp.task('scripts-typescript', () => { return gulp.src('app/scripts/**/*.ts') .pipe(typescript(tsProject())) .pipe(gulp.dest(`dist/${args.vendor}/scripts`)) .pipe(gulpif(args.watch, livereload())); });
registered output
source share