Skip to content

Commit

Permalink
Accept TypeScript type T | null | undefined as a maybe type of T in t…
Browse files Browse the repository at this point in the history
…urbo module (#34158)

Summary:
According Flow's document, a maybe type of T means `T | null | undefined`, instead of `T | null | void`.
I think keeping TypeScript and Flow being consistent to each other is better.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Changed] - Accept TypeScript type `T | null | undefined` as a maybe type of T in turbo module.

Pull Request resolved: #34158

Test Plan: `yarn jest` passed in `packages/react-native-codegen`

Reviewed By: yungsters

Differential Revision: D37731169

Pulled By: philIip

fbshipit-source-id: b6d9b7e8991f60e12c1004bed5b937b34fb02c47
  • Loading branch information
ZihanChen-MSFT authored and facebook-github-bot committed Jul 16, 2022
1 parent bf54f1c commit 9ecd203
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ import type {ViewProps} from 'ViewPropTypes';
import type {HostComponent} from 'react-native';
interface NativeCommands {
readonly hotspotUpdate: (viewRef: React.Ref<'RCTView'> | null | void, x: Int32, y: Int32) => void;
readonly hotspotUpdate: (viewRef: React.Ref<'RCTView'> | null | undefined, x: Int32, y: Int32) => void;
}
export interface ModuleProps extends ViewProps {
Expand Down Expand Up @@ -249,7 +249,7 @@ import type {ViewProps} from 'ViewPropTypes';
import type {HostComponent} from 'react-native';
export interface ModuleProps extends ViewProps {
nullable_with_default: WithDefault<Float, 1.0> | null | void;
nullable_with_default: WithDefault<Float, 1.0> | null | undefined;
}
export default codegenNativeComponent<ModuleProps>(
Expand Down
Loading

0 comments on commit 9ecd203

Please sign in to comment.