esm - more typing to jsonc

This commit is contained in:
Benjamin Pasero
2024-09-27 11:13:04 +02:00
parent db992f389a
commit 7bf2f5e196
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ export function stripComments(content: string): string {
* @param content the content to strip comments from
* @returns the parsed content as JSON
*/
export function parse(content: string): any {
export function parse<T>(content: string): T {
const commentsStripped = stripComments(content);
try {
+1 -1
View File
@@ -1423,7 +1423,7 @@ export class CodeApplication extends Disposable {
try {
const argvContent = await this.fileService.readFile(this.environmentMainService.argvResource);
const argvString = argvContent.value.toString();
const argvJSON = parse(argvString);
const argvJSON = parse<{ 'enable-crash-reporter'?: boolean }>(argvString);
const telemetryLevel = getTelemetryLevel(this.configurationService);
const enableCrashReporter = telemetryLevel >= TelemetryLevel.CRASH;
@@ -34,7 +34,7 @@ class EncryptionContribution implements IWorkbenchContribution {
}
try {
const content = await this.fileService.readFile(this.environmentService.argvResource);
const argv = parse(content.value.toString());
const argv = parse<{ 'password-store'?: string }>(content.value.toString());
if (argv['password-store'] === 'gnome' || argv['password-store'] === 'gnome-keyring') {
this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['password-store'], value: 'gnome-libsecret' }], true);
}