mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-13 23:48:54 -05:00
Fix up API samples.
This commit is contained in:
@@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
|
||||
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
|
||||
});
|
||||
|
||||
var exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
@@ -1384,14 +1384,14 @@ declare module "typescript" {
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function computeLineStarts(text: string): number[];
|
||||
function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getLineStarts(sourceFile: SourceFile): number[];
|
||||
function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
line: number;
|
||||
character: number;
|
||||
};
|
||||
function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function isWhiteSpace(ch: number): boolean;
|
||||
function isLineBreak(ch: number): boolean;
|
||||
function isOctalDigit(ch: number): boolean;
|
||||
@@ -1469,9 +1469,9 @@ declare module "typescript" {
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
getPositionFromOneBasedLineAndCharacter(line: number, character: number): number;
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
}
|
||||
/**
|
||||
@@ -1946,8 +1946,8 @@ function compile(fileNames, options) {
|
||||
var emitResult = program.emit();
|
||||
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
allDiagnostics.forEach(function (diagnostic) {
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL));
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
console.log(diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL));
|
||||
});
|
||||
var exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
console.log("Process exiting with code '" + exitCode + "'.");
|
||||
|
||||
@@ -56,27 +56,27 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
|
||||
>diagnostics : ts.Diagnostic[]
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void
|
||||
>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void
|
||||
>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>allDiagnostics : ts.Diagnostic[]
|
||||
>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void
|
||||
>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void
|
||||
>diagnostic : ts.Diagnostic
|
||||
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.start : number
|
||||
>diagnostic : ts.Diagnostic
|
||||
>start : number
|
||||
|
||||
console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
|
||||
>console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any
|
||||
console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
|
||||
>console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
@@ -85,9 +85,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>fileName : string
|
||||
>lineChar.line + 1 : number
|
||||
>lineChar.line : number
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>line : number
|
||||
>lineChar.character + 1 : number
|
||||
>lineChar.character : number
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>character : number
|
||||
@@ -4368,15 +4370,15 @@ declare module "typescript" {
|
||||
>intrinsicName : string
|
||||
}
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
>StringLiteralType : StringLiteralType
|
||||
>Type : Type
|
||||
|
||||
text: string;
|
||||
|
||||
>text : string
|
||||
}
|
||||
>text : string
|
||||
}
|
||||
|
||||
interface ObjectType extends Type {
|
||||
|
||||
@@ -4386,8 +4388,8 @@ declare module "typescript" {
|
||||
|
||||
interface InterfaceType extends ObjectType {
|
||||
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
|
||||
@@ -4398,8 +4400,8 @@ declare module "typescript" {
|
||||
|
||||
>baseTypes : ObjectType[]
|
||||
>ObjectType : ObjectType
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
>declaredProperties : Symbol[]
|
||||
>Symbol : Symbol
|
||||
@@ -4735,16 +4737,16 @@ declare module "typescript" {
|
||||
|
||||
>file : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
start: number;
|
||||
|
||||
start: number;
|
||||
|
||||
>start : number
|
||||
|
||||
length: number;
|
||||
|
||||
>length : number
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
>messageText : string | DiagnosticMessageChain
|
||||
>DiagnosticMessageChain : DiagnosticMessageChain
|
||||
|
||||
@@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) {
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`)
|
||||
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1415,14 +1415,14 @@ declare module "typescript" {
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function computeLineStarts(text: string): number[];
|
||||
function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getLineStarts(sourceFile: SourceFile): number[];
|
||||
function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
line: number;
|
||||
character: number;
|
||||
};
|
||||
function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function isWhiteSpace(ch: number): boolean;
|
||||
function isLineBreak(ch: number): boolean;
|
||||
function isOctalDigit(ch: number): boolean;
|
||||
@@ -1500,9 +1500,9 @@ declare module "typescript" {
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
getPositionFromOneBasedLineAndCharacter(line: number, character: number): number;
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
}
|
||||
/**
|
||||
@@ -2003,8 +2003,8 @@ function delint(sourceFile) {
|
||||
ts.forEachChild(node, delintNode);
|
||||
}
|
||||
function report(node, message) {
|
||||
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
|
||||
console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message);
|
||||
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(sourceFile.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + message);
|
||||
}
|
||||
}
|
||||
exports.delint = delint;
|
||||
|
||||
@@ -224,28 +224,30 @@ export function delint(sourceFile: ts.SourceFile) {
|
||||
>Node : ts.Node
|
||||
>message : string
|
||||
|
||||
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
|
||||
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter
|
||||
>sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter
|
||||
>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>sourceFile : ts.SourceFile
|
||||
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>node.getStart() : number
|
||||
>node.getStart : (sourceFile?: ts.SourceFile) => number
|
||||
>node : ts.Node
|
||||
>getStart : (sourceFile?: ts.SourceFile) => number
|
||||
|
||||
console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`)
|
||||
>console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any
|
||||
console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`)
|
||||
>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>sourceFile.fileName : string
|
||||
>sourceFile : ts.SourceFile
|
||||
>fileName : string
|
||||
>lineChar.line + 1 : number
|
||||
>lineChar.line : number
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>line : number
|
||||
>lineChar.character + 1 : number
|
||||
>lineChar.character : number
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>character : number
|
||||
@@ -4512,15 +4514,15 @@ declare module "typescript" {
|
||||
>intrinsicName : string
|
||||
}
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
>StringLiteralType : StringLiteralType
|
||||
>Type : Type
|
||||
|
||||
text: string;
|
||||
|
||||
>text : string
|
||||
}
|
||||
>text : string
|
||||
}
|
||||
|
||||
interface ObjectType extends Type {
|
||||
|
||||
@@ -4530,8 +4532,8 @@ declare module "typescript" {
|
||||
|
||||
interface InterfaceType extends ObjectType {
|
||||
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
|
||||
@@ -4542,8 +4544,8 @@ declare module "typescript" {
|
||||
|
||||
>baseTypes : ObjectType[]
|
||||
>ObjectType : ObjectType
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
>declaredProperties : Symbol[]
|
||||
>Symbol : Symbol
|
||||
@@ -4879,16 +4881,16 @@ declare module "typescript" {
|
||||
|
||||
>file : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
start: number;
|
||||
|
||||
start: number;
|
||||
|
||||
>start : number
|
||||
|
||||
length: number;
|
||||
|
||||
>length : number
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
>messageText : string | DiagnosticMessageChain
|
||||
>DiagnosticMessageChain : DiagnosticMessageChain
|
||||
|
||||
@@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
|
||||
return {
|
||||
outputs: outputs,
|
||||
errors: errors.map(function (e) {
|
||||
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): "
|
||||
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): "
|
||||
+ ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
|
||||
})
|
||||
};
|
||||
@@ -1416,14 +1416,14 @@ declare module "typescript" {
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function computeLineStarts(text: string): number[];
|
||||
function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getLineStarts(sourceFile: SourceFile): number[];
|
||||
function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
line: number;
|
||||
character: number;
|
||||
};
|
||||
function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function isWhiteSpace(ch: number): boolean;
|
||||
function isLineBreak(ch: number): boolean;
|
||||
function isOctalDigit(ch: number): boolean;
|
||||
@@ -1501,9 +1501,9 @@ declare module "typescript" {
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
getPositionFromOneBasedLineAndCharacter(line: number, character: number): number;
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
}
|
||||
/**
|
||||
@@ -2005,7 +2005,7 @@ function transform(contents, compilerOptions) {
|
||||
return {
|
||||
outputs: outputs,
|
||||
errors: errors.map(function (e) {
|
||||
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
|
||||
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
|
||||
>diagnostics : ts.Diagnostic[]
|
||||
|
||||
return {
|
||||
>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; }
|
||||
>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; }
|
||||
|
||||
outputs: outputs,
|
||||
>outputs : any[]
|
||||
@@ -185,30 +185,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
|
||||
|
||||
errors: errors.map(function (e) {
|
||||
>errors : string[]
|
||||
>errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[]
|
||||
>errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[]
|
||||
>errors.map : <U>(callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[]
|
||||
>errors : ts.Diagnostic[]
|
||||
>map : <U>(callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[]
|
||||
>function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string
|
||||
>function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string
|
||||
>e : ts.Diagnostic
|
||||
|
||||
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): "
|
||||
>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string
|
||||
>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string
|
||||
>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string
|
||||
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): "
|
||||
>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string
|
||||
>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " : string
|
||||
>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) : string
|
||||
>e.file.fileName + "(" : string
|
||||
>e.file.fileName : string
|
||||
>e.file : ts.SourceFile
|
||||
>e : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>fileName : string
|
||||
>e.file.getLineAndCharacterFromPosition(e.start).line : number
|
||||
>e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter
|
||||
>e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>(e.file.getLineAndCharacterOfPosition(e.start).line + 1) : number
|
||||
>e.file.getLineAndCharacterOfPosition(e.start).line + 1 : number
|
||||
>e.file.getLineAndCharacterOfPosition(e.start).line : number
|
||||
>e.file.getLineAndCharacterOfPosition(e.start) : ts.LineAndCharacter
|
||||
>e.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>e.file : ts.SourceFile
|
||||
>e : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>e.start : number
|
||||
>e : ts.Diagnostic
|
||||
>start : number
|
||||
@@ -4464,15 +4466,15 @@ declare module "typescript" {
|
||||
>intrinsicName : string
|
||||
}
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
>StringLiteralType : StringLiteralType
|
||||
>Type : Type
|
||||
|
||||
text: string;
|
||||
|
||||
>text : string
|
||||
}
|
||||
>text : string
|
||||
}
|
||||
|
||||
interface ObjectType extends Type {
|
||||
|
||||
@@ -4482,8 +4484,8 @@ declare module "typescript" {
|
||||
|
||||
interface InterfaceType extends ObjectType {
|
||||
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
|
||||
@@ -4494,8 +4496,8 @@ declare module "typescript" {
|
||||
|
||||
>baseTypes : ObjectType[]
|
||||
>ObjectType : ObjectType
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
>declaredProperties : Symbol[]
|
||||
>Symbol : Symbol
|
||||
@@ -4831,16 +4833,16 @@ declare module "typescript" {
|
||||
|
||||
>file : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
start: number;
|
||||
|
||||
start: number;
|
||||
|
||||
>start : number
|
||||
|
||||
length: number;
|
||||
|
||||
>length : number
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
>messageText : string | DiagnosticMessageChain
|
||||
>DiagnosticMessageChain : DiagnosticMessageChain
|
||||
|
||||
@@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
if (diagnostic.file) {
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
||||
}
|
||||
else {
|
||||
console.log(` Error: ${diagnostic.messageText}`);
|
||||
@@ -1453,14 +1453,14 @@ declare module "typescript" {
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function computeLineStarts(text: string): number[];
|
||||
function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getLineStarts(sourceFile: SourceFile): number[];
|
||||
function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
line: number;
|
||||
character: number;
|
||||
};
|
||||
function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function isWhiteSpace(ch: number): boolean;
|
||||
function isLineBreak(ch: number): boolean;
|
||||
function isOctalDigit(ch: number): boolean;
|
||||
@@ -1538,9 +1538,9 @@ declare module "typescript" {
|
||||
scriptSnapshot: IScriptSnapshot;
|
||||
nameTable: Map<string>;
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterFromPosition(pos: number): LineAndCharacter;
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
getPositionFromOneBasedLineAndCharacter(line: number, character: number): number;
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
}
|
||||
/**
|
||||
@@ -2065,8 +2065,8 @@ function watch(rootFileNames, options) {
|
||||
var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName));
|
||||
allDiagnostics.forEach(function (diagnostic) {
|
||||
if (diagnostic.file) {
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
console.log(" Error " + diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
||||
}
|
||||
else {
|
||||
console.log(" Error: " + diagnostic.messageText);
|
||||
|
||||
@@ -317,11 +317,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
|
||||
>fileName : string
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void
|
||||
>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void
|
||||
>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>allDiagnostics : ts.Diagnostic[]
|
||||
>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void
|
||||
>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void
|
||||
>diagnostic : ts.Diagnostic
|
||||
|
||||
if (diagnostic.file) {
|
||||
@@ -329,20 +329,20 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.start : number
|
||||
>diagnostic : ts.Diagnostic
|
||||
>start : number
|
||||
|
||||
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
||||
>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any
|
||||
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
||||
>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
@@ -351,9 +351,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>fileName : string
|
||||
>lineChar.line + 1 : number
|
||||
>lineChar.line : number
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>line : number
|
||||
>lineChar.character + 1 : number
|
||||
>lineChar.character : number
|
||||
>lineChar : ts.LineAndCharacter
|
||||
>character : number
|
||||
@@ -4637,15 +4639,15 @@ declare module "typescript" {
|
||||
>intrinsicName : string
|
||||
}
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
interface StringLiteralType extends Type {
|
||||
|
||||
>StringLiteralType : StringLiteralType
|
||||
>Type : Type
|
||||
|
||||
text: string;
|
||||
|
||||
>text : string
|
||||
}
|
||||
>text : string
|
||||
}
|
||||
|
||||
interface ObjectType extends Type {
|
||||
|
||||
@@ -4655,8 +4657,8 @@ declare module "typescript" {
|
||||
|
||||
interface InterfaceType extends ObjectType {
|
||||
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
>InterfaceType : InterfaceType
|
||||
>ObjectType : ObjectType
|
||||
|
||||
typeParameters: TypeParameter[];
|
||||
|
||||
@@ -4667,8 +4669,8 @@ declare module "typescript" {
|
||||
|
||||
>baseTypes : ObjectType[]
|
||||
>ObjectType : ObjectType
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
declaredProperties: Symbol[];
|
||||
|
||||
>declaredProperties : Symbol[]
|
||||
>Symbol : Symbol
|
||||
@@ -5004,16 +5006,16 @@ declare module "typescript" {
|
||||
|
||||
>file : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
start: number;
|
||||
|
||||
start: number;
|
||||
|
||||
>start : number
|
||||
|
||||
length: number;
|
||||
|
||||
>length : number
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
messageText: string | DiagnosticMessageChain;
|
||||
|
||||
>messageText : string | DiagnosticMessageChain
|
||||
>DiagnosticMessageChain : DiagnosticMessageChain
|
||||
|
||||
@@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void
|
||||
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`);
|
||||
});
|
||||
|
||||
var exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
|
||||
@@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) {
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`)
|
||||
var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) {
|
||||
return {
|
||||
outputs: outputs,
|
||||
errors: errors.map(function (e) {
|
||||
return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): "
|
||||
return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): "
|
||||
+ ts.flattenDiagnosticMessageText(e.messageText, os.EOL);
|
||||
})
|
||||
};
|
||||
|
||||
@@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
if (diagnostic.file) {
|
||||
var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start);
|
||||
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
||||
var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
||||
}
|
||||
else {
|
||||
console.log(` Error: ${diagnostic.messageText}`);
|
||||
|
||||
Reference in New Issue
Block a user