typescript-src 1.0.1.2 → 1.4.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +21 -21
  3. data/CHANGES.md +14 -11
  4. data/Gemfile +7 -7
  5. data/README.md +38 -35
  6. data/Rakefile +24 -21
  7. data/lib/typescript-src.rb +64 -52
  8. data/lib/typescript-src/support/typescript/.npmignore +7 -12
  9. data/lib/typescript-src/support/typescript/CONTRIBUTING.md +74 -0
  10. data/lib/typescript-src/support/typescript/README.md +78 -0
  11. data/lib/typescript-src/support/typescript/ThirdPartyNoticeText.txt +10 -60
  12. data/lib/typescript-src/support/typescript/bin/lib.core.d.ts +1164 -0
  13. data/lib/typescript-src/support/typescript/bin/lib.core.es6.d.ts +4801 -0
  14. data/lib/typescript-src/support/typescript/bin/lib.d.ts +12097 -12836
  15. data/lib/typescript-src/support/typescript/bin/lib.dom.d.ts +13043 -0
  16. data/lib/typescript-src/support/typescript/bin/lib.es6.d.ts +17195 -0
  17. data/lib/typescript-src/support/typescript/bin/lib.scriptHost.d.ts +38 -0
  18. data/lib/typescript-src/support/typescript/bin/lib.webworker.d.ts +1652 -0
  19. data/lib/typescript-src/support/typescript/bin/tsc +2 -2
  20. data/lib/typescript-src/support/typescript/bin/tsc.js +17276 -61916
  21. data/lib/typescript-src/support/typescript/bin/typescript.d.ts +1849 -0
  22. data/lib/typescript-src/support/typescript/bin/typescriptServices.d.ts +1849 -0
  23. data/lib/typescript-src/support/typescript/bin/typescriptServices.js +26273 -0
  24. data/lib/typescript-src/support/typescript/bin/typescriptServices_internal.d.ts +258 -0
  25. data/lib/typescript-src/support/typescript/bin/typescript_internal.d.ts +258 -0
  26. data/lib/typescript-src/support/typescript/package.json +69 -61
  27. data/lib/typescript-src/version.rb +4 -4
  28. data/test/test_type_script_src.rb +35 -35
  29. data/typescript-src.gemspec +22 -22
  30. metadata +16 -26
  31. data/lib/typescript-src/support/typescript/README.txt +0 -27
  32. data/lib/typescript-src/support/typescript/bin/resources/cs/cz/diagnosticMessages.generated.json +0 -374
  33. data/lib/typescript-src/support/typescript/bin/resources/cs/diagnosticMessages.generated.json +0 -374
  34. data/lib/typescript-src/support/typescript/bin/resources/cz/diagnosticMessages.generated.json +0 -374
  35. data/lib/typescript-src/support/typescript/bin/resources/de/diagnosticMessages.generated.json +0 -374
  36. data/lib/typescript-src/support/typescript/bin/resources/diagnosticMessages.generated.json +0 -374
  37. data/lib/typescript-src/support/typescript/bin/resources/en/diagnosticMessages.generated.json +0 -374
  38. data/lib/typescript-src/support/typescript/bin/resources/en/us/diagnosticMessages.generated.json +0 -374
  39. data/lib/typescript-src/support/typescript/bin/resources/es/diagnosticMessages.generated.json +0 -374
  40. data/lib/typescript-src/support/typescript/bin/resources/fr/diagnosticMessages.generated.json +0 -374
  41. data/lib/typescript-src/support/typescript/bin/resources/it/diagnosticMessages.generated.json +0 -374
  42. data/lib/typescript-src/support/typescript/bin/resources/ja/diagnosticMessages.generated.json +0 -374
  43. data/lib/typescript-src/support/typescript/bin/resources/ja/jp/diagnosticMessages.generated.json +0 -374
  44. data/lib/typescript-src/support/typescript/bin/resources/ko/diagnosticMessages.generated.json +0 -374
  45. data/lib/typescript-src/support/typescript/bin/resources/ko/kr/diagnosticMessages.generated.json +0 -374
  46. data/lib/typescript-src/support/typescript/bin/resources/pl/diagnosticMessages.generated.json +0 -374
  47. data/lib/typescript-src/support/typescript/bin/resources/pt/br/diagnosticMessages.generated.json +0 -374
  48. data/lib/typescript-src/support/typescript/bin/resources/pt/diagnosticMessages.generated.json +0 -374
  49. data/lib/typescript-src/support/typescript/bin/resources/ru/diagnosticMessages.generated.json +0 -374
  50. data/lib/typescript-src/support/typescript/bin/resources/tr/diagnosticMessages.generated.json +0 -374
  51. data/lib/typescript-src/support/typescript/bin/resources/zh/cn/diagnosticMessages.generated.json +0 -373
  52. data/lib/typescript-src/support/typescript/bin/resources/zh/tw/diagnosticMessages.generated.json +0 -373
  53. data/lib/typescript-src/support/typescript/bin/typescript.js +0 -61516
