Skip to content

fix: revert expect.any return type #8129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/expect/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export interface ExpectStatic
AsymmetricMatchersContaining {
<T>(actual: T, message?: string): Assertion<T>
extend: (expects: MatchersObject) => void
anything: () => AsymmetricMatcher<unknown>
any: (constructor: unknown) => AsymmetricMatcher<unknown>
anything: () => any
any: (constructor: unknown) => any
getState: () => MatcherState
setState: (state: Partial<MatcherState>) => void
not: AsymmetricMatchersContaining
Expand Down Expand Up @@ -202,15 +202,15 @@ export interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMa
* @example
* expect(user).toEqual({ name: 'Alice', age: 30 });
*/
toEqual: <E>(expected: DeeplyAllowMatchers<E>) => void
toEqual: <E>(expected: E) => void

/**
* Use to test that objects have the same types as well as structure.
*
* @example
* expect(user).toStrictEqual({ name: 'Alice', age: 30 });
*/
toStrictEqual: <E>(expected: DeeplyAllowMatchers<E>) => void
toStrictEqual: <E>(expected: E) => void

/**
* Checks that a value is what you expect. It calls `Object.is` to compare values.
Expand Down Expand Up @@ -240,7 +240,7 @@ export interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMa
* address: { city: 'Wonderland' }
* });
*/
toMatchObject: <E extends object | any[]>(expected: DeeplyAllowMatchers<E>) => void
toMatchObject: <E extends object | any[]>(expected: E) => void

/**
* Used when you want to check that an item is in a list.
Expand Down
Loading