Skip to content

Commit e02e20c

Browse files
author
Benjamin Pasero
committed
strict property init (microsoft#78168)
1 parent 6a2d035 commit e02e20c

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/vs/workbench/api/common/extHostQuickOpen.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,16 @@ class ExtHostQuickInput implements QuickInput {
234234
private static _nextId = 1;
235235
_id = ExtHostQuickPick._nextId++;
236236

237-
private _title: string;
238-
private _steps: number;
239-
private _totalSteps: number;
237+
private _title: string | undefined;
238+
private _steps: number | undefined;
239+
private _totalSteps: number | undefined;
240240
private _visible = false;
241241
private _expectingHide = false;
242242
private _enabled = true;
243243
private _busy = false;
244244
private _ignoreFocusOut = true;
245245
private _value = '';
246-
private _placeholder: string;
246+
private _placeholder: string | undefined;
247247
private _buttons: QuickInputButton[] = [];
248248
private _handlesToButtons = new Map<number, QuickInputButton>();
249249
private readonly _onDidAcceptEmitter = new Emitter<void>();
@@ -268,7 +268,7 @@ class ExtHostQuickInput implements QuickInput {
268268
return this._title;
269269
}
270270

271-
set title(title: string) {
271+
set title(title: string | undefined) {
272272
this._title = title;
273273
this.update({ title });
274274
}
@@ -277,7 +277,7 @@ class ExtHostQuickInput implements QuickInput {
277277
return this._steps;
278278
}
279279

280-
set step(step: number) {
280+
set step(step: number | undefined) {
281281
this._steps = step;
282282
this.update({ step });
283283
}
@@ -286,7 +286,7 @@ class ExtHostQuickInput implements QuickInput {
286286
return this._totalSteps;
287287
}
288288

289-
set totalSteps(totalSteps: number) {
289+
set totalSteps(totalSteps: number | undefined) {
290290
this._totalSteps = totalSteps;
291291
this.update({ totalSteps });
292292
}
@@ -331,7 +331,7 @@ class ExtHostQuickInput implements QuickInput {
331331
return this._placeholder;
332332
}
333333

334-
set placeholder(placeholder: string) {
334+
set placeholder(placeholder: string | undefined) {
335335
this._placeholder = placeholder;
336336
this.update({ placeholder });
337337
}
@@ -398,7 +398,7 @@ class ExtHostQuickInput implements QuickInput {
398398
}
399399
}
400400

401-
public dispose(): void {
401+
dispose(): void {
402402
if (this._disposed) {
403403
return;
404404
}
@@ -587,9 +587,9 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
587587

588588
class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
589589

590-
private _password: boolean;
591-
private _prompt: string;
592-
private _validationMessage: string;
590+
private _password = false;
591+
private _prompt: string | undefined;
592+
private _validationMessage: string | undefined;
593593

594594
constructor(proxy: MainThreadQuickOpenShape, extensionId: ExtensionIdentifier, onDispose: () => void) {
595595
super(proxy, extensionId, onDispose);
@@ -609,7 +609,7 @@ class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
609609
return this._prompt;
610610
}
611611

612-
set prompt(prompt: string) {
612+
set prompt(prompt: string | undefined) {
613613
this._prompt = prompt;
614614
this.update({ prompt });
615615
}
@@ -618,7 +618,7 @@ class ExtHostInputBox extends ExtHostQuickInput implements InputBox {
618618
return this._validationMessage;
619619
}
620620

621-
set validationMessage(validationMessage: string) {
621+
set validationMessage(validationMessage: string | undefined) {
622622
this._validationMessage = validationMessage;
623623
this.update({ validationMessage });
624624
}

src/vs/workbench/services/configuration/browser/configurationService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ export class WorkspaceService extends Disposable implements IConfigurationServic
5959
protected readonly _onDidChangeWorkbenchState: Emitter<WorkbenchState> = this._register(new Emitter<WorkbenchState>());
6060
public readonly onDidChangeWorkbenchState: Event<WorkbenchState> = this._onDidChangeWorkbenchState.event;
6161

62-
private configurationEditingService: ConfigurationEditingService;
63-
private jsonEditingService: JSONEditingService;
64-
65-
private cyclicDependencyReady: Function;
62+
// TODO@sandeep debt with cyclic dependencies
63+
private configurationEditingService!: ConfigurationEditingService;
64+
private jsonEditingService!: JSONEditingService;
65+
private cyclicDependencyReady!: Function;
6666
private cyclicDependency = new Promise<void>(resolve => this.cyclicDependencyReady = resolve);
6767

6868
constructor(

src/vs/workbench/services/preferences/common/preferencesModels.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ function parse(model: ITextModel, isSettingsProperty: (currentProperty: string,
429429

430430
export class WorkspaceConfigurationEditorModel extends SettingsEditorModel {
431431

432-
private _configurationGroups: ISettingsGroup[];
432+
private _configurationGroups: ISettingsGroup[] = [];
433433

434434
get configurationGroups(): ISettingsGroup[] {
435435
return this._configurationGroups;
@@ -448,9 +448,9 @@ export class WorkspaceConfigurationEditorModel extends SettingsEditorModel {
448448

449449
export class DefaultSettings extends Disposable {
450450

451-
private _allSettingsGroups: ISettingsGroup[];
452-
private _content: string;
453-
private _settingsByName: Map<string, ISetting>;
451+
private _allSettingsGroups: ISettingsGroup[] | undefined;
452+
private _content: string | undefined;
453+
private _settingsByName = new Map<string, ISetting>();
454454

455455
readonly _onDidChange: Emitter<void> = this._register(new Emitter<void>());
456456
readonly onDidChange: Event<void> = this._onDidChange.event;
@@ -467,15 +467,15 @@ export class DefaultSettings extends Disposable {
467467
this.initialize();
468468
}
469469

470-
return this._content;
470+
return this._content!;
471471
}
472472

473473
getSettingsGroups(forceUpdate = false): ISettingsGroup[] {
474474
if (!this._allSettingsGroups || forceUpdate) {
475475
this.initialize();
476476
}
477477

478-
return this._allSettingsGroups;
478+
return this._allSettingsGroups!;
479479
}
480480

481481
private initialize(): void {

0 commit comments

Comments
 (0)