Skip to content

zipWithPassword method results in TypeScript type error (ts-2345) when passed string for encryptionType #327

Open
@pvburger

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions