Skip to content

Commit 05480e3

Browse files
committed
Merge pull request #2730 from Microsoft/exposeHelpers
Expose helpers
2 parents 695efa9 + a8e4803 commit 05480e3

12 files changed

+3231
-2207
lines changed

bin/tsc.js

+405-239
Large diffs are not rendered by default.

bin/tsserver.js

+746-504
Large diffs are not rendered by default.

bin/typescript.d.ts

+41-13
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ declare module "typescript" {
124124
VoidKeyword = 99,
125125
WhileKeyword = 100,
126126
WithKeyword = 101,
127-
AsKeyword = 102,
128-
ImplementsKeyword = 103,
129-
InterfaceKeyword = 104,
130-
LetKeyword = 105,
131-
PackageKeyword = 106,
132-
PrivateKeyword = 107,
133-
ProtectedKeyword = 108,
134-
PublicKeyword = 109,
135-
StaticKeyword = 110,
136-
YieldKeyword = 111,
127+
ImplementsKeyword = 102,
128+
InterfaceKeyword = 103,
129+
LetKeyword = 104,
130+
PackageKeyword = 105,
131+
PrivateKeyword = 106,
132+
ProtectedKeyword = 107,
133+
PublicKeyword = 108,
134+
StaticKeyword = 109,
135+
YieldKeyword = 110,
136+
AsKeyword = 111,
137137
AnyKeyword = 112,
138138
BooleanKeyword = 113,
139139
ConstructorKeyword = 114,
@@ -258,8 +258,8 @@ declare module "typescript" {
258258
LastReservedWord = 101,
259259
FirstKeyword = 66,
260260
LastKeyword = 125,
261-
FirstFutureReservedWord = 103,
262-
LastFutureReservedWord = 111,
261+
FirstFutureReservedWord = 102,
262+
LastFutureReservedWord = 110,
263263
FirstTypeNode = 141,
264264
LastTypeNode = 149,
265265
FirstPunctuation = 14,
@@ -310,6 +310,7 @@ declare module "typescript" {
310310
}
311311
interface Identifier extends PrimaryExpression {
312312
text: string;
313+
originalKeywordKind?: SyntaxKind;
313314
}
314315
interface QualifiedName extends Node {
315316
left: EntityName;
@@ -1181,6 +1182,34 @@ declare module "typescript" {
11811182
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
11821183
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
11831184
}
1185+
declare module "typescript" {
1186+
function getDefaultLibFileName(options: CompilerOptions): string;
1187+
function textSpanEnd(span: TextSpan): number;
1188+
function textSpanIsEmpty(span: TextSpan): boolean;
1189+
function textSpanContainsPosition(span: TextSpan, position: number): boolean;
1190+
function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
1191+
function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
1192+
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
1193+
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
1194+
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
1195+
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
1196+
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
1197+
function createTextSpan(start: number, length: number): TextSpan;
1198+
function createTextSpanFromBounds(start: number, end: number): TextSpan;
1199+
function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
1200+
function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
1201+
function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
1202+
let unchangedTextChangeRange: TextChangeRange;
1203+
/**
1204+
* Called to merge all the changes that occurred across several versions of a script snapshot
1205+
* into a single change. i.e. if a user keeps making successive edits to a script we will
1206+
* have a text change from V1 to V2, V2 to V3, ..., Vn.
1207+
*
1208+
* This function will then merge those changes into a single change range valid between V1 and
1209+
* Vn.
1210+
*/
1211+
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
1212+
}
11841213
declare module "typescript" {
11851214
function getNodeConstructor(kind: SyntaxKind): new () => Node;
11861215
function createNode(kind: SyntaxKind): Node;
@@ -1260,7 +1289,6 @@ declare module "typescript" {
12601289
getDocumentationComment(): SymbolDisplayPart[];
12611290
}
12621291
interface SourceFile {
1263-
getNamedDeclarations(): Declaration[];
12641292
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
12651293
getLineStarts(): number[];
12661294
getPositionOfLineAndCharacter(line: number, character: number): number;

bin/typescript.js

+864-583
Large diffs are not rendered by default.

bin/typescriptServices.d.ts

+41-13
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ declare module ts {
124124
VoidKeyword = 99,
125125
WhileKeyword = 100,
126126
WithKeyword = 101,
127-
AsKeyword = 102,
128-
ImplementsKeyword = 103,
129-
InterfaceKeyword = 104,
130-
LetKeyword = 105,
131-
PackageKeyword = 106,
132-
PrivateKeyword = 107,
133-
ProtectedKeyword = 108,
134-
PublicKeyword = 109,
135-
StaticKeyword = 110,
136-
YieldKeyword = 111,
127+
ImplementsKeyword = 102,
128+
InterfaceKeyword = 103,
129+
LetKeyword = 104,
130+
PackageKeyword = 105,
131+
PrivateKeyword = 106,
132+
ProtectedKeyword = 107,
133+
PublicKeyword = 108,
134+
StaticKeyword = 109,
135+
YieldKeyword = 110,
136+
AsKeyword = 111,
137137
AnyKeyword = 112,
138138
BooleanKeyword = 113,
139139
ConstructorKeyword = 114,
@@ -258,8 +258,8 @@ declare module ts {
258258
LastReservedWord = 101,
259259
FirstKeyword = 66,
260260
LastKeyword = 125,
261-
FirstFutureReservedWord = 103,
262-
LastFutureReservedWord = 111,
261+
FirstFutureReservedWord = 102,
262+
LastFutureReservedWord = 110,
263263
FirstTypeNode = 141,
264264
LastTypeNode = 149,
265265
FirstPunctuation = 14,
@@ -310,6 +310,7 @@ declare module ts {
310310
}
311311
interface Identifier extends PrimaryExpression {
312312
text: string;
313+
originalKeywordKind?: SyntaxKind;
313314
}
314315
interface QualifiedName extends Node {
315316
left: EntityName;
@@ -1181,6 +1182,34 @@ declare module ts {
11811182
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
11821183
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
11831184
}
1185+
declare module ts {
1186+
function getDefaultLibFileName(options: CompilerOptions): string;
1187+
function textSpanEnd(span: TextSpan): number;
1188+
function textSpanIsEmpty(span: TextSpan): boolean;
1189+
function textSpanContainsPosition(span: TextSpan, position: number): boolean;
1190+
function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
1191+
function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
1192+
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
1193+
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
1194+
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
1195+
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
1196+
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
1197+
function createTextSpan(start: number, length: number): TextSpan;
1198+
function createTextSpanFromBounds(start: number, end: number): TextSpan;
1199+
function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
1200+
function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
1201+
function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
1202+
let unchangedTextChangeRange: TextChangeRange;
1203+
/**
1204+
* Called to merge all the changes that occurred across several versions of a script snapshot
1205+
* into a single change. i.e. if a user keeps making successive edits to a script we will
1206+
* have a text change from V1 to V2, V2 to V3, ..., Vn.
1207+
*
1208+
* This function will then merge those changes into a single change range valid between V1 and
1209+
* Vn.
1210+
*/
1211+
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
1212+
}
11841213
declare module ts {
11851214
function getNodeConstructor(kind: SyntaxKind): new () => Node;
11861215
function createNode(kind: SyntaxKind): Node;
@@ -1260,7 +1289,6 @@ declare module ts {
12601289
getDocumentationComment(): SymbolDisplayPart[];
12611290
}
12621291
interface SourceFile {
1263-
getNamedDeclarations(): Declaration[];
12641292
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
12651293
getLineStarts(): number[];
12661294
getPositionOfLineAndCharacter(line: number, character: number): number;

0 commit comments

Comments
 (0)