Skip to content

Commit

Permalink
Use more accurate type in LinkingManager spec file (#45450)
Browse files Browse the repository at this point in the history
Summary:
The `LinkingModule.getInitialURL` method is declared as returning a `Proimise<string>` but looking at the implementation it can also return null:

https://github.com/facebook/react-native/blob/a96272e27eeee0c7a26e73bb32e55d3ef8d741aa/packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.mm#L166
which is returned by
https://github.com/facebook/react-native/blob/a96272e27eeee0c7a26e73bb32e55d3ef8d741aa/packages/react-native/Libraries/Linking/Linking.js#L96
which happens to expand the type to the correct type for most external users.

React-native-window's turbomodule codegen is more type strict, and so cannot return null with the current spec.

## Changelog:

[INTERNAL] [FIXED] - Use more accurate type in LinkingManager spec file

Pull Request resolved: #45450

Test Plan:
Type change only, so should only affect build time change which will be caught by CI.
Have verified that this type change allows react-native-windows to return null.

Reviewed By: robhogan

Differential Revision: D59816089

Pulled By: zeyap

fbshipit-source-id: 9810f150ce84b503883e72b1f29518d2e62258b6
  • Loading branch information
acoates-ms authored and facebook-github-bot committed Jul 16, 2024
1 parent c085180 commit 892c835
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod

export interface Spec extends TurboModule {
// Common interface
+getInitialURL: () => Promise<string>;
+getInitialURL: () => Promise<?string>;
+canOpenURL: (url: string) => Promise<boolean>;
+openURL: (url: string) => Promise<void>;
+openSettings: () => Promise<void>;
Expand Down

0 comments on commit 892c835

Please sign in to comment.