diff --git a/build/lib/compilation.js b/build/lib/compilation.js index ae0726f273d..60fd1f7ddfb 100644 --- a/build/lib/compilation.js +++ b/build/lib/compilation.js @@ -4,23 +4,31 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -var gulp = require("gulp"); -var tsb = require("gulp-tsb"); var es = require("event-stream"); -var watch = require('./watch'); -var nls = require("./nls"); -var util = require("./util"); -var reporter_1 = require("./reporter"); -var path = require("path"); +var fs = require("fs"); +var gulp = require("gulp"); var bom = require("gulp-bom"); var sourcemaps = require("gulp-sourcemaps"); +var tsb = require("gulp-tsb"); +var path = require("path"); var _ = require("underscore"); var monacodts = require("../monaco/api"); -var fs = require("fs"); +var nls = require("./nls"); +var reporter_1 = require("./reporter"); +var util = require("./util"); +var watch = require('./watch'); +var assign = require("object-assign"); var reporter = reporter_1.createReporter(); function getTypeScriptCompilerOptions(src) { var rootDir = path.join(__dirname, "../../" + src); - var options = require("../../" + src + "/tsconfig.json").compilerOptions; + var tsconfig = require("../../" + src + "/tsconfig.json"); + var options; + if (tsconfig.extends) { + options = assign({}, require(path.join(rootDir, tsconfig.extends)).compilerOptions, tsconfig.compilerOptions); + } + else { + options = tsconfig.compilerOptions; + } options.verbose = false; options.sourceMap = true; if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts index e945859bc56..21fbb6a7731 100644 --- a/build/lib/compilation.ts +++ b/build/lib/compilation.ts @@ -5,25 +5,32 @@ 'use strict'; -import * as gulp from 'gulp'; -import * as tsb from 'gulp-tsb'; import * as es from 'event-stream'; -const watch = require('./watch'); -import * as nls from './nls'; -import * as util from './util'; -import { createReporter } from './reporter'; -import * as path from 'path'; +import * as fs from 'fs'; +import * as gulp from 'gulp'; import * as bom from 'gulp-bom'; import * as sourcemaps from 'gulp-sourcemaps'; +import * as tsb from 'gulp-tsb'; +import * as path from 'path'; import * as _ from 'underscore'; import * as monacodts from '../monaco/api'; -import * as fs from 'fs'; +import * as nls from './nls'; +import { createReporter } from './reporter'; +import * as util from './util'; +const watch = require('./watch'); +import assign = require('object-assign'); const reporter = createReporter(); function getTypeScriptCompilerOptions(src: string) { const rootDir = path.join(__dirname, `../../${src}`); - const options = require(`../../${src}/tsconfig.json`).compilerOptions; + const tsconfig = require(`../../${src}/tsconfig.json`); + let options: { [key: string]: any }; + if (tsconfig.extends) { + options = assign({}, require(path.join(rootDir, tsconfig.extends)).compilerOptions, tsconfig.compilerOptions); + } else { + options = tsconfig.compilerOptions; + } options.verbose = false; options.sourceMap = true; if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry diff --git a/src/tsconfig.base.json b/src/tsconfig.base.json new file mode 100644 index 00000000000..623095b7226 --- /dev/null +++ b/src/tsconfig.base.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "module": "amd", + "moduleResolution": "node", + "noImplicitAny": false, + "target": "es5", + "experimentalDecorators": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noImplicitThis": true, + "alwaysStrict": true, + "baseUrl": ".", + "paths": { + "vs/*": [ + "./vs/*" + ] + }, + "types": [ + "keytar", + "minimist", + "mocha", + "semver", + "sinon", + "winreg" + ] + }, + "include": [ + "./typings", + "./vs" + ], + "exclude": [ + "./typings/require-monaco.d.ts" + ] +} \ No newline at end of file diff --git a/src/tsconfig.json b/src/tsconfig.json index c5a31a458f8..6f552e5ca05 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,33 +1,11 @@ { + "extends": "./tsconfig.base.json", "compilerOptions": { - "module": "amd", - "moduleResolution": "node", - "noImplicitAny": false, "removeComments": false, "preserveConstEnums": true, - "target": "es5", "sourceMap": false, - "experimentalDecorators": true, "declaration": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "noImplicitThis": true, - "alwaysStrict": true, - "baseUrl": ".", - "outDir": "../out", - "paths": { - "vs/*": [ - "./vs/*" - ] - }, - "types": [ - "keytar", - "minimist", - "mocha", - "semver", - "sinon", - "winreg" - ] + "outDir": "../out" }, "include": [ "./typings", diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json new file mode 100644 index 00000000000..59f6328c061 --- /dev/null +++ b/src/tsconfig.strictNullChecks.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "noEmit": true, + "strictNullChecks": true + }, + "include": [ + "./typings", + "./vs/base/common/iterator.ts" + ], + "exclude": [ + "./typings/require-monaco.d.ts" + ] +} \ No newline at end of file diff --git a/src/vs/base/common/iterator.ts b/src/vs/base/common/iterator.ts index 78f2117a656..eb3f9450f07 100644 --- a/src/vs/base/common/iterator.ts +++ b/src/vs/base/common/iterator.ts @@ -49,7 +49,7 @@ export module Iterator { return { next() { const { done, value } = iterator.next(); - return { done, value: done ? undefined : fn(value) }; + return { done, value: done ? undefined : fn(value!) }; } }; } @@ -64,7 +64,7 @@ export module Iterator { return { done, value: undefined }; } - if (fn(value)) { + if (fn(value!)) { return { done, value }; } } @@ -74,7 +74,7 @@ export module Iterator { export function forEach(iterator: Iterator, fn: (t: T) => void): void { for (let next = iterator.next(); !next.done; next = iterator.next()) { - fn(next.value); + fn(next.value!); } } @@ -96,7 +96,7 @@ export function getSequenceIterator(arg: Iterator | T[]): Iterator { } export interface INextIterator { - next(): T; + next(): T | null; } export class ArrayIterator implements INextIterator { @@ -113,17 +113,17 @@ export class ArrayIterator implements INextIterator { this.index = index; } - public first(): T { + public first(): T | null { this.index = this.start; return this.current(); } - public next(): T { + public next(): T | null { this.index = Math.min(this.index + 1, this.end); return this.current(); } - protected current(): T { + protected current(): T | null { if (this.index === this.start - 1 || this.index === this.end) { return null; } @@ -138,34 +138,33 @@ export class ArrayNavigator extends ArrayIterator implements INavigator super(items, start, end, index); } - public current(): T { + public current(): T | null { return super.current(); } - public previous(): T { + public previous(): T | null { this.index = Math.max(this.index - 1, this.start - 1); return this.current(); } - public first(): T { + public first(): T | null { this.index = this.start; return this.current(); } - public last(): T { + public last(): T | null { this.index = this.end - 1; return this.current(); } - public parent(): T { + public parent(): T | null { return null; } - } export class MappedIterator implements INextIterator { - constructor(protected iterator: INextIterator, protected fn: (item: T) => R) { + constructor(protected iterator: INextIterator, protected fn: (item: T | null) => R) { // noop } @@ -173,12 +172,12 @@ export class MappedIterator implements INextIterator { } export interface INavigator extends INextIterator { - current(): T; - previous(): T; - parent(): T; - first(): T; - last(): T; - next(): T; + current(): T | null; + previous(): T | null; + parent(): T | null; + first(): T | null; + last(): T | null; + next(): T | null; } export class MappedNavigator extends MappedIterator implements INavigator {