Skip to content

Commit

Permalink
Fix types for default value of normalize (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender authored and sindresorhus committed Apr 27, 2019
1 parent e2ae941 commit d57aeb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ declare namespace readPkg {
}

interface NormalizeOptions extends Options {
readonly normalize: true;
readonly normalize?: true;
}

type NormalizedPackageJson = PackageJson & normalize.Package;
Expand Down
4 changes: 2 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ expectType<Promise<readPkg.PackageJson>>(readPkg({normalize: false}));
expectError<Promise<readPkg.NormalizedPackageJson>>(
readPkg({normalize: false})
);
expectType<Promise<readPkg.PackageJson>>(readPkg({cwd: '.'}));
expectType<Promise<readPkg.NormalizedPackageJson>>(readPkg({cwd: '.'}));

expectType<readPkg.NormalizedPackageJson>(readPkg.sync());
expectType<readPkg.NormalizedPackageJson>(readPkg.sync({normalize: true}));
expectType<readPkg.PackageJson>(readPkg.sync({normalize: false}));
expectError<readPkg.NormalizedPackageJson>(readPkg.sync({normalize: false}));
expectType<readPkg.PackageJson>(readPkg.sync({cwd: '.'}));
expectType<readPkg.NormalizedPackageJson>(readPkg.sync({cwd: '.'}));

0 comments on commit d57aeb1

Please sign in to comment.