Skip to content

Commit 6bf98da

Browse files
author
Benjamin Pasero
committed
strict init (microsoft#78168)
1 parent 8a2819b commit 6bf98da

24 files changed

Lines changed: 80 additions & 68 deletions

File tree

src/vs/base/common/path.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class ErrorInvalidArgType extends Error {
5858

5959
msg += `. Received type ${typeof actual}`;
6060
super(msg);
61+
62+
this.code = 'ERR_INVALID_ARG_TYPE';
6163
}
6264
}
6365

src/vs/base/node/encoding.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions
4747

4848
return new Promise<IDecodeStreamResult>((resolve, reject) => {
4949
const writer = new class extends Writable {
50-
private decodeStream: NodeJS.ReadWriteStream;
51-
private decodeStreamPromise: Promise<void>;
50+
private decodeStream: NodeJS.ReadWriteStream | undefined;
51+
private decodeStreamPromise: Promise<void> | undefined;
5252

5353
private bufferedChunks: Buffer[] = [];
5454
private bytesBuffered = 0;
@@ -122,7 +122,7 @@ export function toDecodeStream(readable: Readable, options: IDecodeStreamOptions
122122
// detection. thus, wrap up starting the stream even
123123
// without all the data to get things going
124124
else {
125-
this._startDecodeStream(() => this.decodeStream.end(callback));
125+
this._startDecodeStream(() => this.decodeStream!.end(callback));
126126
}
127127
}
128128
};

src/vs/base/parts/ipc/test/node/ipc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QueueProtocol implements IMessagePassingProtocol {
3131
});
3232

3333
readonly onMessage = this._onMessage.event;
34-
other: QueueProtocol;
34+
other!: QueueProtocol;
3535

3636
send(buffer: VSBuffer): void {
3737
this.other.receive(buffer);

src/vs/base/parts/quickopen/browser/quickOpenModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class QuickOpenEntry {
5757
private labelHighlights: IHighlight[];
5858
private descriptionHighlights?: IHighlight[];
5959
private detailHighlights?: IHighlight[];
60-
private hidden: boolean;
60+
private hidden: boolean | undefined;
6161

6262
constructor(highlights: IHighlight[] = []) {
6363
this.id = (IDS++).toString();
@@ -148,7 +148,7 @@ export class QuickOpenEntry {
148148
* Allows to reuse the same model while filtering. Hidden entries will not show up in the viewer.
149149
*/
150150
isHidden(): boolean {
151-
return this.hidden;
151+
return !!this.hidden;
152152
}
153153

154154
/**

src/vs/code/electron-main/sharedProcess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class SharedProcess implements ISharedProcess {
1818

1919
private barrier = new Barrier();
2020

21-
private window: Electron.BrowserWindow | null;
21+
private window: Electron.BrowserWindow | null = null;
2222

2323
constructor(
2424
private readonly machineId: string,

src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export class QuickOpenController implements editorCommon.IEditorContribution, ID
3131
}
3232

3333
private readonly editor: ICodeEditor;
34-
private widget: QuickOpenEditorWidget | null;
35-
private rangeHighlightDecorationId: string | null;
36-
private lastKnownEditorSelection: Selection | null;
34+
private widget: QuickOpenEditorWidget | null = null;
35+
private rangeHighlightDecorationId: string | null = null;
36+
private lastKnownEditorSelection: Selection | null = null;
3737

3838
constructor(editor: ICodeEditor, @IThemeService private readonly themeService: IThemeService) {
3939
this.editor = editor;

src/vs/platform/files/node/watcher/win32/csharpWatcherService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class OutOfProcessWin32FolderWatcher {
1818

1919
private ignored: glob.ParsedPattern[];
2020

21-
private handle: cp.ChildProcess;
21+
private handle: cp.ChildProcess | undefined;
2222
private restartCounter: number;
2323

2424
constructor(

src/vs/platform/files/test/node/diskFileService.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export class TestDiskFileSystemProvider extends DiskFileSystemProvider {
6262

6363
totalBytesRead: number = 0;
6464

65-
private invalidStatSize: boolean;
65+
private invalidStatSize: boolean = false;
6666

67-
private _testCapabilities: FileSystemProviderCapabilities;
67+
private _testCapabilities!: FileSystemProviderCapabilities;
6868
get capabilities(): FileSystemProviderCapabilities {
6969
if (!this._testCapabilities) {
7070
this._testCapabilities =

src/vs/platform/localizations/electron-browser/localizationsService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiatio
1111

1212
export class LocalizationsService implements ILocalizationsService {
1313

14-
_serviceBrand: ServiceIdentifier<any>;
14+
_serviceBrand!: ServiceIdentifier<any>;
1515

1616
private channel: IChannel;
1717

@@ -24,4 +24,4 @@ export class LocalizationsService implements ILocalizationsService {
2424
getLanguageIds(type?: LanguageType): Promise<string[]> {
2525
return this.channel.call('getLanguageIds', type);
2626
}
27-
}
27+
}

src/vs/platform/localizations/node/localizations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class LanguagePacksCache extends Disposable {
9393
private languagePacks: { [language: string]: ILanguagePack } = {};
9494
private languagePacksFilePath: string;
9595
private languagePacksFileLimiter: Queue<any>;
96-
private initializedCache: boolean;
96+
private initializedCache: boolean | undefined;
9797

9898
constructor(
9999
@IEnvironmentService environmentService: IEnvironmentService,
@@ -184,4 +184,4 @@ class LanguagePacksCache extends Disposable {
184184
.then(() => result, error => this.logService.error(error));
185185
});
186186
}
187-
}
187+
}

0 commit comments

Comments
 (0)