mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
esm - more typing to jsonc
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user