Compile with --noImplicitThis
1. Add to various tsconfig.json 2. Add to Jakefile 3. Add annotations where needed. 4. Add workaround to shims.ts, which uses toplevel `this`.
This commit is contained in:
parent
81e8840136
commit
b543074861
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1398,7 +1398,7 @@ namespace ts {
|
|||
return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false));
|
||||
}
|
||||
|
||||
function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult {
|
||||
function emit(this: Program, sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult {
|
||||
return runWithCancellationToken(() => emitWorker(this, sourceFile, writeFileCallback, cancellationToken));
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace ts {
|
|||
directoryExists(path: string) {
|
||||
return fso.FolderExists(path);
|
||||
},
|
||||
createDirectory(directoryName: string) {
|
||||
createDirectory(this: System, directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
fso.CreateFolder(directoryName);
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ namespace ts {
|
|||
},
|
||||
fileExists,
|
||||
directoryExists,
|
||||
createDirectory(directoryName: string) {
|
||||
createDirectory(this: System, directoryName: string) {
|
||||
if (!this.directoryExists(directoryName)) {
|
||||
_fs.mkdirSync(directoryName);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"outFile": "../../built/local/tsc.js",
|
||||
|
|
|
@ -2081,7 +2081,7 @@ namespace ts.server {
|
|||
const walkFns = {
|
||||
goSubtree: true,
|
||||
done: false,
|
||||
leaf: function (relativeStart: number, relativeLength: number, ll: LineLeaf) {
|
||||
leaf: function (this: ILineIndexWalker, relativeStart: number, relativeLength: number, ll: LineLeaf) {
|
||||
if (!f(ll, relativeStart, relativeLength)) {
|
||||
this.done = true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"out": "../../built/local/tsserver.js",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
let debugObjectHost = (<any>this);
|
||||
let debugObjectHost = new Function("return this")();
|
||||
|
||||
// We need to use 'null' to interface with the managed side.
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
"outFile": "../../built/local/typescriptServices.js",
|
||||
|
|
Loading…
Reference in a new issue