Skip to content

Commit 1d5dcf0

Browse files
author
Arthur Ozga
committed
changes that are non-breaking
1 parent aed48ec commit 1d5dcf0

18 files changed

+60
-57
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11920,7 +11920,7 @@ namespace ts {
1192011920
// Intentional fall-through
1192111921
case SyntaxKind.NumericLiteral:
1192211922
// index access
11923-
if (node.parent.kind == SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).argumentExpression === node) {
11923+
if (node.parent.kind === SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).argumentExpression === node) {
1192411924
let objectType = checkExpression((<ElementAccessExpression>node.parent).expression);
1192511925
if (objectType === unknownType) return undefined;
1192611926
let apparentType = getApparentType(objectType);

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ namespace ts {
572572
export function getNormalizedPathComponents(path: string, currentDirectory: string) {
573573
path = normalizeSlashes(path);
574574
let rootLength = getRootLength(path);
575-
if (rootLength == 0) {
575+
if (rootLength === 0) {
576576
// If the path is not rooted it is relative to current directory
577577
path = combinePaths(normalizeSlashes(currentDirectory), path);
578578
rootLength = getRootLength(path);

src/compiler/emitter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
320320

321321
let prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
322322
// Line/Comma delimiters
323-
if (lastEncodedSourceMapSpan.emittedLine == lastRecordedSourceMapSpan.emittedLine) {
323+
if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {
324324
// Emit comma to separate the entry
325325
if (sourceMapData.sourceMapMappings) {
326326
sourceMapData.sourceMapMappings += ",";
@@ -403,8 +403,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
403403

404404
// If this location wasn't recorded or the location in source is going backwards, record the span
405405
if (!lastRecordedSourceMapSpan ||
406-
lastRecordedSourceMapSpan.emittedLine != emittedLine ||
407-
lastRecordedSourceMapSpan.emittedColumn != emittedColumn ||
406+
lastRecordedSourceMapSpan.emittedLine !== emittedLine ||
407+
lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||
408408
(lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&
409409
(lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
410410
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {
@@ -654,7 +654,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
654654
if (nodeIsSynthesized(node)) {
655655
return emitNodeWithoutSourceMap(node);
656656
}
657-
if (node.kind != SyntaxKind.SourceFile) {
657+
if (node.kind !== SyntaxKind.SourceFile) {
658658
recordEmitNodeStartSpan(node);
659659
emitNodeWithoutSourceMap(node);
660660
recordEmitNodeEndSpan(node);
@@ -1962,7 +1962,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
19621962

19631963
// Make sure we consider all nested cast expressions, e.g.:
19641964
// (<any><number><any>-A).x;
1965-
while (operand.kind == SyntaxKind.TypeAssertionExpression) {
1965+
while (operand.kind === SyntaxKind.TypeAssertionExpression) {
19661966
operand = (<TypeAssertion>operand).expression;
19671967
}
19681968

src/compiler/scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ namespace ts {
934934
error(Diagnostics.Unexpected_end_of_text);
935935
isInvalidExtendedEscape = true;
936936
}
937-
else if (text.charCodeAt(pos) == CharacterCodes.closeBrace) {
937+
else if (text.charCodeAt(pos) === CharacterCodes.closeBrace) {
938938
// Only swallow the following character up if it's a '}'.
939939
pos++;
940940
}

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace ts {
4242
// Pool writers to avoid needing to allocate them for every symbol we write.
4343
let stringWriters: StringSymbolWriter[] = [];
4444
export function getSingleLineStringWriter(): StringSymbolWriter {
45-
if (stringWriters.length == 0) {
45+
if (stringWriters.length === 0) {
4646
let str = "";
4747

4848
let writeText: (text: string) => void = text => str += text;

src/harness/fourslash.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,15 @@ module FourSlash {
831831
if (expectedText !== undefined) {
832832
assert.notEqual(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
833833
}
834+
// TODO: should be '==='?
834835
if (expectedDocumentation != undefined) {
835836
assert.notEqual(actualQuickInfoDocumentation, expectedDocumentation, this.messageAtLastKnownMarker("quick info doc comment"));
836837
}
837838
} else {
838839
if (expectedText !== undefined) {
839840
assert.equal(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
840841
}
842+
// TODO: should be '==='?
841843
if (expectedDocumentation != undefined) {
842844
assert.equal(actualQuickInfoDocumentation, expectedDocumentation, assertionMessage("quick info doc"));
843845
}
@@ -1820,7 +1822,7 @@ module FourSlash {
18201822
}
18211823

18221824
private verifyProjectInfo(expected: string[]) {
1823-
if (this.testType == FourSlashTestType.Server) {
1825+
if (this.testType === FourSlashTestType.Server) {
18241826
let actual = (<ts.server.SessionClient>this.languageService).getProjectInfo(
18251827
this.activeFile.fileName,
18261828
/* needFileNameList */ true
@@ -1937,7 +1939,7 @@ module FourSlash {
19371939
}
19381940
}
19391941

1940-
if (expected != actual) {
1942+
if (expected !== actual) {
19411943
this.raiseError('verifyNavigationItemsCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.');
19421944
}
19431945
}
@@ -1984,7 +1986,7 @@ module FourSlash {
19841986
var items = this.languageService.getNavigationBarItems(this.activeFile.fileName);
19851987
var actual = this.getNavigationBarItemsCount(items);
19861988

1987-
if (expected != actual) {
1989+
if (expected !== actual) {
19881990
this.raiseError('verifyGetScriptLexicalStructureListCount failed - found: ' + actual + ' navigation items, expected: ' + expected + '.');
19891991
}
19901992
}
@@ -2402,6 +2404,7 @@ module FourSlash {
24022404
globalOptions[match[1]] = match[2];
24032405
}
24042406
}
2407+
// TODO: should be '==='?
24052408
} else if (line == '' || lineLength === 0) {
24062409
// Previously blank lines between fourslash content caused it to be considered as 2 files,
24072410
// Remove this behavior since it just causes errors now

src/harness/projectsRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class ProjectRunner extends RunnerBase {
241241
if (Harness.Compiler.isJS(fileName)) {
242242
// Make sure if there is URl we have it cleaned up
243243
var indexOfSourceMapUrl = data.lastIndexOf("//# sourceMappingURL=");
244-
if (indexOfSourceMapUrl != -1) {
244+
if (indexOfSourceMapUrl !== -1) {
245245
data = data.substring(0, indexOfSourceMapUrl + 21) + cleanProjectUrl(data.substring(indexOfSourceMapUrl + 21));
246246
}
247247
}

src/server/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ namespace ts.server {
219219

220220
var request = this.processRequest<protocol.CompletionDetailsRequest>(CommandNames.CompletionDetails, args);
221221
var response = this.processResponse<protocol.CompletionDetailsResponse>(request);
222-
Debug.assert(response.body.length == 1, "Unexpected length of completion details response body.");
222+
Debug.assert(response.body.length === 1, "Unexpected length of completion details response body.");
223223
return response.body[0];
224224
}
225225

@@ -429,8 +429,8 @@ namespace ts.server {
429429
if (!this.lastRenameEntry ||
430430
this.lastRenameEntry.fileName !== fileName ||
431431
this.lastRenameEntry.position !== position ||
432-
this.lastRenameEntry.findInStrings != findInStrings ||
433-
this.lastRenameEntry.findInComments != findInComments) {
432+
this.lastRenameEntry.findInStrings !== findInStrings ||
433+
this.lastRenameEntry.findInComments !== findInComments) {
434434
this.getRenameInfo(fileName, position, findInStrings, findInComments);
435435
}
436436

src/server/editorServices.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ namespace ts.server {
629629
for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) {
630630
var f = this.openFilesReferenced[i];
631631
// if f was referenced by the removed project, remember it
632-
if (f.defaultProject == removedProject) {
632+
if (f.defaultProject === removedProject) {
633633
f.defaultProject = undefined;
634634
orphanFiles.push(f);
635635
}
@@ -656,7 +656,7 @@ namespace ts.server {
656656
for (var i = 0, len = this.inferredProjects.length; i < len; i++) {
657657
var inferredProject = this.inferredProjects[i];
658658
inferredProject.updateGraph();
659-
if (inferredProject != excludedProject) {
659+
if (inferredProject !== excludedProject) {
660660
if (inferredProject.getSourceFile(info)) {
661661
info.defaultProject = inferredProject;
662662
referencingProjects.push(inferredProject);
@@ -710,7 +710,7 @@ namespace ts.server {
710710
var rootFile = this.openFileRoots[i];
711711
var rootedProject = rootFile.defaultProject;
712712
var referencingProjects = this.findReferencingProjects(rootFile, rootedProject);
713-
if (referencingProjects.length == 0) {
713+
if (referencingProjects.length === 0) {
714714
rootFile.defaultProject = rootedProject;
715715
openFileRoots.push(rootFile);
716716
}
@@ -1082,7 +1082,7 @@ namespace ts.server {
10821082

10831083
for (var k = this.endBranch.length - 1; k >= 0; k--) {
10841084
(<LineNode>this.endBranch[k]).updateCounts();
1085-
if (this.endBranch[k].charCount() == 0) {
1085+
if (this.endBranch[k].charCount() === 0) {
10861086
lastZeroCount = this.endBranch[k];
10871087
if (k > 0) {
10881088
branchParent = <LineNode>this.endBranch[k - 1];
@@ -1147,7 +1147,7 @@ namespace ts.server {
11471147
post(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection): LineCollection {
11481148
// have visited the path for start of range, now looking for end
11491149
// if range is on single line, we will never make this state transition
1150-
if (lineCollection == this.lineCollectionAtBranch) {
1150+
if (lineCollection === this.lineCollectionAtBranch) {
11511151
this.state = CharRangeSection.End;
11521152
}
11531153
// always pop stack because post only called when child has been visited
@@ -1159,7 +1159,7 @@ namespace ts.server {
11591159
// currentNode corresponds to parent, but in the new tree
11601160
var currentNode = this.stack[this.stack.length - 1];
11611161

1162-
if ((this.state == CharRangeSection.Entire) && (nodeType == CharRangeSection.Start)) {
1162+
if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) {
11631163
// if range is on single line, we will never make this state transition
11641164
this.state = CharRangeSection.Start;
11651165
this.branchNode = currentNode;
@@ -1176,12 +1176,12 @@ namespace ts.server {
11761176
switch (nodeType) {
11771177
case CharRangeSection.PreStart:
11781178
this.goSubtree = false;
1179-
if (this.state != CharRangeSection.End) {
1179+
if (this.state !== CharRangeSection.End) {
11801180
currentNode.add(lineCollection);
11811181
}
11821182
break;
11831183
case CharRangeSection.Start:
1184-
if (this.state == CharRangeSection.End) {
1184+
if (this.state === CharRangeSection.End) {
11851185
this.goSubtree = false;
11861186
}
11871187
else {
@@ -1191,7 +1191,7 @@ namespace ts.server {
11911191
}
11921192
break;
11931193
case CharRangeSection.Entire:
1194-
if (this.state != CharRangeSection.End) {
1194+
if (this.state !== CharRangeSection.End) {
11951195
child = fresh(lineCollection);
11961196
currentNode.add(child);
11971197
this.startPath[this.startPath.length] = child;
@@ -1208,7 +1208,7 @@ namespace ts.server {
12081208
this.goSubtree = false;
12091209
break;
12101210
case CharRangeSection.End:
1211-
if (this.state != CharRangeSection.End) {
1211+
if (this.state !== CharRangeSection.End) {
12121212
this.goSubtree = false;
12131213
}
12141214
else {
@@ -1221,7 +1221,7 @@ namespace ts.server {
12211221
break;
12221222
case CharRangeSection.PostEnd:
12231223
this.goSubtree = false;
1224-
if (this.state != CharRangeSection.Start) {
1224+
if (this.state !== CharRangeSection.Start) {
12251225
currentNode.add(lineCollection);
12261226
}
12271227
break;
@@ -1233,10 +1233,10 @@ namespace ts.server {
12331233
}
12341234
// just gather text from the leaves
12351235
leaf(relativeStart: number, relativeLength: number, ll: LineLeaf) {
1236-
if (this.state == CharRangeSection.Start) {
1236+
if (this.state === CharRangeSection.Start) {
12371237
this.initialText = ll.text.substring(0, relativeStart);
12381238
}
1239-
else if (this.state == CharRangeSection.Entire) {
1239+
else if (this.state === CharRangeSection.Entire) {
12401240
this.initialText = ll.text.substring(0, relativeStart);
12411241
this.trailingText = ll.text.substring(relativeStart + relativeLength);
12421242
}
@@ -1499,8 +1499,8 @@ namespace ts.server {
14991499
function editFlat(source: string, s: number, dl: number, nt = "") {
15001500
return source.substring(0, s) + nt + source.substring(s + dl, source.length);
15011501
}
1502-
if (this.root.charCount() == 0) {
1503-
// TODO: assert deleteLength == 0
1502+
if (this.root.charCount() === 0) {
1503+
// TODO: assert deleteLength === 0
15041504
if (newText) {
15051505
this.load(LineIndex.linesFromText(newText).lines);
15061506
return this;
@@ -1528,7 +1528,7 @@ namespace ts.server {
15281528
// check whether last characters deleted are line break
15291529
var e = pos + deleteLength;
15301530
var lineInfo = this.charOffsetToLineNumberAndPos(e);
1531-
if ((lineInfo && (lineInfo.offset == 0))) {
1531+
if ((lineInfo && (lineInfo.offset === 0))) {
15321532
// move range end just past line that will merge with previous line
15331533
deleteLength += lineInfo.text.length;
15341534
// store text by appending to end of insertedText
@@ -1574,7 +1574,7 @@ namespace ts.server {
15741574
interiorNodes[i].totalChars = charCount;
15751575
interiorNodes[i].totalLines = lineCount;
15761576
}
1577-
if (interiorNodes.length == 1) {
1577+
if (interiorNodes.length === 1) {
15781578
return interiorNodes[0];
15791579
}
15801580
else {
@@ -1585,7 +1585,7 @@ namespace ts.server {
15851585
static linesFromText(text: string) {
15861586
var lineStarts = ts.computeLineStarts(text);
15871587

1588-
if (lineStarts.length == 0) {
1588+
if (lineStarts.length === 0) {
15891589
return { lines: <string[]>[], lineMap: lineStarts };
15901590
}
15911591
var lines = <string[]>new Array(lineStarts.length);
@@ -1821,7 +1821,7 @@ namespace ts.server {
18211821
findChildIndex(child: LineCollection) {
18221822
var childIndex = 0;
18231823
var clen = this.children.length;
1824-
while ((this.children[childIndex] != child) && (childIndex < clen)) childIndex++;
1824+
while ((this.children[childIndex] !== child) && (childIndex < clen)) childIndex++;
18251825
return childIndex;
18261826
}
18271827

@@ -1830,7 +1830,7 @@ namespace ts.server {
18301830
var clen = this.children.length;
18311831
var nodeCount = nodes.length;
18321832
// if child is last and there is more room and only one node to place, place it
1833-
if ((clen < lineCollectionCapacity) && (childIndex == (clen - 1)) && (nodeCount == 1)) {
1833+
if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) {
18341834
this.add(nodes[0]);
18351835
this.updateCounts();
18361836
return [];
@@ -1854,13 +1854,13 @@ namespace ts.server {
18541854
var splitNode = <LineNode>splitNodes[0];
18551855
while (nodeIndex < nodeCount) {
18561856
splitNode.add(nodes[nodeIndex++]);
1857-
if (splitNode.children.length == lineCollectionCapacity) {
1857+
if (splitNode.children.length === lineCollectionCapacity) {
18581858
splitNodeIndex++;
18591859
splitNode = <LineNode>splitNodes[splitNodeIndex];
18601860
}
18611861
}
18621862
for (i = splitNodes.length - 1; i >= 0; i--) {
1863-
if (splitNodes[i].children.length == 0) {
1863+
if (splitNodes[i].children.length === 0) {
18641864
splitNodes.length--;
18651865
}
18661866
}

src/server/node.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ declare module NodeJS {
584584
export interface Response extends Message {
585585
request_seq: number;
586586
success: boolean;
587-
/** Contains error message if success == false. */
587+
/** Contains error message if success === false. */
588588
message?: string;
589-
/** Contains message body if success == true. */
589+
/** Contains message body if success === true. */
590590
body?: any;
591591
}
592592

0 commit comments

Comments
 (0)