Skip to content

Commit

Permalink
Add repository.directory to PackageJson type (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
KubaJastrz authored and sindresorhus committed Jan 24, 2020
1 parent 5385519 commit c96a49d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions source/package-json.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,13 @@ export type PackageJson = {
| {
type: string;
url: string;

/**
Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
[Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
*/
directory?: string;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion test-d/package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ expectType<string | undefined>(packageJson.types);
expectType<string | undefined>(packageJson.typings);
expectType<string | string[] | undefined>(packageJson.man);
expectType<PackageJson.DirectoryLocations | undefined>(packageJson.directories);
expectType<{type: string; url: string} | string | undefined>(
expectType<{type: string; url: string; directory?: string} | string | undefined>(
packageJson.repository
);
expectType<PackageJson.Scripts | undefined>(packageJson.scripts);
Expand Down

0 comments on commit c96a49d

Please sign in to comment.