Skip to content

Commit

Permalink
fix(types): Improve type definition (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour authored Jan 20, 2019
1 parent 9f0e098 commit 702a767
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/medium-zoom.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type ZoomSelector = string | Element | Element[] | NodeList
export type ZoomSelector = string | HTMLElement | HTMLElement[] | NodeList

export interface ZoomOptions {
/**
Expand Down Expand Up @@ -27,14 +27,14 @@ export interface ZoomOptions {
*
* @default null
*/
container?: string | Element | ZoomContainer
container?: string | HTMLElement | ZoomContainer

/**
* The template element to display on zoom.
*
* @default null
*/
template?: string | Element
template?: string | HTMLTemplateElement
}

export interface ZoomContainer {
Expand All @@ -54,7 +54,7 @@ export interface ZoomOpenOptions {
*
* @default null
*/
target?: Element
target?: HTMLElement
}

export interface Zoom {
Expand Down Expand Up @@ -121,7 +121,11 @@ export interface Zoom {
* @param options - The event listener options (same as [`addEventListener`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters))
* @returns The zoom.
*/
on(type: string, listener: () => void, options?: object): Zoom
on(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions
): Zoom

/**
* Unregisters an event handler.
Expand All @@ -131,7 +135,11 @@ export interface Zoom {
* @param options - The event listener options (same as [`removeEventListener`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#Parameters))
* @returns The zoom.
*/
off(type: string, listener: () => void, options?: object): Zoom
off(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions
): Zoom

/**
* Returns the zoom options.
Expand All @@ -145,14 +153,14 @@ export interface Zoom {
*
* @returns The zoom images.
*/
getImages(): Element[]
getImages(): HTMLElement[]

/**
* Returns the current zoomed image.
*
* @returns The current zoomed image.
*/
getZoomedImage(): Element
getZoomedImage(): HTMLElement
}

/**
Expand Down

0 comments on commit 702a767

Please sign in to comment.