From bf7f51bebc583448bd0f65dce96b58d79bfd354a Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 8 Jan 2025 16:28:55 +0000 Subject: [PATCH] fix: remove `table.freeze` to fix decomp routine types not being inferred --- lib/init.luau | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/init.luau b/lib/init.luau index 78e247e..fdb3903 100644 --- a/lib/init.luau +++ b/lib/init.luau @@ -16,11 +16,11 @@ local SIGNATURES = table.freeze({ -- Decompression routines for each supported compression method local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress: (buffer, number, validateCrc.CrcValidationOptions) -> buffer } } = - table.freeze({ + { -- `STORE` decompression method - No compression [0x00] = { name = "STORE" :: CompressionMethod, - decompress = function(buf, _, validation) + decompress = function(buf, _, validation): buffer validateCrc(buf, validation) return buf end, @@ -29,15 +29,13 @@ local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress: -- `DEFLATE` decompression method - Compressed raw deflate chunks [0x08] = { name = "DEFLATE" :: CompressionMethod, - decompress = function(buf, uncompressedSize, validation) - -- FIXME: Why is uncompressedSize not getting inferred correctly although it - -- is typed? - local decompressed = inflate(buf, uncompressedSize :: any) + decompress = function(buf, uncompressedSize, validation): buffer + local decompressed = inflate(buf, uncompressedSize) validateCrc(decompressed, validation) return decompressed end, }, - }) + } local EMPTY_PROPERTIES: ZipEntryProperties = table.freeze({ size = 0,