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.
This commit is contained in:
@@ -30,7 +30,7 @@ export namespace Filesystem {
|
|||||||
return readFile(p, "utf-8")
|
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"))
|
return JSON.parse(await readFile(p, "utf-8"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user