Good day. I am trying to transport typescript.

There is the following gulpfile.js

var gulp = require('gulp'); var typescript = require('gulp-typescript'); var small = require('small').gulp; var sourcemaps = require('gulp-sourcemaps'); var uglify = require('gulp-uglify'); var tsProject = typescript.createProject('lib/tsconfig.json', { typescript: require('typescript') }) gulp.task('compile', function() { return gulp.src('lib/**/*.ts') .pipe(sourcemaps.init()) .pipe(typescript(tsProject)) .pipe(small('index.js', { externalResolve: ['node_modules'], globalModules: { "crypto": { standalone: "undefined" } } })) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('static/scripts')); }); gulp.task('release', ['compile'], function() { return gulp.src('static/scripts/scripts.js') .pipe(uglify()) .pipe(gulp.dest('static/scripts')); }); gulp.task('default', ['compile'], function() { }); 

in tsconfig.json the following lies:

 { "compilerOptions": { "target": "es5", "module": "commonjs", "experimentalDecorators": true, "emitDecoratorMetadata": true, "lib": ["es2015", "dom"] } } 

when I run gulp compile I get

 typescript.js:11462 }); ^ Syntax error: Unexpected token } 

I can not understand this error, in the gulpfile itself, of course, everything is fine with the brackets

  • and moreover gulpfile if the error in typescript.js .. and you do not help, not enough data, and squeeze out of you to show it, and then that, I also think very few people are interested. - user220409
  • in my opinion, it should be clear that typescript.js is a standard module, it was not me who wrote it. As far as I understand, this is what was connected by require ('typescript'). It is not clear, you want me to give the source code of this module here? I think that here is some kind of error in the gulpfile, at least it appears when the gulp task is started. - user211576

1 answer 1

You create ts.projects () and pass it to it. Transfer your project to the pipe, and not to ts (project).