import Backbone from 'backbone'; export { default as $ } from '../utils/cash-dom'; interface NOOP {} export type Debounced = Function & { cancel(): void }; export type SetOptions = Backbone.ModelSetOptions & { avoidStore?: boolean }; export type AddOptions = Backbone.AddOptions & { temporary?: boolean }; export type RemoveOptions = Backbone.Silenceable; export type EventHandler = Backbone.EventHandler; export type ObjectHash = Backbone.ObjectHash; export type ObjectAny = Record; export type ObjectStrings = Record; // https://github.com/microsoft/TypeScript/issues/29729#issuecomment-1483854699 export type LiteralUnion = T | (U & NOOP); export type Position = { x: number; y: number; }; export interface Coordinates { x: number; y: number; } export interface Dimensions { height: number; width: number; } export interface BoxRect extends Coordinates, Dimensions {} export type ElementRect = { top: number; left: number; width: number; height: number; }; export type CombinedModelConstructorOptions< E, M extends Model = Model > = Backbone.ModelConstructorOptions & E; export interface ViewOptions extends Backbone.ViewOptions {} export class Model extends Backbone.Model {} export class Collection extends Backbone.Collection {} export class View extends Backbone.View {} export type PickMatching = { [K in keyof T as T[K] extends V ? K : never]: T[K] }; export type ExtractMethods = PickMatching; export enum CoordinatesTypes { Screen = 'screen', World = 'world', } export const DEFAULT_COORDS: Coordinates = { x: 0, y: 0, }; export const DEFAULT_BOXRECT: BoxRect = { ...DEFAULT_COORDS, width: 0, height: 0, };