Skip to content

Commit

Permalink
fix: expand the types of exports (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Jul 1, 2024
1 parent 89a8e4e commit 0f42884
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/types/packagejson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ export type PackageJsonPerson =
url?: string;
};

export type PackageJsonExports =
| string
| string[]
| {
[P in
| "."
| "import"
| "require"
| "types"
| "node"
| "browser"
| "default"
// eslint-disable-next-line @typescript-eslint/ban-types
| (string & {})]: PackageJsonExports;
};

export interface PackageJson {
/**
* The name is what your thing is called.
Expand Down Expand Up @@ -148,15 +164,9 @@ export interface PackageJson {
* Docs:
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
*
* @default 'commonjs'
* @since Node.js v14
* @since Node.js v12.7
*/
exports?:
| string
| Record<
"import" | "require" | "." | "node" | "browser" | string,
string | Record<"import" | "require" | string, string>
>;
exports?: PackageJsonExports;
/**
* Docs:
* - https://nodejs.org/api/packages.html#imports
Expand Down

0 comments on commit 0f42884

Please sign in to comment.