@@ -0,0 +1,258 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+ declare module ts {
17
+ const enum Ternary {
18
+ False = 0,
19
+ Maybe = 1,
20
+ True = -1,
21
+ }
22
+ const enum Comparison {
23
+ LessThan = -1,
24
+ EqualTo = 0,
25
+ GreaterThan = 1,
26
+ }
27
+ interface StringSet extends Map<any> {
28
+ }
29
+ function forEach<T, U>(array: T[], callback: (element: T) => U): U;
30
+ function contains<T>(array: T[], value: T): boolean;
31
+ function indexOf<T>(array: T[], value: T): number;
32
+ function countWhere<T>(array: T[], predicate: (x: T) => boolean): number;
33
+ function filter<T>(array: T[], f: (x: T) => boolean): T[];
34
+ function map<T, U>(array: T[], f: (x: T) => U): U[];
35
+ function concatenate<T>(array1: T[], array2: T[]): T[];
36
+ function deduplicate<T>(array: T[]): T[];
37
+ function sum(array: any[], prop: string): number;
38
+ /**
39
+ * Returns the last element of an array if non-empty, undefined otherwise.
40
+ */
41
+ function lastOrUndefined<T>(array: T[]): T;
42
+ function binarySearch(array: number[], value: number): number;
43
+ function hasProperty<T>(map: Map<T>, key: string): boolean;
44
+ function getProperty<T>(map: Map<T>, key: string): T;
45
+ function isEmpty<T>(map: Map<T>): boolean;
46
+ function clone<T>(object: T): T;
47
+ function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
48
+ function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
49
+ function lookUp<T>(map: Map<T>, key: string): T;
50
+ function mapToArray<T>(map: Map<T>): T[];
51
+ /**
52
+ * Creates a map from the elements of an array.
53
+ *
54
+ * @param array the array of input elements.
55
+ * @param makeKey a function that produces a key for a given element.
56
+ *
57
+ * This function makes no effort to avoid collisions; if any two elements produce
58
+ * the same key with the given 'makeKey' function, then the element with the higher
59
+ * index in the array will be the one associated with the produced key.
60
+ */
61
+ function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
62
+ var localizedDiagnosticMessages: Map<string>;
63
+ function getLocaleSpecificMessage(message: string): string;
64
+ function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
65
+ function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic;
66
+ function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain;
67
+ function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain;
68
+ function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic;
69
+ function compareValues<T>(a: T, b: T): Comparison;
70
+ function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number;
71
+ function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
72
+ function normalizeSlashes(path: string): string;
73
+ function getRootLength(path: string): number;
74
+ var directorySeparator: string;
75
+ function normalizePath(path: string): string;
76
+ function getDirectoryPath(path: string): string;
77
+ function isUrl(path: string): boolean;
78
+ function isRootedDiskPath(path: string): boolean;
79
+ function getNormalizedPathComponents(path: string, currentDirectory: string): string[];
80
+ function getNormalizedAbsolutePath(filename: string, currentDirectory: string): string;
81
+ function getNormalizedPathFromPathComponents(pathComponents: string[]): string;
82
+ function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string;
83
+ function getBaseFilename(path: string): string;
84
+ function combinePaths(path1: string, path2: string): string;
85
+ function fileExtensionIs(path: string, extension: string): boolean;
86
+ function removeFileExtension(path: string): string;
87
+ /** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names
88
+ * or string literals. If the information encoded in the map changes, this needs to be revisited. */
89
+ function escapeString(s: string): string;
90
+ interface ObjectAllocator {
91
+ getNodeConstructor(kind: SyntaxKind): new () => Node;
92
+ getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
93
+ getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
94
+ getSignatureConstructor(): new (checker: TypeChecker) => Signature;
95
+ }
96
+ var objectAllocator: ObjectAllocator;
97
+ const enum AssertionLevel {
98
+ None = 0,
99
+ Normal = 1,
100
+ Aggressive = 2,
101
+ VeryAggressive = 3,
102
+ }
103
+ module Debug {
104
+ function shouldAssert(level: AssertionLevel): boolean;
105
+ function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void;
106
+ function fail(message?: string): void;
107
+ }
108
+ }
109
+ declare module ts {
110
+ interface System {
111
+ args: string[];
112
+ newLine: string;
113
+ useCaseSensitiveFileNames: boolean;
114
+ write(s: string): void;
115
+ readFile(fileName: string, encoding?: string): string;
116
+ writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
117
+ watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher;
118
+ resolvePath(path: string): string;
119
+ fileExists(path: string): boolean;
120
+ directoryExists(path: string): boolean;
121
+ createDirectory(directoryName: string): void;
122
+ getExecutingFilePath(): string;
123
+ getCurrentDirectory(): string;
124
+ getMemoryUsage?(): number;
125
+ exit(exitCode?: number): void;
126
+ }
127
+ interface FileWatcher {
128
+ close(): void;
129
+ }
130
+ var sys: System;
131
+ }
132
+ declare module ts {
133
+ interface ReferencePathMatchResult {
134
+ fileReference?: FileReference;
135
+ diagnosticMessage?: DiagnosticMessage;
136
+ isNoDefaultLib?: boolean;
137
+ }
138
+ function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration;
139
+ interface StringSymbolWriter extends SymbolWriter {
140
+ string(): string;
141
+ }
142
+ function getSingleLineStringWriter(): StringSymbolWriter;
143
+ function releaseStringWriter(writer: StringSymbolWriter): void;
144
+ function getFullWidth(node: Node): number;
145
+ function hasFlag(val: number, flag: number): boolean;
146
+ function containsParseError(node: Node): boolean;
147
+ function getSourceFileOfNode(node: Node): SourceFile;
148
+ function nodePosToString(node: Node): string;
149
+ function getStartPosOfNode(node: Node): number;
150
+ function isMissingNode(node: Node): boolean;
151
+ function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number;
152
+ function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string;
153
+ function getTextOfNodeFromSourceText(sourceText: string, node: Node): string;
154
+ function getTextOfNode(node: Node): string;
155
+ function escapeIdentifier(identifier: string): string;
156
+ function unescapeIdentifier(identifier: string): string;
157
+ function declarationNameToString(name: DeclarationName): string;
158
+ function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic;
159
+ function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic;
160
+ function getErrorSpanForNode(node: Node): Node;
161
+ function isExternalModule(file: SourceFile): boolean;
162
+ function isDeclarationFile(file: SourceFile): boolean;
163
+ function isConstEnumDeclaration(node: Node): boolean;
164
+ function isConst(node: Node): boolean;
165
+ function isLet(node: Node): boolean;
166
+ function isPrologueDirective(node: Node): boolean;
167
+ function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[];
168
+ function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
169
+ var fullTripleSlashReferencePathRegEx: RegExp;
170
+ function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
171
+ function isAnyFunction(node: Node): boolean;
172
+ function isFunctionBlock(node: Node): boolean;
173
+ function isObjectLiteralMethod(node: Node): boolean;
174
+ function getContainingFunction(node: Node): FunctionLikeDeclaration;
175
+ function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
176
+ function getSuperContainer(node: Node): Node;
177
+ function getInvokedExpression(node: CallLikeExpression): Expression;
178
+ function isExpression(node: Node): boolean;
179
+ function isExternalModuleImportDeclaration(node: Node): boolean;
180
+ function getExternalModuleImportDeclarationExpression(node: Node): Expression;
181
+ function isInternalModuleImportDeclaration(node: Node): boolean;
182
+ function hasDotDotDotToken(node: Node): boolean;
183
+ function hasQuestionToken(node: Node): boolean;
184
+ function hasRestParameters(s: SignatureDeclaration): boolean;
185
+ function isLiteralKind(kind: SyntaxKind): boolean;
186
+ function isTextualLiteralKind(kind: SyntaxKind): boolean;
187
+ function isTemplateLiteralKind(kind: SyntaxKind): boolean;
188
+ function isInAmbientContext(node: Node): boolean;
189
+ function isDeclaration(node: Node): boolean;
190
+ function isStatement(n: Node): boolean;
191
+ function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean;
192
+ function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode;
193
+ function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray<TypeReferenceNode>;
194
+ function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<TypeReferenceNode>;
195
+ function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind): HeritageClause;
196
+ function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference): SourceFile;
197
+ function getAncestor(node: Node, kind: SyntaxKind): Node;
198
+ function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult;
199
+ function isKeyword(token: SyntaxKind): boolean;
200
+ function isTrivia(token: SyntaxKind): boolean;
201
+ function isModifier(token: SyntaxKind): boolean;
202
+ }
203
+ declare module ts {
204
+ interface ListItemInfo {
205
+ listItemIndex: number;
206
+ list: Node;
207
+ }
208
+ function getEndLinePosition(line: number, sourceFile: SourceFile): number;
209
+ function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
210
+ function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number;
211
+ function rangeContainsRange(r1: TextRange, r2: TextRange): boolean;
212
+ function startEndContainsRange(start: number, end: number, range: TextRange): boolean;
213
+ function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
214
+ function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean;
215
+ function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean;
216
+ function findListItemInfo(node: Node): ListItemInfo;
217
+ function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node;
218
+ function findContainingList(node: Node): Node;
219
+ function getTouchingWord(sourceFile: SourceFile, position: number): Node;
220
+ function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node;
221
+ /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
222
+ function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node;
223
+ /** Returns a token if position is in [start-of-leading-trivia, end) */
224
+ function getTokenAtPosition(sourceFile: SourceFile, position: number): Node;
225
+ /**
226
+ * The token on the left of the position is the token that strictly includes the position
227
+ * or sits to the left of the cursor if it is on a boundary. For example
228
+ *
229
+ * fo|o -> will return foo
230
+ * foo <comment> |bar -> will return foo
231
+ *
232
+ */
233
+ function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node;
234
+ function findNextToken(previousToken: Node, parent: Node): Node;
235
+ function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node;
236
+ function getNodeModifiers(node: Node): string;
237
+ function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node>;
238
+ function isToken(n: Node): boolean;
239
+ function isComment(kind: SyntaxKind): boolean;
240
+ function isPunctuation(kind: SyntaxKind): boolean;
241
+ function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean;
242
+ function compareDataObjects(dst: any, src: any): boolean;
243
+ }
244
+ declare module ts {
245
+ function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean;
246
+ function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart;
247
+ function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart;
248
+ function spacePart(): SymbolDisplayPart;
249
+ function keywordPart(kind: SyntaxKind): SymbolDisplayPart;
250
+ function punctuationPart(kind: SyntaxKind): SymbolDisplayPart;
251
+ function operatorPart(kind: SyntaxKind): SymbolDisplayPart;
252
+ function textPart(text: string): SymbolDisplayPart;
253
+ function lineBreakPart(): SymbolDisplayPart;
254
+ function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[];
255
+ function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
256
+ function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[];
257
+ function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
258
+ }
@@ -0,0 +1,258 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+ declare module "typescript" {
17
+ const enum Ternary {
18
+ False = 0,
19
+ Maybe = 1,
20
+ True = -1,
21
+ }
22
+ const enum Comparison {
23
+ LessThan = -1,
24
+ EqualTo = 0,
25
+ GreaterThan = 1,
26
+ }
27
+ interface StringSet extends Map<any> {
28
+ }
29
+ function forEach<T, U>(array: T[], callback: (element: T) => U): U;
30
+ function contains<T>(array: T[], value: T): boolean;
31
+ function indexOf<T>(array: T[], value: T): number;
32
+ function countWhere<T>(array: T[], predicate: (x: T) => boolean): number;
33
+ function filter<T>(array: T[], f: (x: T) => boolean): T[];
34
+ function map<T, U>(array: T[], f: (x: T) => U): U[];
35
+ function concatenate<T>(array1: T[], array2: T[]): T[];
36
+ function deduplicate<T>(array: T[]): T[];
37
+ function sum(array: any[], prop: string): number;
38
+ /**
39
+ * Returns the last element of an array if non-empty, undefined otherwise.
40
+ */
41
+ function lastOrUndefined<T>(array: T[]): T;
42
+ function binarySearch(array: number[], value: number): number;
43
+ function hasProperty<T>(map: Map<T>, key: string): boolean;
44
+ function getProperty<T>(map: Map<T>, key: string): T;
45
+ function isEmpty<T>(map: Map<T>): boolean;
46
+ function clone<T>(object: T): T;
47
+ function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
48
+ function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
49
+ function lookUp<T>(map: Map<T>, key: string): T;
50
+ function mapToArray<T>(map: Map<T>): T[];
51
+ /**
52
+ * Creates a map from the elements of an array.
53
+ *
54
+ * @param array the array of input elements.
55
+ * @param makeKey a function that produces a key for a given element.
56
+ *
57
+ * This function makes no effort to avoid collisions; if any two elements produce
58
+ * the same key with the given 'makeKey' function, then the element with the higher
59
+ * index in the array will be the one associated with the produced key.
60
+ */
61
+ function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
62
+ var localizedDiagnosticMessages: Map<string>;
63
+ function getLocaleSpecificMessage(message: string): string;
64
+ function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
65
+ function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic;
66
+ function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain;
67
+ function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain;
68
+ function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic;
69
+ function compareValues<T>(a: T, b: T): Comparison;
70
+ function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number;
71
+ function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
72
+ function normalizeSlashes(path: string): string;
73
+ function getRootLength(path: string): number;
74
+ var directorySeparator: string;
75
+ function normalizePath(path: string): string;
76
+ function getDirectoryPath(path: string): string;
77
+ function isUrl(path: string): boolean;
78
+ function isRootedDiskPath(path: string): boolean;
79
+ function getNormalizedPathComponents(path: string, currentDirectory: string): string[];
80
+ function getNormalizedAbsolutePath(filename: string, currentDirectory: string): string;
81
+ function getNormalizedPathFromPathComponents(pathComponents: string[]): string;
82
+ function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string;
83
+ function getBaseFilename(path: string): string;
84
+ function combinePaths(path1: string, path2: string): string;
85
+ function fileExtensionIs(path: string, extension: string): boolean;
86
+ function removeFileExtension(path: string): string;
87
+ /** NOTE: This *does not* support the full escape characters, it only supports the subset that can be used in file names
88
+ * or string literals. If the information encoded in the map changes, this needs to be revisited. */
89
+ function escapeString(s: string): string;
90
+ interface ObjectAllocator {
91
+ getNodeConstructor(kind: SyntaxKind): new () => Node;
92
+ getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
93
+ getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
94
+ getSignatureConstructor(): new (checker: TypeChecker) => Signature;
95
+ }
96
+ var objectAllocator: ObjectAllocator;
97
+ const enum AssertionLevel {
98
+ None = 0,
99
+ Normal = 1,
100
+ Aggressive = 2,
101
+ VeryAggressive = 3,
102
+ }
103
+ module Debug {
104
+ function shouldAssert(level: AssertionLevel): boolean;
105
+ function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void;
106
+ function fail(message?: string): void;
107
+ }
108
+ }
109
+ declare module "typescript" {
110
+ interface System {
111
+ args: string[];
112
+ newLine: string;
113
+ useCaseSensitiveFileNames: boolean;
114
+ write(s: string): void;
115
+ readFile(fileName: string, encoding?: string): string;
116
+ writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
117
+ watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher;
118
+ resolvePath(path: string): string;
119
+ fileExists(path: string): boolean;
120
+ directoryExists(path: string): boolean;
121
+ createDirectory(directoryName: string): void;
122
+ getExecutingFilePath(): string;
123
+ getCurrentDirectory(): string;
124
+ getMemoryUsage?(): number;
125
+ exit(exitCode?: number): void;
126
+ }
127
+ interface FileWatcher {
128
+ close(): void;
129
+ }
130
+ var sys: System;
131
+ }
132
+ declare module "typescript" {
133
+ interface ReferencePathMatchResult {
134
+ fileReference?: FileReference;
135
+ diagnosticMessage?: DiagnosticMessage;
136
+ isNoDefaultLib?: boolean;
137
+ }
138
+ function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration;
139
+ interface StringSymbolWriter extends SymbolWriter {
140
+ string(): string;
141
+ }
142
+ function getSingleLineStringWriter(): StringSymbolWriter;
143
+ function releaseStringWriter(writer: StringSymbolWriter): void;
144
+ function getFullWidth(node: Node): number;
145
+ function hasFlag(val: number, flag: number): boolean;
146
+ function containsParseError(node: Node): boolean;
147
+ function getSourceFileOfNode(node: Node): SourceFile;
148
+ function nodePosToString(node: Node): string;
149
+ function getStartPosOfNode(node: Node): number;
150
+ function isMissingNode(node: Node): boolean;
151
+ function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number;
152
+ function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string;
153
+ function getTextOfNodeFromSourceText(sourceText: string, node: Node): string;
154
+ function getTextOfNode(node: Node): string;
155
+ function escapeIdentifier(identifier: string): string;
156
+ function unescapeIdentifier(identifier: string): string;
157
+ function declarationNameToString(name: DeclarationName): string;
158
+ function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic;
159
+ function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic;
160
+ function getErrorSpanForNode(node: Node): Node;
161
+ function isExternalModule(file: SourceFile): boolean;
162
+ function isDeclarationFile(file: SourceFile): boolean;
163
+ function isConstEnumDeclaration(node: Node): boolean;
164
+ function isConst(node: Node): boolean;
165
+ function isLet(node: Node): boolean;
166
+ function isPrologueDirective(node: Node): boolean;
167
+ function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[];
168
+ function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
169
+ var fullTripleSlashReferencePathRegEx: RegExp;
170
+ function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
171
+ function isAnyFunction(node: Node): boolean;
172
+ function isFunctionBlock(node: Node): boolean;
173
+ function isObjectLiteralMethod(node: Node): boolean;
174
+ function getContainingFunction(node: Node): FunctionLikeDeclaration;
175
+ function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
176
+ function getSuperContainer(node: Node): Node;
177
+ function getInvokedExpression(node: CallLikeExpression): Expression;
178
+ function isExpression(node: Node): boolean;
179
+ function isExternalModuleImportDeclaration(node: Node): boolean;
180
+ function getExternalModuleImportDeclarationExpression(node: Node): Expression;
181
+ function isInternalModuleImportDeclaration(node: Node): boolean;
182
+ function hasDotDotDotToken(node: Node): boolean;
183
+ function hasQuestionToken(node: Node): boolean;
184
+ function hasRestParameters(s: SignatureDeclaration): boolean;
185
+ function isLiteralKind(kind: SyntaxKind): boolean;
186
+ function isTextualLiteralKind(kind: SyntaxKind): boolean;
187
+ function isTemplateLiteralKind(kind: SyntaxKind): boolean;
188
+ function isInAmbientContext(node: Node): boolean;
189
+ function isDeclaration(node: Node): boolean;
190
+ function isStatement(n: Node): boolean;
191
+ function isDeclarationOrFunctionExpressionOrCatchVariableName(name: Node): boolean;
192
+ function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode;
193
+ function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray<TypeReferenceNode>;
194
+ function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<TypeReferenceNode>;
195
+ function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind): HeritageClause;
196
+ function tryResolveScriptReference(program: Program, sourceFile: SourceFile, reference: FileReference): SourceFile;
197
+ function getAncestor(node: Node, kind: SyntaxKind): Node;
198
+ function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult;
199
+ function isKeyword(token: SyntaxKind): boolean;
200
+ function isTrivia(token: SyntaxKind): boolean;
201
+ function isModifier(token: SyntaxKind): boolean;
202
+ }
203
+ declare module "typescript" {
204
+ interface ListItemInfo {
205
+ listItemIndex: number;
206
+ list: Node;
207
+ }
208
+ function getEndLinePosition(line: number, sourceFile: SourceFile): number;
209
+ function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
210
+ function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number;
211
+ function rangeContainsRange(r1: TextRange, r2: TextRange): boolean;
212
+ function startEndContainsRange(start: number, end: number, range: TextRange): boolean;
213
+ function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
214
+ function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean;
215
+ function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean;
216
+ function findListItemInfo(node: Node): ListItemInfo;
217
+ function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node;
218
+ function findContainingList(node: Node): Node;
219
+ function getTouchingWord(sourceFile: SourceFile, position: number): Node;
220
+ function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node;
221
+ /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
222
+ function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node;
223
+ /** Returns a token if position is in [start-of-leading-trivia, end) */
224
+ function getTokenAtPosition(sourceFile: SourceFile, position: number): Node;
225
+ /**
226
+ * The token on the left of the position is the token that strictly includes the position
227
+ * or sits to the left of the cursor if it is on a boundary. For example
228
+ *
229
+ * fo|o -> will return foo
230
+ * foo <comment> |bar -> will return foo
231
+ *
232
+ */
233
+ function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node;
234
+ function findNextToken(previousToken: Node, parent: Node): Node;
235
+ function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node;
236
+ function getNodeModifiers(node: Node): string;
237
+ function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node>;
238
+ function isToken(n: Node): boolean;
239
+ function isComment(kind: SyntaxKind): boolean;
240
+ function isPunctuation(kind: SyntaxKind): boolean;
241
+ function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean;
242
+ function compareDataObjects(dst: any, src: any): boolean;
243
+ }
244
+ declare module "typescript" {
245
+ function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean;
246
+ function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart;
247
+ function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart;
248
+ function spacePart(): SymbolDisplayPart;
249
+ function keywordPart(kind: SyntaxKind): SymbolDisplayPart;
250
+ function punctuationPart(kind: SyntaxKind): SymbolDisplayPart;
251
+ function operatorPart(kind: SyntaxKind): SymbolDisplayPart;
252
+ function textPart(text: string): SymbolDisplayPart;
253
+ function lineBreakPart(): SymbolDisplayPart;
254
+ function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[];
255
+ function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
256
+ function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[];
257
+ function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
258
+ }