diff --git a/index.d.cts b/index.d.cts new file mode 100644 index 000000000..fc433503e --- /dev/null +++ b/index.d.cts @@ -0,0 +1,2 @@ +import Ava from "./index.js"; +export = Ava; diff --git a/index.d.ts b/index.d.ts index 24b722040..50f1570d7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,9 +1,9 @@ -import type {TestFn} from './types/test-fn'; +import type {TestFn} from './types/test-fn.js'; -export * from './types/assertions'; -export * from './types/try-fn'; -export * from './types/test-fn'; -export * from './types/subscribable'; +export * from './types/assertions.js'; +export * from './types/try-fn.js'; +export * from './types/test-fn.js'; +export * from './types/subscribable.js'; /** Call to declare a test, or chain to declare hooks or test modifiers */ declare const test: TestFn; diff --git a/package.json b/package.json index cb2c85406..802dbf9f2 100644 --- a/package.json +++ b/package.json @@ -10,13 +10,25 @@ }, "exports": { ".": { - "import": "./entrypoints/main.mjs", - "require": "./entrypoints/main.cjs" + "import": { + "types": "./index.d.ts", + "default": "./entrypoints/main.mjs" + }, + "require": { + "types": "./index.d.cts", + "default": "./entrypoints/main.cjs" + } }, "./eslint-plugin-helper": "./entrypoints/eslint-plugin-helper.cjs", "./plugin": { - "import": "./entrypoints/plugin.mjs", - "require": "./entrypoints/plugin.cjs" + "import": { + "types": "./plugin.d.ts", + "default": "./entrypoints/plugin.mjs" + }, + "require": { + "types": "./plugin.d.cts", + "default": "./entrypoints/plugin.cjs" + } } }, "type": "module", diff --git a/plugin.d.cts b/plugin.d.cts new file mode 100644 index 000000000..0cfae42ba --- /dev/null +++ b/plugin.d.cts @@ -0,0 +1 @@ +export * from "./plugin.js"; diff --git a/types/subscribable.ts b/types/subscribable.d.ts similarity index 100% rename from types/subscribable.ts rename to types/subscribable.d.ts diff --git a/types/test-fn.d.ts b/types/test-fn.d.ts index bcb9778ab..62b831f0a 100644 --- a/types/test-fn.d.ts +++ b/types/test-fn.d.ts @@ -1,6 +1,6 @@ -import type {Assertions} from './assertions'; -import type {Subscribable} from './subscribable'; -import type {TryFn} from './try-fn'; +import type {Assertions} from './assertions.js'; +import type {Subscribable} from './subscribable.js'; +import type {TryFn} from './try-fn.js'; /** The `t` value passed to test & hook implementations. */ export interface ExecutionContext extends Assertions { diff --git a/types/try-fn.d.ts b/types/try-fn.d.ts index 41a1664d5..8009df0c9 100644 --- a/types/try-fn.d.ts +++ b/types/try-fn.d.ts @@ -1,4 +1,4 @@ -import type {Implementation} from './test-fn'; +import type {Implementation} from './test-fn.js'; export type CommitDiscardOptions = { /**