Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Jul 30, 2023
1 parent 41f1454 commit 839ef70
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions types/three/examples/jsm/interactive/InteractiveGroup.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { Camera, Group, Object3D, Object3DEventMap, Vector2, WebGLRenderer } from '../../../src/Three.js';
import {
BaseEvent,
Camera,
EventListener,
EventTypeValidator,
Group,
Object3D,
Object3DEventMap,
Vector2,
WebGLRenderer,
} from '../../../src/Three.js';

interface InteractiveObject3DEventMap extends Object3DEventMap {
hoveron: { data: Vector2 };
Expand All @@ -11,7 +21,30 @@ interface InteractiveObject3DEventMap extends Object3DEventMap {
click: { data: Vector2 };
}

export class InteractiveObject3D extends Object3D<InteractiveObject3DEventMap> {}
export class InteractiveObject3D extends Object3D {
addEventListener<T extends Extract<keyof InteractiveObject3DEventMap, string>>(
type: T,
listener: EventListener<InteractiveObject3DEventMap[T], T, this>,
): void;
addEventListener<T extends string>(type: T, listener: EventListener<{}, T, this>): void;

hasEventListener<T extends Extract<keyof InteractiveObject3DEventMap, string>>(
type: T,
listener: EventListener<InteractiveObject3DEventMap[T], T, this>,
): boolean;
hasEventListener<T extends string>(type: T, listener: EventListener<{}, T, this>): boolean;

removeEventListener<E extends Extract<keyof InteractiveObject3DEventMap, string>>(
type: E,
listener: EventListener<InteractiveObject3DEventMap[E], E, this>,
): void;
removeEventListener<E extends string>(type: E, listener: EventListener<{}, E, this>): void;

dispatchEvent<E extends BaseEvent, Map extends InteractiveObject3DEventMap>(
event: EventTypeValidator<E, Map>,
): void;
dispatchEvent<E extends BaseEvent, Map extends Object3DEventMap>(event: EventTypeValidator<E, Map>): void;
}

export class InteractiveGroup extends Group {
constructor(renderer: WebGLRenderer, camera: Camera);
Expand Down

0 comments on commit 839ef70

Please sign in to comment.