--!strict --[[ Stores common public-facing type information for Fusion APIs. ]] type Set = { [T]: any } --[[ General use types ]] -- A unique symbolic value. export type Symbol = { type: "Symbol", name: string, } -- Types that can be expressed as vectors of numbers, and so can be animated. export type Animatable = number | CFrame | Color3 | ColorSequenceKeypoint | DateTime | NumberRange | NumberSequenceKeypoint | PhysicalProperties | Ray | Rect | Region3 | Region3int16 | UDim | UDim2 | Vector2 | Vector2int16 | Vector3 | Vector3int16 -- A task which can be accepted for cleanup. export type Task = Instance | RBXScriptConnection | () -> () | { destroy: (any) -> () } | { Destroy: (any) -> () } | { Task } -- Script-readable version information. export type Version = { major: number, minor: number, isRelease: boolean, } -- An object which stores a value scoped in time. export type Contextual = { type: "Contextual", now: (Contextual) -> T, is: (Contextual, T) -> ContextualIsMethods, } type ContextualIsMethods = { during: (ContextualIsMethods, (A...) -> T, A...) -> T, } --[[ Generic reactive graph types ]] -- A graph object which can have dependents. export type Dependency = { dependentSet: Set, } -- A graph object which can have dependencies. export type Dependent = { update: (Dependent) -> boolean, dependencySet: Set, } -- An object which stores a piece of reactive state. export type StateObject = Dependency & { type: "State", kind: string, _typeIdentifier: T, } -- Either a constant value of type T, or a state object containing type T. export type CanBeState = StateObject | T -- Function signature for use callbacks. export type Use = (target: CanBeState) -> T --[[ Specific reactive graph types ]] -- A state object whose value can be set at any time by the user. export type Value = StateObject & { kind: "State", set: (Value, newValue: any, force: boolean?) -> (), } -- A state object whose value is derived from other objects using a callback. export type Computed = StateObject & Dependent & { kind: "Computed", } -- A state object whose value is derived from other objects using a callback. export type ForPairs = StateObject<{ [KO]: VO }> & Dependent & { kind: "ForPairs", } -- A state object whose value is derived from other objects using a callback. export type ForKeys = StateObject<{ [KO]: V }> & Dependent & { kind: "ForKeys", } -- A state object whose value is derived from other objects using a callback. export type ForValues = StateObject<{ [K]: VO }> & Dependent & { kind: "ForKeys", } -- A state object which follows another state object using tweens. export type Tween = StateObject & Dependent & { kind: "Tween", } -- A state object which follows another state object using spring simulation. export type Spring = StateObject & Dependent & { kind: "Spring", setPosition: (Spring, newPosition: Animatable) -> (), setVelocity: (Spring, newVelocity: Animatable) -> (), addVelocity: (Spring, deltaVelocity: Animatable) -> (), } -- An object which can listen for updates on another state object. export type Observer = Dependent & { kind: "Observer", onChange: (Observer, callback: () -> ()) -> () -> (), } --[[ Instance related types ]] -- Denotes children instances in an instance or component's property table. export type SpecialKey = { type: "SpecialKey", kind: string, stage: "self" | "descendants" | "ancestor" | "observer", apply: ( SpecialKey, value: any, applyTo: Instance, cleanupTasks: { Task } ) -> (), } -- A collection of instances that may be parented to another instance. export type Children = Instance | StateObject | { [any]: Children } -- A table that defines an instance's properties, handlers and children. export type PropertyTable = { [string | SpecialKey]: any } return nil