You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
TypeScript linter flags the string passed in for the encryptionType parameter when invoking the zipWithPassword method
To Reproduce
If I invoke zipWithPassword as follows: await zipWithPassword(source, target, password, 'AES-256')
TypeScript complains:
Argument of type '"AES-256"' is not assignable to parameter of type 'encryptionMethods | undefined'. ts(2345)
Expected behavior
No TypeScript errors for relevant strings passed in for encryptionMethods parameter.
Env (please complete the following information):
Device:
OS: Linux
OS Version: Linux Mint 20.2
Package Version: 7.0.1
Additional context
I believe you've incorrectly implemented your enum in your index.d.ts. The correct implementation should be: enum EncryptionMethods { STANDARD = "STANDARD", AES_128 = "AES-128", AES_256 = "AES-256" }
If I edit your types declaration as above, everything works as expected and TypeScript is happy. For context, I'm running an Android emulator using Android Studio. When invoking zipWithPassword, I am passing a single file as source, so it's enclosed in an array, as per documentation.
The text was updated successfully, but these errors were encountered:
pvburger
added a commit
to pvburger/react-native-zip-archive
that referenced
this issue
Jan 24, 2025
pvburger
changed the title
zipWithPassword method does not work when passed encryption type as string
zipWithPassword method results in TypeScript type error (ts-2345) when passed string for encryptionType
Jan 25, 2025
Describe the bug
TypeScript linter flags the string passed in for the encryptionType parameter when invoking the zipWithPassword method
To Reproduce
If I invoke zipWithPassword as follows:
await zipWithPassword(source, target, password, 'AES-256')
TypeScript complains:
Argument of type '"AES-256"' is not assignable to parameter of type 'encryptionMethods | undefined'. ts(2345)
Expected behavior
No TypeScript errors for relevant strings passed in for encryptionMethods parameter.
Env (please complete the following information):
Additional context
I believe you've incorrectly implemented your enum in your index.d.ts. The correct implementation should be:
enum EncryptionMethods { STANDARD = "STANDARD", AES_128 = "AES-128", AES_256 = "AES-256" }
If I edit your types declaration as above, everything works as expected and TypeScript is happy. For context, I'm running an Android emulator using Android Studio. When invoking zipWithPassword, I am passing a single file as source, so it's enclosed in an array, as per documentation.
The text was updated successfully, but these errors were encountered: