remove all StrictNullOverride

related to #78168
This commit is contained in:
Joao Moreno 2019-08-30 16:42:25 +02:00
parent dedf0de944
commit e354c8d921
8 changed files with 33 additions and 82 deletions

View file

@ -220,13 +220,7 @@ export class InputBox extends Widget {
});
}
setTimeout(() => {
if (!this.input) {
return;
}
this.updateMirror();
}, 0);
setTimeout(() => this.updateMirror(), 0);
// Support actions
if (this.options.actions) {
@ -246,21 +240,17 @@ export class InputBox extends Widget {
}
public setPlaceHolder(placeHolder: string): void {
if (this.input) {
this.input.setAttribute('placeholder', placeHolder);
this.input.title = placeHolder;
}
this.input.setAttribute('placeholder', placeHolder);
this.input.title = placeHolder;
}
public setAriaLabel(label: string): void {
this.ariaLabel = label;
if (this.input) {
if (label) {
this.input.setAttribute('aria-label', this.ariaLabel);
} else {
this.input.removeAttribute('aria-label');
}
if (label) {
this.input.setAttribute('aria-label', this.ariaLabel);
} else {
this.input.removeAttribute('aria-label');
}
}
@ -560,20 +550,18 @@ export class InputBox extends Widget {
}
protected applyStyles(): void {
if (this.element) {
const background = this.inputBackground ? this.inputBackground.toString() : null;
const foreground = this.inputForeground ? this.inputForeground.toString() : null;
const border = this.inputBorder ? this.inputBorder.toString() : null;
const background = this.inputBackground ? this.inputBackground.toString() : null;
const foreground = this.inputForeground ? this.inputForeground.toString() : null;
const border = this.inputBorder ? this.inputBorder.toString() : null;
this.element.style.backgroundColor = background;
this.element.style.color = foreground;
this.input.style.backgroundColor = background;
this.input.style.color = foreground;
this.element.style.backgroundColor = background;
this.element.style.color = foreground;
this.input.style.backgroundColor = background;
this.input.style.color = foreground;
this.element.style.borderWidth = border ? '1px' : null;
this.element.style.borderStyle = border ? 'solid' : null;
this.element.style.borderColor = border;
}
this.element.style.borderWidth = border ? '1px' : null;
this.element.style.borderStyle = border ? 'solid' : null;
this.element.style.borderColor = border;
}
public layout(): void {
@ -594,13 +582,11 @@ export class InputBox extends Widget {
public dispose(): void {
this._hideMessage();
this.element = null!; // StrictNullOverride: nulling out ok in dispose
this.input = null!; // StrictNullOverride: nulling out ok in dispose
this.contextViewProvider = undefined;
this.message = null;
this.validation = undefined;
this.state = null!; // StrictNullOverride: nulling out ok in dispose
this.actionbar = undefined;
if (this.actionbar) {
this.actionbar.dispose();
}
super.dispose();
}

View file

@ -248,7 +248,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this.domNode.appendChild(this.scrollableElement.getDomNode());
container.appendChild(this.domNode);
this.disposables = [this.rangeMap, this.scrollableElement, this.cache];
this.disposables = [this.scrollableElement, this.cache];
this.scrollableElement.onScroll(this.onScroll, this, this.disposables);
domEvent(this.rowsContainer, TouchEventType.Change)(this.onTouchChange, this, this.disposables);

View file

@ -186,8 +186,4 @@ export class RangeMap {
return -1;
}
dispose() {
this.groups = null!; // StrictNullOverride: nulling out ok in dispose
}
}

View file

@ -79,11 +79,7 @@ export class RowCache<T> implements IDisposable {
return result;
}
private garbageCollect(): void {
if (!this.renderers) {
return;
}
dispose(): void {
this.cache.forEach((cachedRows, templateId) => {
for (const cachedRow of cachedRows) {
const renderer = this.getRenderer(templateId);
@ -96,12 +92,6 @@ export class RowCache<T> implements IDisposable {
this.cache.clear();
}
dispose(): void {
this.garbageCollect();
this.cache.clear();
this.renderers = null!; // StrictNullOverride: nulling out ok in dispose
}
private getRenderer(templateId: string): IListRenderer<T, any> {
const renderer = this.renderers.get(templateId);
if (!renderer) {
@ -109,4 +99,4 @@ export class RowCache<T> implements IDisposable {
}
return renderer;
}
}
}

View file

@ -402,11 +402,6 @@ export class Sash extends Disposable {
dispose(): void {
super.dispose();
if (this.el && this.el.parentElement) {
this.el.parentElement.removeChild(this.el);
}
this.el = null!; // StrictNullOverride: nulling out ok in dispose
this.el.remove();
}
}

View file

@ -110,15 +110,15 @@ export class Tree implements _.ITree {
}
get onDidFocus(): Event<void> {
return this.view && this.view.onDOMFocus;
return this.view.onDOMFocus;
}
get onDidBlur(): Event<void> {
return this.view && this.view.onDOMBlur;
return this.view.onDOMBlur;
}
get onDidScroll(): Event<void> {
return this.view && this.view.onDidScroll;
return this.view.onDidScroll;
}
public getHTMLElement(): HTMLElement {
@ -263,16 +263,8 @@ export class Tree implements _.ITree {
public dispose(): void {
this._onDispose.fire();
if (this.model !== null) {
this.model.dispose();
this.model = null!; // StrictNullOverride Nulling out ok in dispose
}
if (this.view !== null) {
this.view.dispose();
this.view = null!; // StrictNullOverride Nulling out ok in dispose
}
this.model.dispose();
this.view.dispose();
this._onDidChangeFocus.dispose();
this._onDidChangeSelection.dispose();
this._onHighlightChange.dispose();

View file

@ -192,7 +192,7 @@ export class ItemRegistry {
}
public dispose(): void {
this.items = null!; // StrictNullOverride: nulling out ok in dispose
this.items = {};
this._onDidRevealItem.dispose();
this._onExpandItem.dispose();
@ -1471,11 +1471,7 @@ export class TreeModel {
}
public dispose(): void {
if (this.registry) {
this.registry.dispose();
this.registry = null!; // StrictNullOverride: nulling out ok in dispose
}
this.registry.dispose();
this._onSetInput.dispose();
this._onDidSetInput.dispose();
this._onRefresh.dispose();

View file

@ -14,10 +14,6 @@ suite('RangeMap', () => {
rangeMap = new RangeMap();
});
teardown(() => {
rangeMap.dispose();
});
test('intersection', () => {
assert.deepEqual(Range.intersect({ start: 0, end: 0 }, { start: 0, end: 0 }), { start: 0, end: 0 });
assert.deepEqual(Range.intersect({ start: 0, end: 0 }, { start: 5, end: 5 }), { start: 0, end: 0 });
@ -346,4 +342,4 @@ suite('RangeMap', () => {
assert.equal(rangeMap.positionAt(4), -1);
});
});
});
});