Skip to content

Commit 0f42884

Browse files
authored
fix: expand the types of exports (#183)
1 parent 89a8e4e commit 0f42884

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Diff for: src/types/packagejson.ts

+18-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ export type PackageJsonPerson =
99
url?: string;
1010
};
1111

12+
export type PackageJsonExports =
13+
| string
14+
| string[]
15+
| {
16+
[P in
17+
| "."
18+
| "import"
19+
| "require"
20+
| "types"
21+
| "node"
22+
| "browser"
23+
| "default"
24+
// eslint-disable-next-line @typescript-eslint/ban-types
25+
| (string & {})]: PackageJsonExports;
26+
};
27+
1228
export interface PackageJson {
1329
/**
1430
* The name is what your thing is called.
@@ -148,15 +164,9 @@ export interface PackageJson {
148164
* Docs:
149165
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
150166
*
151-
* @default 'commonjs'
152-
* @since Node.js v14
167+
* @since Node.js v12.7
153168
*/
154-
exports?:
155-
| string
156-
| Record<
157-
"import" | "require" | "." | "node" | "browser" | string,
158-
string | Record<"import" | "require" | string, string>
159-
>;
169+
exports?: PackageJsonExports;
160170
/**
161171
* Docs:
162172
* - https://nodejs.org/api/packages.html#imports

0 commit comments

Comments
 (0)