Skip to content

multiSet should expect a readonly input #1101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
geoffreytools opened this issue Jun 10, 2024 · 0 comments · Fixed by #1103
Closed
5 tasks done

multiSet should expect a readonly input #1101

geoffreytools opened this issue Jun 10, 2024 · 0 comments · Fixed by #1103
Labels
bug Something isn't working

Comments

@geoffreytools
Copy link

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]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant