提交 e02e20c3 编写于 作者: B Benjamin Pasero

strict property init (#78168)

上级 6a2d035b
......@@ -234,16 +234,16 @@ class ExtHostQuickInput implements QuickInput {
private static _nextId = 1;
_id = ExtHostQuickPick._nextId++;
private _title: string;
private _steps: number;
private _totalSteps: number;
private _title: string | undefined;
private _steps: number | undefined;
private _totalSteps: number | undefined;
private _visible = false;
private _expectingHide = false;
private _enabled = true;
private _busy = false;
private _ignoreFocusOut = true;
private _value = '';
private _placeholder: string;
private _placeholder: string | undefined;
private _buttons: QuickInputButton[] = [];
private _handlesToButtons = new Map<number, QuickInputButton>();
private readonly _onDidAcceptEmitter = new Emitter<void>();
......@@ -268,7 +268,7 @@ class ExtHostQuickInput implements QuickInput {
return this._title;
}
set title(title: string) {
set title(title: string | undefined) {
this._title = title;
this.update({ title });
}
......@@ -277,7 +277,7 @@ class ExtHostQuickInput implements QuickInput {
return this._steps;
}
set step(step: number) {
set step(step: number | undefined) {
this._steps = step;
this.update({ step });
}
......@@ -286,7 +286,7 @@ class ExtHostQuickInput implements QuickInput {
return this._totalSteps;
}
set totalSteps(totalSteps: number) {
set totalSteps(totalSteps: number | undefined) {
this._totalSteps = totalSteps;
this.update({ totalSteps });
}
......@@ -331,7 +331,7 @@ class ExtHostQuickInput implements QuickInput {
return this._placeholder;
}
set placeholder(placeholder: string) {
set placeholder(placeholder: string | undefined) {
this._placeholder = placeholder;
this.update({ placeholder });
}
......@@ -398,7 +398,7 @@ class ExtHostQuickInput implements QuickInput {
}
}
public dispose(): void {
dispose(): void {
if (this._disposed) {
return;
}
......@@ -587,9 +587,9 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
private _password: boolean;
private _prompt: string;
private _validationMessage: string;
private _password = false;
private _prompt: string | undefined;
private _validationMessage: string | undefined;
constructor(proxy: MainThreadQuickOpenShape, extensionId: ExtensionIdentifier, onDispose: () => void) {
super(proxy, extensionId, onDispose);
......@@ -609,7 +609,7 @@ class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
return this._prompt;
}
set prompt(prompt: string) {
set prompt(prompt: string | undefined) {
this._prompt = prompt;
this.update({ prompt });
}
......@@ -618,7 +618,7 @@ class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
return this._validationMessage;
}
set validationMessage(validationMessage: string) {
set validationMessage(validationMessage: string | undefined) {
this._validationMessage = validationMessage;
this.update({ validationMessage });
}
......
......@@ -59,10 +59,10 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
protected readonly _onDidChangeWorkbenchState: Emitter<WorkbenchState> = this._register(new Emitter<WorkbenchState>());
public readonly onDidChangeWorkbenchState: Event<WorkbenchState> = this._onDidChangeWorkbenchState.event;
private configurationEditingService: ConfigurationEditingService;
private jsonEditingService: JSONEditingService;
private cyclicDependencyReady: Function;
// TODO@sandeep debt with cyclic dependencies
private configurationEditingService!: ConfigurationEditingService;
private jsonEditingService!: JSONEditingService;
private cyclicDependencyReady!: Function;
private cyclicDependency = new Promise<void>(resolve => this.cyclicDependencyReady = resolve);
constructor(
......
......@@ -429,7 +429,7 @@ function parse(model: ITextModel, isSettingsProperty: (currentProperty: string,
export class WorkspaceConfigurationEditorModel extends SettingsEditorModel {
private _configurationGroups: ISettingsGroup[];
private _configurationGroups: ISettingsGroup[] = [];
get configurationGroups(): ISettingsGroup[] {
return this._configurationGroups;
......@@ -448,9 +448,9 @@ export class WorkspaceConfigurationEditorModel extends SettingsEditorModel {
export class DefaultSettings extends Disposable {
private _allSettingsGroups: ISettingsGroup[];
private _content: string;
private _settingsByName: Map<string, ISetting>;
private _allSettingsGroups: ISettingsGroup[] | undefined;
private _content: string | undefined;
private _settingsByName = new Map<string, ISetting>();
readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());
readonly onDidChange: Event<void> = this._onDidChange.event;
......@@ -467,7 +467,7 @@ export class DefaultSettings extends Disposable {
this.initialize();
}
return this._content;
return this._content!;
}
getSettingsGroups(forceUpdate = false): ISettingsGroup[] {
......@@ -475,7 +475,7 @@ export class DefaultSettings extends Disposable {
this.initialize();
}
return this._allSettingsGroups;
return this._allSettingsGroups!;
}
private initialize(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册