Skip to content

Commit 29d9768

Browse files
committed
Add null annotations for x: T[] = null
This code pattern indicates that the type should be nullable
1 parent 0318e90 commit 29d9768

19 files changed

Lines changed: 28 additions & 28 deletions

File tree

src/vs/base/browser/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class AnimationFrameQueueItem implements IDisposable {
347347
/**
348348
* The runners scheduled at the current animation frame
349349
*/
350-
let CURRENT_QUEUE: AnimationFrameQueueItem[] = null;
350+
let CURRENT_QUEUE: AnimationFrameQueueItem[] | null = null;
351351
/**
352352
* A flag to keep track if the native requestAnimationFrame was already called
353353
*/

src/vs/base/parts/tree/browser/treeImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class Tree implements _.ITree {
179179
return this.model.collapse(element, recursive);
180180
}
181181

182-
public collapseAll(elements: any[] = null, recursive: boolean = false): WinJS.Promise {
182+
public collapseAll(elements: any[] | null = null, recursive: boolean = false): WinJS.Promise {
183183
return this.model.collapseAll(elements, recursive);
184184
}
185185

src/vs/base/parts/tree/browser/treeModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ export class TreeModel {
10301030
return item.collapse(recursive);
10311031
}
10321032

1033-
public collapseAll(elements: any[] = null, recursive: boolean = false): WinJS.Promise {
1033+
public collapseAll(elements: any[] | null = null, recursive: boolean = false): WinJS.Promise {
10341034
if (!elements) {
10351035
elements = [this.input];
10361036
recursive = true;

src/vs/editor/browser/config/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function restoreFontInfo(storageService: IStorageService): void {
6262
if (typeof strStoredFontInfo !== 'string') {
6363
return;
6464
}
65-
let storedFontInfo: ISerializedFontInfo[] = null;
65+
let storedFontInfo: ISerializedFontInfo[] | null = null;
6666
try {
6767
storedFontInfo = JSON.parse(strStoredFontInfo);
6868
} catch (err) {

src/vs/editor/browser/controller/textAreaHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export class TextAreaHandler extends ViewPart {
250250
const metadata = LocalClipboardMetadataManager.INSTANCE.get(e.text);
251251

252252
let pasteOnNewLine = false;
253-
let multicursorText: string[] = null;
253+
let multicursorText: string[] | null = null;
254254
if (metadata) {
255255
pasteOnNewLine = (this._emptySelectionClipboard && metadata.isFromEmptySelection);
256256
multicursorText = metadata.multicursorText;

src/vs/editor/common/services/languagesRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class LanguagesRegistry {
159159

160160
resolvedLanguage.aliases.push(langId);
161161

162-
let langAliases: string[] = null;
162+
let langAliases: string[] | null = null;
163163
if (typeof lang.aliases !== 'undefined' && Array.isArray(lang.aliases)) {
164164
if (lang.aliases.length === 0) {
165165
// signal that this language should not get a name

src/vs/editor/contrib/dnd/dnd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
145145
let newCursorPosition = new Position(mouseEvent.target.position.lineNumber, mouseEvent.target.position.column);
146146

147147
if (this._dragSelection === null) {
148-
let newSelections: Selection[] = null;
148+
let newSelections: Selection[] | null = null;
149149
if (mouseEvent.event.shiftKey) {
150150
let primarySelection = this._editor.getSelection();
151151
let { selectionStartLineNumber, selectionStartColumn } = primarySelection;

src/vs/editor/contrib/folding/syntaxRangeProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class SyntaxRangeProvider implements RangeProvider {
4545
}
4646

4747
function collectSyntaxRanges(providers: FoldingRangeProvider[], model: ITextModel, cancellationToken: CancellationToken): Thenable<IFoldingRangeData[] | null> {
48-
let rangeData: IFoldingRangeData[] = null;
48+
let rangeData: IFoldingRangeData[] | null = null;
4949
let promises = providers.map((provider, i) => {
5050
return Promise.resolve(provider.provideFoldingRanges(model, foldingContext, cancellationToken)).then(ranges => {
5151
if (cancellationToken.isCancellationRequested) {

src/vs/editor/contrib/multicursor/multicursor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
476476
}
477477

478478
public selectAll(findController: CommonFindController): void {
479-
let matches: FindMatch[] = null;
479+
let matches: FindMatch[] | null = null;
480480

481481
const findState = findController.getState();
482482

src/vs/editor/standalone/common/monarch/monarchLexer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ class MonarchTokenizer implements modes.ITokenizationSupport {
518518
// regular expression group matching
519519
// these never need cloning or equality since they are only used within a line match
520520
let groupActions: monarchCommon.FuzzyAction[] = null;
521-
let groupMatches: string[] = null;
522-
let groupMatched: string[] = null;
521+
let groupMatches: string[] | null = null;
522+
let groupMatched: string[] | null = null;
523523
let groupRule: monarchCommon.IRule = null;
524524

525525
while (pos < lineLength) {
@@ -528,7 +528,7 @@ class MonarchTokenizer implements modes.ITokenizationSupport {
528528
const groupLen0 = groupActions ? groupActions.length : 0;
529529
const state = stack.state;
530530

531-
let matches: string[] = null;
531+
let matches: string[] | null = null;
532532
let matched: string | null = null;
533533
let action: monarchCommon.FuzzyAction | monarchCommon.FuzzyAction[] = null;
534534
let rule: monarchCommon.IRule = null;

0 commit comments

Comments
 (0)