These are the methods I was able to figure out:
Method 1(requires loadstring):
local function strToDatatype(str: string)
local f = loadstring("return "..str)
return f()
end
Method 2(requires hardcoding):
local datatypes = {Axes, BrickColor, CatalogSearchParams, CFrame, Color3, ColorSequence,
ColorSequenceKeypoint, DateTime, DockWidgetPluginGuiInfo, Enum, Faces, FloatCurveKey, Font,
Instance, NumberRange, NumberSequence, NumberSequenceKeypoint, OverlapParams, PathWaypoint,
PhysicalProperties, Random, Ray, RaycastParams, Rect, Region3, Region3int16, SharedTable,
TweenInfo, UDim, UDim2, Vector2, Vector2int16, Vector3, Vector3int16}
local names = [[Axes, BrickColor, CatalogSearchParams, CFrame, Color3, ColorSequence,
ColorSequenceKeypoint, DateTime, DockWidgetPluginGuiInfo, Enum, Faces, FloatCurveKey, Font,
Instance, NumberRange, NumberSequence, NumberSequenceKeypoint, OverlapParams, PathWaypoint,
PhysicalProperties, Random, Ray, RaycastParams, Rect, Region3, Region3int16, SharedTable,
TweenInfo, UDim, UDim2, Vector2, Vector2int16, Vector3, Vector3int16]]
names = names:gsub("\n", ""):gsub(" ", ""):split(",")
local function strToDatatype(str: string)
local index = table.find(names, str)
return datatypes[index]
end