Skip to content

Commit

Permalink
Fix Typescript typings in react-native-flipper (facebook#3209)
Browse files Browse the repository at this point in the history
Summary:
The implementation of react-native-flipper [makes runtime assertions](https://github.com/facebook/flipper/blob/main/react-native/react-native-flipper/index.js#L20) about some variables but those type requirements [aren't properly reflected in the Typescript type defs](https://github.com/facebook/flipper/blob/main/react-native/react-native-flipper/index.d.ts#L45).

## Changelog

Corrected Typescript type defs in react-native-flipper

Pull Request resolved: facebook#3209

Test Plan:
(No runtime effect)
In vscode, the typings now properly restrict the arguments to `FlipperResponder.success`,  `FlipperResponder.error`, and  `FlipperConnection.send`

Reviewed By: antonk52

Differential Revision: D33307792

Pulled By: mweststrate

fbshipit-source-id: da3bf7fcacdf3718dc9a625e4229f3c8ecd7ac93
  • Loading branch information
dougkeen authored and facebook-github-bot committed Dec 24, 2021
1 parent 521ef9e commit 5857637
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions react-native/react-native-flipper/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ declare namespace Flipper {
runInBackground?(): boolean;
}

type Serializable = undefined | Array<any> | object

export interface FlipperResponder {
success(response?: any): void;
error(response: any): void;
success(response?: Serializable): void;
error(response: Serializable): void;
}

export interface FlipperConnection {
send(method: string, data: any): void;
send(method: string, data: Serializable): void;
reportErrorWithMetadata(reason: string, stackTrace: string): void;
reportError(error: Error): void;
receive(
Expand Down

0 comments on commit 5857637

Please sign in to comment.