local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("Store")
dataStore:UpdateAsync("Key", function(value: any, keyInfo: DataStoreKeyInfo)
local metadata: {[string]: any}
if keyInfo then
metadata = keyInfo:GetMetadata()
else
metadata = {}
end
if metadata.Value then
return value, {}, metadata
end
return value, {}, metadata
end)
Hello! Yes, this class of issue (seeing silly looking unsimplified types like {} | {} is something we’re tracking. The other issue you note as a real world example might be running into a different issue, in that the new solver still “greedily” tries to infer return types for functions.
Also the first thing I showed with the {} | {} type is a little strange but I guess is also technically not a bug but does complicate the type
“Bugs” are always fuzzy in software, but in my mind outputting a type too complex to be read easily is a bug, even if it’s correct.
I wonder if a function has multiple returns and if we dont define what’s returned if it should just unionise all the returns?
Something like that! This was impossible (or at least exceptionally difficult) to do in the old solver, but in the new solver it’s much easier to accomplish.