function Util.ParsePrefixedUnionType(b,n)local Q=Util.SplitStringSimple(b)local X={}for b=1,#Q,2 do X[#X+1]={prefix=Q[b-1]or"",type=Q[b]}end table.sort(X,function(b,n)return#b.prefix>#n.prefix end)for b=1,#X,1 do local Q=X[b]if n:sub(1,#Q.prefix)==Q.prefix then return Q.type,n:sub(#Q.prefix+1),Q.prefix end end end

function Util.ParsePrefixedUnionType(typeValue, rawValue)
	local split = Util.SplitStringSimple(typeValue)

	-- Check prefixes in order from longest to shortest
	local types = {}
	for i = 1, #split, 2 do
		types[#types + 1] = {
			prefix = split[i - 1] or "",
			type = split[i]
		}
	end

	table.sort(
		types,
		function(a, b)
			return #a.prefix > #b.prefix
		end
	)

	for i = 1, #types do
		local t = types[i]

		if rawValue:sub(1, #t.prefix) == t.prefix then
			return t.type, rawValue:sub(#t.prefix + 1), t.prefix
		end
	end
end
