Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference path="typings/typescript/typescript.d.ts"/>
/// <reference path="typings/chalk/chalk.d.ts"/>
/// <reference path="typings/node/node.d.ts"/>
/// <reference path="typings/sanitize-filename/sanitize-filename.d.ts"/>
Expand Down Expand Up @@ -66,7 +65,7 @@ var defaultCompilerOptions: typescript.CompilerOptions = {
* Returns path to cache for source directory.
* @param {string} directory Directory with source code
* @return {string} Path with all special characters replaced with _ and
* prepended path to temporary directory
* prepended path to temporary directory
*/
function getCachePath(directory: string): string {
var sanitizeOptions = {
Expand Down Expand Up @@ -139,12 +138,14 @@ function isModified(tsPath: string, jsPath: string): boolean {
function compile(filename: string, options: typescript.CompilerOptions): void {
var host = typescript.createCompilerHost(options);
var program = typescript.createProgram([filename], options, host);
var checker = program.getTypeChecker(true);
var result = checker.emitFiles();
var result = program.emit();
if (emitError()) {
checkErrors(program.getDiagnostics()
.concat(checker.getDiagnostics()
.concat(result.diagnostics)));
checkErrors(program.getOptionsDiagnostics()
.concat(program.getGlobalDiagnostics())
.concat(program.getSyntacticDiagnostics())
.concat(program.getSemanticDiagnostics())
.concat(program.getDeclarationDiagnostics())
.concat(result.diagnostics));
}
}

Expand All @@ -158,11 +159,11 @@ function checkErrors(errors: typescript.Diagnostic[]): void {
return;
}
errors.forEach((diagnostic: typescript.Diagnostic): void => {
var position = diagnostic.file.getLineAndCharacterFromPosition(
var position = diagnostic.file.getLineAndCharacterOfPosition(
diagnostic.start);
console.error(
chalk.bgRed("" + diagnostic.code),
chalk.grey(`${diagnostic.file.filename}, (${position.line},${position.character})`),
chalk.grey(`${diagnostic.file.fileName}, (${position.line},${position.character})`),
diagnostic.messageText);
});
throw new Error("TypeScript Compilation Errors");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"chalk": "^0.5.1",
"sanitize-filename": "^1.3.0",
"typescript": "^1.4.1"
"typescript": "^1.6"
},
"devDependencies": {
"chai": "^1.10.0",
Expand Down
1 change: 0 additions & 1 deletion test/spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference path="../typings/typescript/typescript.d.ts"/>
/// <reference path="../typings/chai/chai.d.ts"/>
/// <reference path="../typings/mocha/mocha.d.ts"/>
/// <reference path="../typings/node/node.d.ts"/>
Expand Down
3 changes: 0 additions & 3 deletions tsd.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
"node/node.d.ts": {
"commit": "42c8a3b74c05f6887ce21dd63c6234e424f9f8fe"
},
"typescript/typescript.d.ts": {
"commit": "ed38db403a56da84731a6f77b545762ee477a45b"
},
"sanitize-filename/sanitize-filename.d.ts": {
"commit": "b3834d886a95789e6ab56e8244775ec10c5293d0"
}
Expand Down