From b40613c4d7436c953351e4192a06d07874374470 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 14:01:04 -0800 Subject: [PATCH 1/3] Stop using "dom" types --- Jakefile.js | 4 ++-- src/compiler/sys.ts | 3 +++ src/tsconfig-base.json | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index a786fb16ed3..3ee8476c842 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -456,7 +456,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts options += " --stripInternal"; } - options += " --target es5 --noUnusedLocals --noUnusedParameters"; + options += " --target es5 --lib es5,scripthost --noUnusedLocals --noUnusedParameters"; var cmd = host + " " + compilerPath + " " + options + " "; cmd = cmd + sources.join(" "); @@ -726,7 +726,7 @@ compileFile( // Appending exports at the end of the server library var tsserverLibraryDefinitionFileContents = - fs.readFileSync(tsserverLibraryDefinitionFile).toString() + + fs.readFileSync(tsserverLibraryDefinitionFile).toString() + "\r\nexport = ts;" + "\r\nexport as namespace ts;"; diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 966f0e0cd03..08dc4b6d81f 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,5 +1,8 @@ /// +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; +declare function clearTimeout(handle: any): void; + namespace ts { export type FileWatcherCallback = (fileName: string, removed?: boolean) => void; export type DirectoryWatcherCallback = (fileName: string) => void; diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index b4c82dbeeee..7c67f49d1e5 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "lib": ["es5", "scripthost"], "noEmitOnError": true, "noImplicitAny": true, "noImplicitThis": true, From d630980f793f381b9c8d43c15ef417d82feca588 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 14:25:24 -0800 Subject: [PATCH 2/3] Add dom declarations used by harness --- src/harness/harness.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 4094fc773ea..7bd9f0f316a 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -40,8 +40,22 @@ declare namespace NodeJS { ActiveXObject: typeof ActiveXObject; } } + +declare var window: {}; +declare var XMLHttpRequest: { + new(): XMLHttpRequest; +} +interface XMLHttpRequest { + readonly readyState: number; + readonly responseText: string; + readonly status: number; + open(method: string, url: string, async?: boolean, user?: string, password?: string): void; + send(data?: string): void; + setRequestHeader(header: string, value: string): void; +} /* tslint:enable:no-var-keyword */ + namespace Utils { // Setup some globals based on the current environment export const enum ExecutionEnvironment { From 9ebdd30ce41b30d1e8ef841e8a84a2d92df19ac1 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 17 Jan 2017 14:36:55 -0800 Subject: [PATCH 3/3] Remove added newline --- src/harness/harness.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 840ebaa1662..1dd41f9d81c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -55,7 +55,6 @@ interface XMLHttpRequest { } /* tslint:enable:no-var-keyword */ - namespace Utils { // Setup some globals based on the current environment export const enum ExecutionEnvironment {