mirror of
https://github.com/0x5eal/luau-unzip.git
synced 2025-04-10 17:20:53 +01:00
fix: remove table.freeze
to fix decomp routine types not being inferred
This commit is contained in:
parent
d88091ea5a
commit
bf7f51bebc
1 changed files with 5 additions and 7 deletions
|
@ -16,11 +16,11 @@ local SIGNATURES = table.freeze({
|
||||||
|
|
||||||
-- Decompression routines for each supported compression method
|
-- Decompression routines for each supported compression method
|
||||||
local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress: (buffer, number, validateCrc.CrcValidationOptions) -> buffer } } =
|
local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress: (buffer, number, validateCrc.CrcValidationOptions) -> buffer } } =
|
||||||
table.freeze({
|
{
|
||||||
-- `STORE` decompression method - No compression
|
-- `STORE` decompression method - No compression
|
||||||
[0x00] = {
|
[0x00] = {
|
||||||
name = "STORE" :: CompressionMethod,
|
name = "STORE" :: CompressionMethod,
|
||||||
decompress = function(buf, _, validation)
|
decompress = function(buf, _, validation): buffer
|
||||||
validateCrc(buf, validation)
|
validateCrc(buf, validation)
|
||||||
return buf
|
return buf
|
||||||
end,
|
end,
|
||||||
|
@ -29,15 +29,13 @@ local DECOMPRESSION_ROUTINES: { [number]: { name: CompressionMethod, decompress:
|
||||||
-- `DEFLATE` decompression method - Compressed raw deflate chunks
|
-- `DEFLATE` decompression method - Compressed raw deflate chunks
|
||||||
[0x08] = {
|
[0x08] = {
|
||||||
name = "DEFLATE" :: CompressionMethod,
|
name = "DEFLATE" :: CompressionMethod,
|
||||||
decompress = function(buf, uncompressedSize, validation)
|
decompress = function(buf, uncompressedSize, validation): buffer
|
||||||
-- FIXME: Why is uncompressedSize not getting inferred correctly although it
|
local decompressed = inflate(buf, uncompressedSize)
|
||||||
-- is typed?
|
|
||||||
local decompressed = inflate(buf, uncompressedSize :: any)
|
|
||||||
validateCrc(decompressed, validation)
|
validateCrc(decompressed, validation)
|
||||||
return decompressed
|
return decompressed
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
local EMPTY_PROPERTIES: ZipEntryProperties = table.freeze({
|
local EMPTY_PROPERTIES: ZipEntryProperties = table.freeze({
|
||||||
size = 0,
|
size = 0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue