Skip to content

multiGet can return nulls, but the TS types do not reflect this #58

Closed
@lukewlms

Description

@lukewlms

Current behavior

Querying AsyncStorage for an unknown key using multiGet can return null values.

However the types indicate this is impossible.

Expected behavior

Types should indicate that returning null is possible, OR null should never be returned (I don't know which is correct, but I would think the types).

Repro steps

Run code:

  const [testPair] = await AsyncStorage.multiGet(["DOES NOT EXIST"]);
  console.log(testPair);

return value: ["DOES NOT EXIST", null]

Environment

  • Async Storage version: Latest

"@react-native-community/async-storage": "^1.2.2",

"react-native": "0.59.1",

  • Platform tested: iOS

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