diff --git a/packages/core/src/engines/Engine.ts b/packages/core/src/engines/Engine.ts index 113f799af..b6fa8e234 100644 --- a/packages/core/src/engines/Engine.ts +++ b/packages/core/src/engines/Engine.ts @@ -3,7 +3,6 @@ import { getEventDetails } from '../utils/events' import { call } from '../utils/fn' import { V, computeRubberband } from '../utils/maths' import { GestureKey, IngKey, State, Vector2 } from '../types' -import { NonUndefined } from '../types' /** * The lib doesn't compute the kinematics on the last event of the gesture @@ -180,7 +179,7 @@ export abstract class Engine { * Function ran at the start of the gesture. * @param event */ - start(event: NonUndefined['event']) { + start(event: NonNullable['event']) { const state = this.state const config = this.config if (!state._active) { @@ -223,7 +222,7 @@ export abstract class Engine { * Computes all sorts of state attributes, including kinematics. * @param event */ - compute(event?: NonUndefined['event']) { + compute(event?: NonNullable['event']) { const { state, config, shared } = this state.args = this.args diff --git a/packages/core/src/types/config.ts b/packages/core/src/types/config.ts index 024fcc66e..4c8e6a299 100644 --- a/packages/core/src/types/config.ts +++ b/packages/core/src/types/config.ts @@ -1,5 +1,5 @@ import { State } from './state' -import { Vector2, Target, PointerType, NonUndefined } from './utils' +import { Vector2, Target, PointerType } from './utils' export type GestureKey = Exclude export type CoordinatesKey = Exclude @@ -42,7 +42,7 @@ export type GestureOptions = GenericOptions & { /** * The position `offset` will start from. */ - from?: Vector2 | ((state: NonUndefined) => Vector2) + from?: Vector2 | ((state: NonNullable) => Vector2) /** * The handler will fire only when the gesture displacement is greater than * the threshold. diff --git a/packages/core/src/types/state.ts b/packages/core/src/types/state.ts index 8dba04285..5873bcae5 100644 --- a/packages/core/src/types/state.ts +++ b/packages/core/src/types/state.ts @@ -1,5 +1,5 @@ import { GestureKey } from './config' -import { NonUndefined, Vector2, WebKitGestureEvent } from './utils' +import { Vector2, WebKitGestureEvent } from './utils' export type IngKey = 'dragging' | 'wheeling' | 'moving' | 'hovering' | 'scrolling' | 'pinching' @@ -262,4 +262,4 @@ export interface State { pinch?: PinchState & { event: EventTypes['pinch'] } } -export type FullGestureState = SharedGestureState & NonUndefined +export type FullGestureState = SharedGestureState & NonNullable diff --git a/packages/core/src/types/utils.ts b/packages/core/src/types/utils.ts index a22508af1..979508e61 100644 --- a/packages/core/src/types/utils.ts +++ b/packages/core/src/types/utils.ts @@ -3,8 +3,6 @@ export type WebKitGestureEvent = PointerEvent & { scale: number; rotation: numbe export type Target = EventTarget | { current: EventTarget | null } export type PointerType = 'mouse' | 'touch' | 'pen' -// replaces NonUndefined from 4.7 and inferior versions -export type NonUndefined = T extends undefined ? never : T export type EventHandler = (event: E) => void // rip off from React types