Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib compilerOptions not used? #420

Closed
jods4 opened this issue Sep 26, 2016 · 2 comments
Closed

lib compilerOptions not used? #420

jods4 opened this issue Sep 26, 2016 · 2 comments
Labels

Comments

@jods4
Copy link

jods4 commented Sep 26, 2016

On the command line, my project compiles fine using:
tsc -p tsconfig.json
When using gulp-typescript 3.0 with TS 2.0, I get tons of comilation errors.

Apparently, TS does not know built-in objects such as Object, Function, RegExp, Promise, etc.
This should be covered by lib in my tsconfig options (and works on command line):

{
  "compilerOptions": {
    "target": "es6",
    "module": "amd",
    "outFile": "main.js",
    "allowJs": true,
    "lib": [ "dom", "es2017" ],
    "skipDefaultLibCheck": true,

    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noFallthroughCasesInSwitch": true
  }
}

For reference, this is how I invoke gulp-ts:

const ts = require('gulp-typescript');
const tsProject = ts.createProject('App/tsconfig.json', { noResolve: true });

gulp.task('javascript', function () {
  const babel = require('gulp-babel');
  const gulpif = require('gulp-if');
  const sourcemaps = require('gulp-sourcemaps');

  return gulp.src(['**/*.ts', 'config.js'], { cwd: 'App' })
             .pipe(gulpif(options.sourcemaps, sourcemaps.init()))
             .pipe(tsProject())
             .js
             .pipe(babel({ presets: ['es2015-loose'], compact: true }))
             .pipe(gulpif(options.minify, uglify()))
             .pipe(gulpif(options.sourcemaps, sourcemaps.write()))
             .pipe(gulp.dest('wwwroot/dist'));
});
@ivogabe
Copy link
Owner

ivogabe commented Sep 27, 2016

This looks like the same problem as microsoft/TypeScript#10678. Since you're only setting noResolve: true in your gulpfile, tsc doesn't have this option and works as expected.

@jods4
Copy link
Author

jods4 commented Sep 27, 2016

@ivogabe I think you are correct, this is a TS bug.
I switched to noResolve from noExternalResolve in gulp-ts 2.x.
I guess I can remove it (for a perf hit) until TS is fixed.

@ivogabe ivogabe closed this as completed Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants