diff --git a/Gulpfile.ts b/Gulpfile.ts index 6f63fc23587a3..f0757c89bba8f 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -11,8 +11,11 @@ import newer = require("gulp-newer"); import tsc = require("gulp-typescript"); declare module "gulp-typescript" { interface Settings { - stripInternal?: boolean; + pretty?: boolean; newLine?: string; + noImplicitThis?: boolean; + stripInternal?: boolean; + types?: string[]; } interface CompileStream extends NodeJS.ReadWriteStream {} // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required } @@ -306,6 +309,11 @@ function needsUpdate(source: string | string[], dest: string | string[]): boolea function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): tsc.Settings { const copy: tsc.Settings = {}; + copy.noEmitOnError = true; + copy.noImplicitAny = true; + copy.noImplicitThis = true; + copy.pretty = true; + copy.types = []; for (const key in base) { copy[key] = base[key]; } diff --git a/Jakefile.js b/Jakefile.js index 828f4b084d1fa..0dd589f90e34e 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -284,7 +284,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) { file(outFile, prereqs, function() { var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler; - var options = "--noImplicitAny --noEmitOnError --types --pretty"; + var options = "--noImplicitAny --noImplicitThis --noEmitOnError --types --pretty"; opts = opts || {}; // Keep comments when specifically requested // or when in debug mode. diff --git a/src/compiler/core.ts b/src/compiler/core.ts index fe4731a1c9144..cc6a9e6db9a6a 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1237,20 +1237,20 @@ namespace ts { getSignatureConstructor(): new (checker: TypeChecker) => Signature; } - function Symbol(flags: SymbolFlags, name: string) { + function Symbol(this: Symbol, flags: SymbolFlags, name: string) { this.flags = flags; this.name = name; this.declarations = undefined; } - function Type(checker: TypeChecker, flags: TypeFlags) { + function Type(this: Type, checker: TypeChecker, flags: TypeFlags) { this.flags = flags; } function Signature(checker: TypeChecker) { } - function Node(kind: SyntaxKind, pos: number, end: number) { + function Node(this: Node, kind: SyntaxKind, pos: number, end: number) { this.kind = kind; this.pos = pos; this.end = end; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2e4492efa7b14..af0a13d640bd3 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1399,7 +1399,7 @@ namespace ts { } function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult { - return runWithCancellationToken(() => emitWorker(this, sourceFile, writeFileCallback, cancellationToken)); + return runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken)); } function isEmitBlocked(emitFileName: string): boolean { diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 338b6de1e635f..29ae2c60af165 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -182,7 +182,7 @@ namespace ts { return matchFiles(path, extensions, excludes, includes, /*useCaseSensitiveFileNames*/ false, shell.CurrentDirectory, getAccessibleFileSystemEntries); } - return { + const wscriptSystem: System = { args, newLine: "\r\n", useCaseSensitiveFileNames: false, @@ -201,7 +201,7 @@ namespace ts { return fso.FolderExists(path); }, createDirectory(directoryName: string) { - if (!this.directoryExists(directoryName)) { + if (!wscriptSystem.directoryExists(directoryName)) { fso.CreateFolder(directoryName); } }, @@ -221,6 +221,7 @@ namespace ts { } } }; + return wscriptSystem; } function getNodeSystem(): System { @@ -439,7 +440,7 @@ namespace ts { return filter(_fs.readdirSync(path), p => fileSystemEntryExists(combinePaths(path, p), FileSystemEntryKind.Directory)); } - return { + const nodeSystem: System = { args: process.argv.slice(2), newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, @@ -501,7 +502,7 @@ namespace ts { fileExists, directoryExists, createDirectory(directoryName: string) { - if (!this.directoryExists(directoryName)) { + if (!nodeSystem.directoryExists(directoryName)) { _fs.mkdirSync(directoryName); } }, @@ -549,6 +550,7 @@ namespace ts { return _fs.realpathSync(path); } }; + return nodeSystem; } function getChakraSystem(): System { diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 76308c2cba4ff..827a9b81c4d87 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -1,8 +1,10 @@ { "compilerOptions": { "noImplicitAny": true, + "noImplicitThis": true, "removeComments": true, "preserveConstEnums": true, + "pretty": true, "outFile": "../../built/local/tsc.js", "sourceMap": true, "declaration": true, diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 1977d95492ccf..985d00bcf63c6 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -127,7 +127,7 @@ namespace Utils { export function memoize(f: T): T { const cache: { [idx: string]: any } = {}; - return (function() { + return (function(this: any) { const key = Array.prototype.join.call(arguments); const cachedResult = cache[key]; if (cachedResult) { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6a2beccc243c5..8854ea9f4320c 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -2083,7 +2083,7 @@ namespace ts.server { done: false, leaf: function (relativeStart: number, relativeLength: number, ll: LineLeaf) { if (!f(ll, relativeStart, relativeLength)) { - this.done = true; + walkFns.done = true; } } }; diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 0a8cfb89ab348..df7dcdfe8ad2b 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -1,8 +1,10 @@ { "compilerOptions": { "noImplicitAny": true, + "noImplicitThis": true, "removeComments": true, "preserveConstEnums": true, + "pretty": true, "out": "../../built/local/tsserver.js", "sourceMap": true, "stripInternal": true diff --git a/src/services/shims.ts b/src/services/shims.ts index e8b9b59b3cdad..e85bf537d30fb 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -16,7 +16,7 @@ /// /* @internal */ -let debugObjectHost = (this); +let debugObjectHost = new Function("return this")(); // We need to use 'null' to interface with the managed side. /* tslint:disable:no-null-keyword */ diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 4bf6e87d7a631..86efd25493720 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -1,8 +1,10 @@ { "compilerOptions": { "noImplicitAny": true, + "noImplicitThis": true, "removeComments": false, "preserveConstEnums": true, + "pretty": true, "outFile": "../../built/local/typescriptServices.js", "sourceMap": true, "stripInternal": true,