import type { Accessor, Setter } from "solid-js"; export type { EffectOptions, OnOptions } from "solid-js"; export type { ResolvedJSXElement, ResolvedChildren } from "solid-js/types/reactive/signal.js"; /** * Can be single or in an array */ export type Many = T | T[]; export type Values = O[keyof O]; export type Noop = (...a: any[]) => void; export type Directive

= (el: Element, props: Accessor

) => void; /** * Infers the type of the array elements */ export type ItemsOf = T extends (infer E)[] ? E : never; export type ItemsOfMany = T extends any[] ? ItemsOf : T; export type SetterParam = Parameters>[0]; /** * T or a reactive/non-reactive function returning T */ export type MaybeAccessor = T | Accessor; /** * Accessed value of a MaybeAccessor * @example * ```ts * MaybeAccessorValue> * // => string * MaybeAccessorValue string>> * // => string | (() => string) * MaybeAccessorValue | Function> * // => string | void * ``` */ export type MaybeAccessorValue> = T extends () => any ? ReturnType : T; export type OnAccessEffectFunction = (input: AccessReturnTypes, prevInput: AccessReturnTypes, v: Prev) => Next; export type AccessReturnTypes = S extends MaybeAccessor[] ? { [I in keyof S]: AccessReturnTypes; } : MaybeAccessorValue; /** Allows to make shallow overwrites to an interface */ export type Modify = Omit & R; /** Allows to make nested overwrites to an interface */ export type ModifyDeep> = { [K in keyof A]: B[K] extends never ? A[K] : B[K] extends AnyObject ? ModifyDeep : B[K]; } & (A extends AnyObject ? Omit : A); /** Makes each property optional and turns each leaf property into any, allowing for type overrides by narrowing any. */ export type DeepPartialAny = { [P in keyof T]?: T[P] extends AnyObject ? DeepPartialAny : any; }; /** Removes the `[...list]` functionality */ export type NonIterable = T & { [Symbol.iterator]: never; }; /** Get the required keys of an object */ export type RequiredKeys = keyof { [K in keyof T as T extends { [_ in K]: unknown; } ? K : never]: 0; }; /** Remove the first item of a tuple [1, 2, 3, 4] => [2, 3, 4] */ export type Tail = ((...t: T) => void) extends (x: any, ...u: infer U) => void ? U : never; /** `A | B => A & B` */ export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; export type ExtractIfPossible = Extract extends never ? U : Extract; export type AnyObject = Record; export type AnyStatic = [] | any[] | AnyObject; export type AnyFunction = (...args: any[]) => any; export type AnyClass = abstract new (...args: any) => any; export type PrimitiveValue = PropertyKey | boolean | bigint | null | undefined; export type FalsyValue = false | 0 | "" | null | undefined; export type Truthy = Exclude; export type Falsy = Extract; export type Position = { x: number; y: number; }; export type Size = { width: number; height: number; }; /** Unwraps the type definition of an object, making it more readable */ export type Simplify = T extends object ? { [K in keyof T]: T[K]; } : T; /** Unboxes type definition, making it more readable */ export type UnboxLazy = T extends () => infer U ? U : T; type RawNarrow = (T extends [] ? [] : never) | (T extends string | number | bigint | boolean ? T : never) | { [K in keyof T]: T[K] extends Function ? T[K] : RawNarrow; }; export type Narrow = T extends [] ? T : RawNarrow; export type NoInfer = [T][T extends any ? 0 : never];