1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix type error

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-02 16:18:15 -05:00
parent 8409d56fdf
commit 06f4802748

View File

@ -16,15 +16,17 @@ const writeFileInjectable = getInjectable({
const { writeFile, ensureDir } = di.inject(fsInjectable);
const getDirnameOfPath = di.inject(getDirnameOfPathInjectable);
return async (filePath, content, opts) => {
return async (filePath, content, opts = {}) => {
await ensureDir(getDirnameOfPath(filePath), {
mode: 0o755,
...(opts ?? {}),
...opts,
});
const { encoding = "utf-8", ...options } = opts;
await writeFile(filePath, content, {
encoding: "utf-8",
...(opts ?? {}),
encoding: encoding as BufferEncoding,
...options,
});
};
},