Skip to content

Commit 39abeec

Browse files
fix: export type information for node16 module resolution
1 parent ada1a4f commit 39abeec

File tree

7 files changed

+28
-13
lines changed

7 files changed

+28
-13
lines changed

index.d.cts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Ava from "./index.js";
2+
export = Ava;

index.d.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type {TestFn} from './types/test-fn';
1+
import type {TestFn} from './types/test-fn.js';
22

3-
export * from './types/assertions';
4-
export * from './types/try-fn';
5-
export * from './types/test-fn';
6-
export * from './types/subscribable';
3+
export * from './types/assertions.js';
4+
export * from './types/try-fn.js';
5+
export * from './types/test-fn.js';
6+
export * from './types/subscribable.js';
77

88
/** Call to declare a test, or chain to declare hooks or test modifiers */
99
declare const test: TestFn;

package.json

+16-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,25 @@
1010
},
1111
"exports": {
1212
".": {
13-
"import": "./entrypoints/main.mjs",
14-
"require": "./entrypoints/main.cjs"
13+
"import": {
14+
"types": "./index.d.ts",
15+
"default": "./entrypoints/main.mjs"
16+
},
17+
"require": {
18+
"types": "./index.d.cts",
19+
"default": "./entrypoints/main.cjs"
20+
}
1521
},
1622
"./eslint-plugin-helper": "./entrypoints/eslint-plugin-helper.cjs",
1723
"./plugin": {
18-
"import": "./entrypoints/plugin.mjs",
19-
"require": "./entrypoints/plugin.cjs"
24+
"import": {
25+
"types": "./plugin.d.ts",
26+
"default": "./entrypoints/plugin.mjs"
27+
},
28+
"require": {
29+
"types": "./plugin.d.cts",
30+
"default": "./entrypoints/plugin.cjs"
31+
}
2032
}
2133
},
2234
"type": "module",

plugin.d.cts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./plugin.js";
File renamed without changes.

types/test-fn.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type {Assertions} from './assertions';
2-
import type {Subscribable} from './subscribable';
3-
import type {TryFn} from './try-fn';
1+
import type {Assertions} from './assertions.js';
2+
import type {Subscribable} from './subscribable.js';
3+
import type {TryFn} from './try-fn.js';
44

55
/** The `t` value passed to test & hook implementations. */
66
export interface ExecutionContext<Context = unknown> extends Assertions {

types/try-fn.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {Implementation} from './test-fn';
1+
import type {Implementation} from './test-fn.js';
22

33
export type CommitDiscardOptions = {
44
/**

0 commit comments

Comments
 (0)