virgil-e3kit-js
virgil-e3kit-js copied to clipboard
.AsyncStorageStatic is not assignable to type
Describe the bug
Version: "@virgilsecurity/e3kit": "^0.7.0-beta.2"
Import: import { EThree } from '@virgilsecurity/e3kit-native';
After following the installation steps, a type error is shown related to AsyncStorage. When using AsyncStorage from react-native (deprecated), this error does not appear.
To Reproduce Steps to reproduce the behavior:
- Follow Virgil E3Kit SDK for React Native installation instructions.
- Try to use the example Usage code to initialize EThree using TypeScript.
- "EThree.initialize(getToken, { AsyncStorage })" will show a Type error.
Expected behavior No error.
Desktop (please complete the following information):
- OS: OSX 10.14.6
- Browser Chrome
- Version 78
Smartphone (please complete the following information):
- Device: iPhone 11 Pro Max Simulator
- OS: 13.0
- Browser Safari
Additional context
Error:
(property) EThreeNativeInitializeOptions.AsyncStorage: AsyncStorageStatic
Type 'import("@react-native-community/async-storage").AsyncStorageStatic' is not assignable to type 'import("/Users/x/x/x/x/mobile-app/node_modules/@virgilsecurity/e3kit-native/node_modules/@types/react-native/index").AsyncStorageStatic'. Types of property 'multiGet' are incompatible. Type '(keys: string[], callback?: ((errors?: Error[] | undefined, result?: [string, string | null][] | undefined) => void) | undefined) => Promise<[string, string | null][]>' is not assignable to type '(keys: string[], callback?: ((errors?: Error[] | undefined, result?: [string, string][] | undefined) => void) | undefined) => Promise<[string, string][]>'. Types of parameters 'callback' and 'callback' are incompatible. Types of parameters 'result' and 'result' are incompatible. Type '[string, string | null][] | undefined' is not assignable to type '[string, string][] | undefined'. Type '[string, string | null][]' is not assignable to type '[string, string][]'. Type '[string, string | null]' is not assignable to type '[string, string]'. Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'.ts(2322)
EThree.d.ts(5, 5): The expected type comes from property 'AsyncStorage' which is declared here on type 'EThreeNativeInitializeOptions'
Hi @rantwijk !
It appears that typings for @react-native-community/async-storage and react-native are different 😔
We will get back to you as soon as we will fix it.
For now, you can cast your storage to other type or use // @ts-disable
comment.
Same here!
This even fails the testing build since the AsyncStorage
is different.
https://circleci.com/gh/dooboolab/hackatalk-mobile/504?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
Hi @rantwijk ! It appears that typings for @react-native-community/async-storage and react-native are different 😔 We will get back to you as soon as we will fix it. For now, you can cast your storage to other type or use
// @ts-disable
comment.
bump, any plans to address this? still happening over a year later 😦
Closing as outdated
Still the same type bug for me with the following versions:
"@storybook/react-native": "6.0.1-beta.7"
"@react-native-async-storage/async-storage": "^1.17.10",