提交 bb8bf06d 编写于 作者: I isidor

strictPropertyInitialization

#78168
上级 c880f7fe
......@@ -69,7 +69,7 @@ export class Gesture extends Disposable {
private static INSTANCE: Gesture;
private static HOLD_DELAY = 700;
private dispatched: boolean;
private dispatched = false;
private targets: HTMLElement[];
private handle: IDisposable | null;
......
......@@ -20,10 +20,12 @@ const GOLDEN_RATIO = {
rightMarginRatio: 0.1909
};
function createEmptyView(background: Color): ISplitViewView {
function createEmptyView(background: Color | undefined): ISplitViewView {
const element = $('.centered-layout-margin');
element.style.height = '100%';
element.style.backgroundColor = background.toString();
if (background) {
element.style.backgroundColor = background.toString();
}
return {
element,
......@@ -53,7 +55,7 @@ export class CenteredViewLayout implements IDisposable {
private splitView?: SplitView;
private width: number = 0;
private height: number = 0;
private style: ICenteredViewStyles;
private style: ICenteredViewStyles | undefined;
private didLayout = false;
private emptyViews: ISplitViewView[] | undefined;
private readonly splitViewDisposables = new DisposableStore();
......@@ -132,7 +134,8 @@ export class CenteredViewLayout implements IDisposable {
this.splitView.layout(this.width);
this.splitView.addView(toSplitViewView(this.view, () => this.height), 0);
this.emptyViews = [createEmptyView(this.style.background), createEmptyView(this.style.background)];
const backgroundColor = this.style ? this.style.background : undefined;
this.emptyViews = [createEmptyView(backgroundColor), createEmptyView(backgroundColor)];
this.splitView.addView(this.emptyViews[0], this.state.leftMarginRatio * this.width, 0);
this.splitView.addView(this.emptyViews[1], this.state.rightMarginRatio * this.width, 2);
} else {
......
......@@ -32,7 +32,7 @@ const defaultOpts = {
export class CheckboxActionViewItem extends BaseActionViewItem {
private checkbox: Checkbox;
private checkbox: Checkbox | undefined;
private readonly disposables = new DisposableStore();
render(container: HTMLElement): void {
......@@ -45,7 +45,7 @@ export class CheckboxActionViewItem extends BaseActionViewItem {
title: this._action.label
});
this.disposables.add(this.checkbox);
this.disposables.add(this.checkbox.onChange(() => this._action.checked = this.checkbox.checked, this));
this.disposables.add(this.checkbox.onChange(() => this._action.checked = this.checkbox!.checked, this));
this.element.appendChild(this.checkbox.domNode);
}
......
......@@ -86,7 +86,7 @@ export class InputBox extends Widget {
private contextViewProvider?: IContextViewProvider;
element: HTMLElement;
private input: HTMLInputElement;
private mirror: HTMLElement;
private mirror: HTMLElement | undefined;
private actionbar?: ActionBar;
private options: IInputOptions;
private message: IMessage | null;
......@@ -230,7 +230,7 @@ export class InputBox extends Widget {
}
}
public get mirrorElement(): HTMLElement {
public get mirrorElement(): HTMLElement | undefined {
return this.mirror;
}
......
......@@ -8,7 +8,7 @@ import 'vs/css!./selectBox';
import { Event } from 'vs/base/common/event';
import { Widget } from 'vs/base/browser/ui/widget';
import { Color } from 'vs/base/common/color';
import { deepClone, mixin } from 'vs/base/common/objects';
import { deepClone } from 'vs/base/common/objects';
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
import { IListStyles } from 'vs/base/browser/ui/list/listWidget';
import { SelectBoxNative } from 'vs/base/browser/ui/selectBox/selectBoxNative';
......@@ -72,14 +72,11 @@ export interface ISelectData {
}
export class SelectBox extends Widget implements ISelectBoxDelegate {
private styles: ISelectBoxStyles;
private selectBoxDelegate: ISelectBoxDelegate;
constructor(options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, styles: ISelectBoxStyles = deepClone(defaultStyles), selectBoxOptions?: ISelectBoxOptions) {
super();
mixin(this.styles, defaultStyles, false);
// Default to native SelectBox for OSX unless overridden
if (isMacintosh && !(selectBoxOptions && selectBoxOptions.useCustomDrawn)) {
this.selectBoxDelegate = new SelectBoxNative(options, selected, styles, selectBoxOptions);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册