Skip to content

Commit 7bf2f5e

Browse files
committed
esm - more typing to jsonc
1 parent db992f3 commit 7bf2f5e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/vs/base/common/jsonc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function stripComments(content: string): string {
5252
* @param content the content to strip comments from
5353
* @returns the parsed content as JSON
5454
*/
55-
export function parse(content: string): any {
55+
export function parse<T>(content: string): T {
5656
const commentsStripped = stripComments(content);
5757

5858
try {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ export class CodeApplication extends Disposable {
14231423
try {
14241424
const argvContent = await this.fileService.readFile(this.environmentMainService.argvResource);
14251425
const argvString = argvContent.value.toString();
1426-
const argvJSON = parse(argvString);
1426+
const argvJSON = parse<{ 'enable-crash-reporter'?: boolean }>(argvString);
14271427
const telemetryLevel = getTelemetryLevel(this.configurationService);
14281428
const enableCrashReporter = telemetryLevel >= TelemetryLevel.CRASH;
14291429

src/vs/workbench/contrib/encryption/electron-sandbox/encryption.contribution.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class EncryptionContribution implements IWorkbenchContribution {
3434
}
3535
try {
3636
const content = await this.fileService.readFile(this.environmentService.argvResource);
37-
const argv = parse(content.value.toString());
37+
const argv = parse<{ 'password-store'?: string }>(content.value.toString());
3838
if (argv['password-store'] === 'gnome' || argv['password-store'] === 'gnome-keyring') {
3939
this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['password-store'], value: 'gnome-libsecret' }], true);
4040
}

0 commit comments

Comments
 (0)