Skip to content

Commit 7ca1928

Browse files
committed
refactor(code): code simplification and cleaned
1 parent 3637f00 commit 7ca1928

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/api/interaction/Interaction.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export type InteractionDataType<T> = T extends Interaction<infer D> ? D & object
2525
* Infers the interaction data types from an array of interactions
2626
* @category API Interaction
2727
*/
28-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
29-
export type InteractionsDataTypes<A extends Array<Interaction<any>>> = {
28+
export type InteractionsDataTypes<A extends Array<Interaction<object>>> = {
3029
[K in keyof A]: A[K] extends Interaction<infer T> ? T : never;
3130
};
3231

src/impl/interaction/InteractionBase.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ import type {VisitorInteraction} from "../../api/interaction/VisitorInteraction"
2323
import type {Logger} from "../../api/logging/Logger";
2424
import type {Subscription} from "rxjs";
2525

26-
interface CancellablePromise extends Promise<void> {
26+
/**
27+
* A promise that is cancellable.
28+
*/
29+
export interface CancellablePromise extends Promise<void> {
30+
/**
31+
* Called when the promise is cancelled.
32+
*/
2733
cancel: () => void;
2834
}
2935

3036
/**
3137
* Infers the type of the involved interaction data implementation
3238
* @category Interaction
3339
*/
34-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
35-
export type InteractionDataImplType<T> = T extends InteractionBase<any, infer DImpl, any> ? DImpl : never;
40+
export type InteractionDataImplType<T> = T extends InteractionBase<object, infer DImpl> ? DImpl : never;
3641

3742
/**
3843
* The base implementation of a user interaction.

src/impl/interaction/library/Wheel.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@ export class Wheel extends InteractionBase<WheelData, WheelDataImpl> {
4343
/**
4444
* Creates the interaction.
4545
* @param logger - The logger to use for this interaction
46-
* @param fsm - The optional FSM provided for the interaction
4746
* @param data - The interaction data to use
4847
* @param name - The name of the user interaction
4948
*/
50-
public constructor(logger: Logger, fsm?: WheelFSM, data?: WheelDataImpl, name?: string) {
49+
public constructor(logger: Logger, data?: WheelDataImpl, name?: string) {
5150
const action = (evt: WheelEvent): void => {
5251
this._data.copy(evt);
5352
};
54-
super(fsm ?? new WheelFSM(logger, action), data ?? new WheelDataImpl(), logger, name ?? Wheel.name);
53+
super(new WheelFSM(logger, action), data ?? new WheelDataImpl(), logger, name ?? Wheel.name);
5554
}
5655
}

0 commit comments

Comments
 (0)