Skip to content

Add Typescript types and documentation for Promise Rejection #801

@mjaggard

Description

@mjaggard

Introduction

When developing a React Native app which uses NativeModules I found myself wanting to handle errors but struggling to even know what types should be returned for rejection of promises.

Discussion points

  1. I think documentation needs improvement for promise rejection, unless I missed something I couldn't find any info on that.
  2. There should be some types provided for those using Typescript to deal with the result of a rejection.
    The type should have these properties for Android:
    https://github.com/facebook/react-native/blob/1ca63e3e3dff6639f4efde74583145f9fa53759a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java#L31

Metadata

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