I’m working in Roblox using Luau with --!strict enabled.
This is a ModuleScript intended to return a typed table.
It runs on both client and server.
Here is the minimal code that causes the issue:
--!strict
local RunService = game:GetService("RunService")
if RunService:IsClient() then
return {} :: DataServiceServer
end
I get this compile error:
Unknown type 'DataServiceServer'
My goal is to return an empty table typed as DataServiceServer when running on the client.
Why does Luau not recognize the type here in strict mode, and what is the correct way to define or cast this return value?