mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Update typings for 1.6.2 release
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
/// <reference path="./typescriptServices.d.ts"/>
|
||||
|
||||
import ts = require('typescript-services');
|
||||
// transpile
|
||||
function transpile(input: string): string {
|
||||
return ts.transpile(input, { module: ts.ModuleKind.CommonJS });
|
||||
}
|
||||
|
||||
// formatter:
|
||||
var snapshot = ts.SimpleText.fromString('var foo = 123;');
|
||||
var formatter = new ts.Services.Formatting.TextSnapshot(snapshot);
|
||||
console.log(formatter);
|
||||
// compile
|
||||
function compile(fileNames: string[], options: ts.CompilerOptions): number {
|
||||
let program = ts.createProgram(fileNames, options);
|
||||
let emitResult = program.emit();
|
||||
|
||||
let allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
});
|
||||
|
||||
let exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
11462
typescript-services/typescriptServices.d.ts
vendored
11462
typescript-services/typescriptServices.d.ts
vendored
File diff suppressed because it is too large
Load Diff
1924
typescript/typescript.d.ts
vendored
1924
typescript/typescript.d.ts
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user