Skip to content

multiSet should expect a readonly input #1101

Closed
@geoffreytools

Description

@geoffreytools

What happened?

At current, (readonly [string, string])[] is going to be rejected by multiSet because its function signature is the following:

(keyValuePairs: [string, string][], callback?: MultiCallback) => Promise<void>

It should be the following:

(keyValuePairs: ReadonlyArray<readonly [string, string]>, callback?: MultiCallback) => Promise<void>

Version

1.23.1

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

Irrelevant

Steps to Reproduce

const entries = [['key', 'val']].map(([k, v]) => [k, v] as const)
AsyncStorage.multiSet(entries);
//                    ~~~~~~~
// Argument of type '(readonly [string, string])[]' is not assignable to parameter of type '[string, string][]'.
//  The type 'readonly [string, string]' is 'readonly' and cannot be assigned to the mutable type '[string, string]'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions