-- Compiled with roblox-ts v1.2.7 local TS = _G[script] local ZrEnum = TS.import(script, TS.getModule(script, "@rbxts", "zirconium").out.Data.Enum).ZrEnum local ZrEnumItem = TS.import(script, TS.getModule(script, "@rbxts", "zirconium").out.Data.EnumItem).ZrEnumItem local ZrObject = TS.import(script, TS.getModule(script, "@rbxts", "zirconium").out.Data.Object).default local ZrUndefined = TS.import(script, TS.getModule(script, "@rbxts", "zirconium").out.Data.Undefined) local ZrInstanceUserdata = TS.import(script, TS.getModule(script, "@rbxts", "zirconium").out.Data.Userdata).ZrInstanceUserdata local ZirconFuzzyPlayer = TS.import(script, script.Parent, "Validators", "ZirconFuzzyPlayerValidator").ZirconFuzzyPlayer local ZirconFuzzyPlayers = TS.import(script, script.Parent, "Validators", "ZirconFuzzyPlayersValidator").ZirconFuzzyPlayers local ZrRange = TS.import(script, TS.getModule(script, "@rbxts", "zirconium").out.Data.Range).default local zirconTypeOf = TS.import(script, script.Parent.Parent, "Shared", "typeId").zirconTypeOf local ZirconString = { Type = "string", Validate = function(self, value) return type(value) == "string" end, ErrorMessage = function(value) return "Expected string, got " .. zirconTypeOf(value) end, } local ZirconNumber = { Type = "number", Validate = function(self, value) return type(value) == "number" end, ErrorMessage = function(value) return "Expected number, got " .. zirconTypeOf(value) end, } local ZirconBoolean = { Type = "boolean", Validate = function(self, value) return type(value) == "boolean" end, ErrorMessage = function(value) return "Expected boolean, got " .. zirconTypeOf(value) end, } local ZirconObject = { Type = "object", Validate = function(self, value) return TS.instanceof(value, ZrObject) end, ErrorMessage = function(value) return "Expected object, got " .. zirconTypeOf(value) end, } local NativeEnum = { Type = "ZrEnum", Validate = function(self, value) return TS.instanceof(value, ZrEnum) end, ErrorMessage = function(value) return "Expected enum, got " .. zirconTypeOf(value) end, } local NativeEnumItem = { Type = "ZrEnumItem", Validate = function(self, value) return TS.instanceof(value, ZrEnumItem) end, ErrorMessage = function(value) return "Expected enum item, got " .. zirconTypeOf(value) end, } local function ZirconOptionalValidator(validator) return { Type = validator.Type .. "?", Validate = function(self, value, player) return validator:Validate(value, player) or value == nil end, Transform = function(self, value, player) if validator:Validate(value, player) then if validator.Transform ~= nil then local _condition = validator:Transform(value, player) if _condition == nil then _condition = nil end return _condition else return value end else return nil end end, } end local ZirconUnknown = { Type = "unknown", Validate = function(self, value) return true end, } local ZirconDefined = { Type = "defined", Validate = function(self, value) return value ~= ZrUndefined and value ~= nil end, ErrorMessage = function(value) return "Expected defined, got " .. zirconTypeOf(value) end, } local ZirconRange = { Type = "range", Validate = function(self, value) return type(value) == "number" or TS.instanceof(value, ZrRange) end, Transform = function(self, value) if type(value) == "number" then return ZrRange.new(NumberRange.new(value)) else return value end end, ErrorMessage = function(value) return "Expected range, got " .. zirconTypeOf(value) end, } local function ZirconInstanceIsA(typeName) local _arg0 = { Type = "RBX" .. typeName, Validate = function(self, value) return TS.instanceof(value, ZrInstanceUserdata) and value:isA(typeName) end, Transform = function(self, value) return value:value() end, ErrorMessage = function(value) return "Expected Instance, got " .. zirconTypeOf(value) end, } return _arg0 end local ZirconPlayer = ZirconInstanceIsA("Player") local BuiltInValidators = { string = ZirconString, number = ZirconNumber, boolean = ZirconBoolean, object = ZirconObject, defined = ZirconDefined, ["object?"] = ZirconOptionalValidator(ZirconObject), player = ZirconFuzzyPlayer, players = ZirconFuzzyPlayers, ["player?"] = ZirconOptionalValidator(ZirconFuzzyPlayer), ["players?"] = ZirconOptionalValidator(ZirconFuzzyPlayers), ["string?"] = ZirconOptionalValidator(ZirconString), ["number?"] = ZirconOptionalValidator(ZirconNumber), ["boolean?"] = ZirconOptionalValidator(ZirconBoolean), unknown = ZirconUnknown, ZrEnum = NativeEnum, ZrEnumItem = NativeEnumItem, range = ZirconRange, ["range?"] = ZirconOptionalValidator(ZirconRange), } -- export type InferArguments> = { -- readonly [P in keyof T]: InferTypeFromValidator; -- } & { length: T["length"] }; return { ZirconOptionalValidator = ZirconOptionalValidator, ZirconInstanceIsA = ZirconInstanceIsA, ZirconString = ZirconString, ZirconNumber = ZirconNumber, ZirconBoolean = ZirconBoolean, ZirconObject = ZirconObject, NativeEnum = NativeEnum, NativeEnumItem = NativeEnumItem, ZirconUnknown = ZirconUnknown, ZirconDefined = ZirconDefined, ZirconRange = ZirconRange, ZirconPlayer = ZirconPlayer, BuiltInValidators = BuiltInValidators, }