// utility types type Literal = string | number | boolean | undefined | null | void | {}; type ArrayType = T extends Array ? U : never; interface t { // lua types /** checks to see if `type(value) == typeName` */ type: (typeName: T) => t.check; /** checks to see if `typeof(value) == typeName` */ typeof: (typeName: T) => t.check; /** checks to see if `value` is not undefined */ any: t.check; /** checks to see if `value` is a boolean */ boolean: t.check; /** checks to see if `value` is a thread */ thread: t.check; /** checks to see if `value` is a function */ callback: t.check<(...args: Array) => unknown>; /** alias of t.callback */ function: t.check; /** checks to see if `value` is undefined */ none: t.check; /** alias of t.none */ nil: t.check; /** checks to see if `value` is a number, will _not_ match NaN */ number: t.check; /** checks to see if `value` is NaN */ nan: t.check; /** checks to see if `value` is a string */ string: t.check; /** checks to see if `value` is an object */ table: t.check; /** checks to see if `value` is a userdata */ userdata: t.check; // roblox types /** checks to see if `value` is an Axes */ Axes: t.check; /** checks to see if `value` is a BrickColor */ BrickColor: t.check; /** checks to see if `value` is a CatalogSearchParams */ CatalogSearchParams: t.check; /** checks to see if `value` is a CFrame */ CFrame: t.check; /** checks to see if `value` is a Color3 */ Color3: t.check; /** checks to see if `value` is a ColorSequence */ ColorSequence: t.check; /** checks to see if `value` is a ColorSequenceKeypoint */ ColorSequenceKeypoint: t.check; /** checks to see if `value` is a DateTime */ DateTime: t.check; /** checks to see if `value` is a DockWidgetPluginGuiInfo */ DockWidgetPluginGuiInfo: t.check; /** checks to see if `value` is an Enum */ Enum: t.check; /** checks to see if `value` is an EnumItem */ EnumItem: t.check; /** checks to see if `value` is an Enums */ Enums: t.check; /** checks to see if `value` is a Faces */ Faces: t.check; /** checks to see if `value` is an Instance */ Instance: t.check; /** checks to see if `value` is a NumberRange */ NumberRange: t.check; /** checks to see if `value` is a NumberSequence */ NumberSequence: t.check; /** checks to see if `value` is a NumberSequenceKeypoint */ NumberSequenceKeypoint: t.check; /** checks to see if `value` is a PathWaypoint */ PathWaypoint: t.check; /** checks to see if `value` is a PhysicalProperties */ PhysicalProperties: t.check; /** checks to see if `value` is a Random */ Random: t.check; /** checks to see if `value` is a Ray */ Ray: t.check; /** checks to see if `value` is a RaycastParams */ RaycastParams: t.check; /** checks to see if `value` is a RaycastResult */ RaycastResult: t.check; /** checks to see if `value` is a RBXScriptConnection */ RBXScriptConnection: t.check; /** checks to see if `value` is a RBXScriptSignal */ RBXScriptSignal: t.check; /** checks to see if `value` is a Rect */ Rect: t.check; /** checks to see if `value` is a Region3 */ Region3: t.check; /** checks to see if `value` is a Region3int16 */ Region3int16: t.check; /** checks to see if `value` is a TweenInfo */ TweenInfo: t.check; /** checks to see if `value` is a UDim */ UDim: t.check; /** checks to see if `value` is a UDim2 */ UDim2: t.check; /** checks to see if `value` is a Vector2 */ Vector2: t.check; /** checks to see if `value` is a Vector2int16 */ Vector2int16: t.check; /** checks to see if `value` is a Vector3 */ Vector3: t.check; /** checks to see if `value` is a Vector3int16 */ Vector3int16: t.check; /** checks if `value` is an EnumItem which belongs to `Enum`. */ enum: (Enum: Enum.EnumType) => t.check; // type functions /** checks to see if `value == literalValue` */ literal>(this: void, ...args: T): t.check>; /** returns a t.union of each key in the table as a t.literal */ keyOf: (valueTable: T) => t.check; /** returns a t.union of each value in the table as a t.literal */ valueOf: (valueTable: T) => T extends { [P in keyof T]: infer U } ? t.check : never; /** checks to see if `value` is an integer */ integer: t.check; /** checks to see if `value` is a number and is more than or equal to `min` */ numberMin: (min: number) => t.check; /** checks to see if `value` is a number and is less than or equal to `max` */ numberMax: (max: number) => t.check; /** checks to see if `value` is a number and is more than `min` */ numberMinExclusive: (min: number) => t.check; /** checks to see if `value` is a number and is less than `max` */ numberMaxExclusive: (max: number) => t.check; /** checks to see if `value` is a number and is more than 0 */ numberPositive: t.check; /** checks to see if `value` is a number and is less than 0 */ numberNegative: t.check; /** checks to see if `value` is a number and `min <= value <= max` */ numberConstrained: (min: number, max: number) => t.check; /** checks to see if `value` is a number and `min < value < max` */ numberConstrainedExclusive: (min: number, max: number) => t.check; /** checks `t.string` and determines if value matches the pattern via `string.match(value, pattern)` */ match: (pattern: string) => t.check; /** checks to see if `value` is either nil or passes `check` */ optional: (check: t.check) => t.check; /** checks to see if `value` is a table and if its keys match against `check */ keys: (check: t.check) => t.check>; /** checks to see if `value` is a table and if its values match against `check` */ values: (check: t.check) => t.check>; /** checks to see if `value` is a table and all of its keys match against `keyCheck` and all of its values match against `valueCheck` */ map: (keyCheck: t.check, valueCheck: t.check) => t.check>; /** checks to see if `value` is a table and all of its keys match against `valueCheck` and all of its values are `true` */ set: (valueCheck: t.check) => t.check>; /** checks to see if `value` is an array and all of its keys are sequential integers and all of its values match `check` */ array: (check: t.check) => t.check>; /** ensures value is an array of a strict makeup and size */ strictArray: >>(...args: T) => t.check<{ [K in keyof T]: t.static }>; /** checks to see if `value` matches any given check */ union: >>(...args: T) => t.check>>; /** checks to see if `value` matches all given checks */ intersection: >>( ...args: T ) => T[Exclude | "length">] extends infer U ? (U extends any ? (k: U) => void : never) extends (k: t.check) => void ? t.check : never : never; /** checks to see if `value` matches a given interface definition */ interface: }>( checkTable: T, ) => t.check<{ [P in keyof T]: t.static }>; /** checks to see if `value` matches a given interface definition with no extra members */ strictInterface: }>( checkTable: T, ) => t.check<{ [P in keyof T]: t.static }>; /** ensure value is an Instance and it's ClassName matches the given ClassName */ instanceOf(this: void, className: S): t.check; instanceOf }>( this: void, className: S, checkTable: T, ): t.check }>; /** ensure value is an Instance and it's ClassName matches the given ClassName by an IsA comparison */ instanceIsA(this: void, className: S): t.check; instanceIsA }>( this: void, className: S, checkTable: T, ): t.check }>; /** * Takes a table where keys are child names and values are functions to check the children against. * Pass an instance tree into the function. * If at least one child passes each check, the overall check passes. * * Warning! If you pass in a tree with more than one child of the same name, this function will always return false */ children: }>( checkTable: T, ) => t.check }>; } declare namespace t { /** creates a static type from a t-defined type */ export type static = T extends t.check ? U : never; /** checks to see if `value` is a T */ export type check = (value: unknown) => value is T; } declare const t: t; export { t };