more type hints and resolved diagnostic disables with 'as'

This commit is contained in:
Mikayla Fischler
2024-09-21 17:58:53 -04:00
parent ec2921e393
commit 2047794173
3 changed files with 9 additions and 7 deletions

View File

@@ -41,9 +41,7 @@ function rsctl.new(redstone_rtus)
function public.digital_read(port)
for i = 1, #redstone_rtus do
local io = redstone_rtus[i].get_db().io[port]
-- this would only be digital, so it would only return boolean or nil
---@diagnostic disable-next-line: return-type-mismatch
if io ~= nil then return io.read() end
if io ~= nil then return io.read() --[[@as boolean|nil]] end
end
end