Skip to content

Commit

Permalink
Improve typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 committed Jun 30, 2023
1 parent 53ed932 commit 9daac17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion extension/src/fileSystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ export const loadJson = <T>(path: string): T | undefined => {
}
}

export const writeJson = <T>(path: string, obj: T, format = false): void => {
export const writeJson = <T extends Record<string, unknown>>(
path: string,
obj: T,
format = false
): void => {
ensureFileSync(path)
const json = format ? JSON.stringify(obj, null, 4) : JSON.stringify(obj)
return writeFileSync(path, json)
Expand Down
2 changes: 1 addition & 1 deletion extension/src/plots/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export class PlotsModel extends ModelWithPersistence {
const rawData =
data || this.getSelectedTemplateRawData(selectedRevisions, plotId)

writeJson(filePath, rawData, true)
writeJson(filePath, rawData as Record<string, unknown>, true)
void openFileInEditor(filePath)
}

Expand Down

0 comments on commit 9daac17

Please sign in to comment.