ws-apifix: type fixes (no new diagnostics)
This commit is contained in:
1 parent
2f0ff81c95
commit
3c2a646365
2 files changed
+6
-3
No files matched your search
@@ -430,7 +430,7 @@ local function videoToImage(v: any, o: Options): (any, Err.Err?)
|
||||
local w, h = math.max(1, tonumber(v.width) or 1), math.max(1, tonumber(v.height) or 1)
|
||||
limit = math.max(1, math.min(limit, math.floor((o.maxPixels or 2 ^ 25) / (w * h))))
|
||||
local defaultDur = if type(v.frameRate) == "number" and v.frameRate > 0 then 1 / v.frameRate else 0.1
|
||||
local images, delays = {}, {}
|
||||
local images: { any }, delays: { number } = {}, {}
|
||||
local t0: number? = nil
|
||||
local taken = 0 -- output slots used (fps mode)
|
||||
while #images < limit do
|
||||
|
||||
@@ -134,7 +134,7 @@ local function patternAt(m: any, pattern: any, row: any, channel: any): (any, Er
|
||||
if not isModule(m) then
|
||||
return bad("needs a tracker Module")
|
||||
end
|
||||
local p = if int(pattern, 0, 1e6) then m.patterns[pattern + 1] else nil
|
||||
local p: any = if int(pattern, 0, 1e6) then m.patterns[pattern + 1] else nil
|
||||
if p == nil then
|
||||
return bad("no pattern " .. tostring(pattern))
|
||||
end
|
||||
@@ -334,7 +334,10 @@ function MusicOps.addInstrument(m: any, spec: InstrumentSpec): (number?, Err.Err
|
||||
local env = Tracker.newEnvelope()
|
||||
local last = -1
|
||||
for i, pt in e.points do
|
||||
local tick, value = type(pt) == "table" and pt[1], type(pt) == "table" and pt[2]
|
||||
local tick: any, value: any = nil, nil
|
||||
if type(pt) == "table" then
|
||||
tick, value = pt[1], pt[2]
|
||||
end
|
||||
if not int(tick, 0, 65535) or type(value) ~= "number" or value < 0 or value > 64 or (tick :: number) <= last then
|
||||
return bad("addInstrument: envelope point " .. i .. " must be { tick, 0..64 } with increasing ticks")
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user