stronger typing

This commit is contained in:
2025-10-01 12:33:41 -04:00
parent 9c27981d24
commit caa473876a
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -30,8 +30,8 @@ local compressionModule = {} :: CompressionModule
@param opts Options table of type `types.opts`
@return The decompressed data as a string, or false if decompression fails.
]]--
function compressionModule.zlibDecompress(contents: string, opts: types.opts): string | boolean
assert(typeof(contents) == "string", "Expected contents to be of type 'string'")
function compressionModule.zlibDecompress(contents: string | buffer, opts: types.opts): string | boolean
assert(typeof(contents) == "string" or typeof(contents) == "buffer", "Expected contents to be of type 'string' or 'buffer'")
assert(typeof(opts) == "table", "Expected opts to be of type 'table'")
local success, decompressed: string = pcall(function() return serde.decompress("zlib", contents) end)
if not success then