Skip to content

Commit

Permalink
✨ expect の第一引数の型を unknown に修正
Browse files Browse the repository at this point in the history
  • Loading branch information
akm committed Jan 1, 2024
1 parent 0e3caf9 commit d17a098
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/assertions/expect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {expect as origExpect} from '@playwright/test';
import type {Locator} from '@playwright/test';
import {Displayable} from '../materials/Displayable';

type ExpectReturnType = ReturnType<typeof origExpect>;
Expand All @@ -10,7 +9,7 @@ type ExtendType = typeof origExpect.extend;

export type ExpectType = {
(
x: Locator | Displayable,
x: unknown,
messageOrOptions?: string | {message?: string}
): ExpectReturnType;

Expand All @@ -24,11 +23,13 @@ export type ExpectType = {

export const expect = ((): ExpectType => {
const body = (
x: Locator | Displayable,
x: unknown,
messageOrOptions?: string | {message?: string}
): ExpectReturnType => {
const locator = x instanceof Displayable ? x._locator : x;
return origExpect(locator as unknown, messageOrOptions);
return origExpect(
x instanceof Displayable ? x._locator : x,
messageOrOptions
);
};
return Object.assign(body, {
soft: origExpect.soft.bind(body),
Expand Down

0 comments on commit d17a098

Please sign in to comment.