Skip to content

Commit c03f806

Browse files
committed
fix: correct types for "./matchers" export
1 parent b64b953 commit c03f806

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
},
2828
"./matchers": {
2929
"require": {
30-
"types": "./types/matchers.d.ts",
30+
"types": "./types/matchers-standalone.d.ts",
3131
"default": "./dist/matchers.js"
3232
},
3333
"import": {
34-
"types": "./types/matchers.d.ts",
34+
"types": "./types/matchers-standalone.d.ts",
3535
"default": "./dist/matchers.mjs"
3636
}
3737
},

types/matchers-standalone.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {type TestingLibraryMatchers} from './matchers'
2+
3+
type TLM = TestingLibraryMatchers<any, void>
4+
5+
interface MatcherReturnType {
6+
pass: boolean
7+
message: () => string
8+
}
9+
10+
interface OverloadedMatchers {
11+
toHaveClass: (expected: any, ...rest: string[]) => MatcherReturnType
12+
toHaveClass: (
13+
expected: any,
14+
className: string,
15+
options?: {exact: boolean},
16+
) => MatcherReturnType
17+
}
18+
19+
declare namespace matchersStandalone {
20+
type MatchersStandalone = {
21+
[T in keyof TLM]: (
22+
expected: any,
23+
...rest: Parameters<TLM[T]>
24+
) => MatcherReturnType
25+
} & OverloadedMatchers
26+
}
27+
28+
declare const matchersStandalone: matchersStandalone.MatchersStandalone &
29+
Record<string, any>
30+
export = matchersStandalone

0 commit comments

Comments
 (0)