Skip to content

Commit

Permalink
refactor: add return type
Browse files Browse the repository at this point in the history
  • Loading branch information
velut committed Dec 22, 2023
1 parent c1bee7f commit 9440f3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/package-json.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ResultAsync } from "neverthrow";
import { readPackage } from "read-pkg";
import { readPackage, type NormalizedPackageJson } from "read-pkg";
import { PackageJsonError } from "./errors";

export const packageJson = (cwd: string) =>
export const packageJson = (
cwd: string,
): ResultAsync<NormalizedPackageJson, PackageJsonError> =>
ResultAsync.fromPromise(
readPackage({ cwd }),
(e) => new PackageJsonError("failed to read package.json", { cause: e }),
Expand Down

0 comments on commit 9440f3a

Please sign in to comment.