فهرست منبع

core: allow readJson to be called without explicit type parameter

Added default type parameter 'any' to readJson<T> so users can call it without specifying a type when they don't need strict typing. This reduces boilerplate for quick JSON reads where type safety isn't required.
Dax Raad 6 ماه پیش
والد
کامیت
a5c15a23e4
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      packages/opencode/src/util/filesystem.ts

+ 1 - 1
packages/opencode/src/util/filesystem.ts

@@ -30,7 +30,7 @@ export namespace Filesystem {
     return readFile(p, "utf-8")
   }
 
-  export async function readJson<T>(p: string): Promise<T> {
+  export async function readJson<T = any>(p: string): Promise<T> {
     return JSON.parse(await readFile(p, "utf-8"))
   }