Skip to content

Commit

Permalink
fix: component command type
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkenos committed Mar 1, 2025
1 parent ab557dd commit 66f8ba0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/conditions/locator/locator-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import type { LocatorSnapshotOptions } from "@config/types";
import type { Axis, SizeContext } from "@core/gherkin/enums";
import type { ExpectedConditionKwargs, ExpectedConditionOptions } from "../types";

export class LocatorConditions extends ExpectedConditions {
protected locator: Locator;
export class LocatorConditions<T = Locator> extends ExpectedConditions {
protected locator: T;

constructor(locator: Locator, options?: ExpectedConditionOptions) {
constructor(locator: T, options?: ExpectedConditionOptions) {
super(options);
this.locator = locator;
}
Expand Down
6 changes: 3 additions & 3 deletions src/conditions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export type { ExpectedConditions } from "./expected-conditions";

export type { LocatorCondition } from "./locator/locator-condition";

export type { LocatorConditions } from "./locator/locator-conditions";

export type { PageCondition } from "./page/page-condition";

export type { PageConditions } from "./page/page-conditions";
export { LocatorConditions } from "./locator/locator-conditions";

export { PageConditions } from "./page/page-conditions";

export type ExpectedConditionsResult = {
evaluations: ExpectedCondition[];
Expand Down
2 changes: 1 addition & 1 deletion src/fixtures/component/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,5 @@ export class GenericComponent {
type This<T> = Component & T;
type OmitLocatorKeys = "__proto";
type OmitComponentKeys = OmitLocatorKeys | "root" | "create" | "chain";
export type Component = Omit<GenericComponent, OmitComponentKeys> & Omit<Locator, OmitLocatorKeys>;
export type Component = Omit<GenericComponent, OmitComponentKeys> & Locator;
export const Component: new(selector: string, filters?: LocatorFilters) => Component = GenericComponent as any;
2 changes: 1 addition & 1 deletion src/fixtures/locator/commands/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export function component<T>(this: Locator, Component: Constructor<T>, filters?:
return GenericComponent.create({ prototype, from }) as T;
}

export type ComponentCommand = typeof component;
export type ComponentCommand<T> = typeof component<T>;
2 changes: 1 addition & 1 deletion src/fixtures/locator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface Locator extends PlaywrightLocator, LocatorClass {
and(...args: Parameters<AndCommand>): ReturnType<AndCommand>;
centerPoint(...args: Parameters<CenterPointCommand>): ReturnType<CenterPointCommand>;
clickUntil(...args: Parameters<ClickUntilCommand>): ReturnType<ClickUntilCommand>;
component(...args: Parameters<ComponentCommand>): ReturnType<ComponentCommand>;
component<T>(...args: Parameters<ComponentCommand<T>>): ReturnType<ComponentCommand<T>>;
doUntil(...args: Parameters<DoUntilCommand>): ReturnType<DoUntilCommand>;
dragAndDrop(...args: Parameters<DragAndDropCommand>): ReturnType<DragAndDropCommand>;
dropdownOptions(...args: Parameters<DropdownOptionsCommand>): ReturnType<DropdownOptionsCommand>;
Expand Down

0 comments on commit 66f8ba0

Please sign in to comment.