Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TS types for Codegen #46484

Closed
wants to merge 1 commit into from

Conversation

cipolleschi
Copy link
Contributor

Summary:
We recently realized that we don't have TS types for Codegen.
These are needed to let our users use these types when writing Specs in TS

Changelog

[General][Added] - Add CodegenTypes for TS

Differential Revision: D62644516

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Sep 13, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62644516

Comment on lines 22 to 26
export type Double = number;
export type Float = number;
export type Int32 = number;
export type UnsafeObject = any; // Object is forbidden in strict mode
export type UnsafeMixed = any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same thing as here?

declare module 'react-native/Libraries/Types/CodegenTypes' {

Comment on lines 25 to 26
export type UnsafeObject = any; // Object is forbidden in strict mode
export type UnsafeMixed = any;
Copy link
Contributor

@lindboe lindboe Sep 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this has already been discussed, but I think it's preferable to use unknown instead of any here. unknown will create a type error unless the consumer verifies the type of the value before using it. any will not notify the user that the type is unsafe.

Consumers can cast the value as any in their own code if they'd prefer to not verify the type.

Summary:
Pull Request resolved: facebook#46484

We recently realized that we don't have TS types for Codegen.
These are needed to let our users use these types when writing Specs in TS

## Changelog
[General][Added] - Add CodegenTypes for TS

Reviewed By: christophpurrer

Differential Revision: D62644516
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62644516

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Sep 16, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 20b1415.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @cipolleschi in 20b1415

When will my fix make it into a release? | How to file a pick request?

blakef pushed a commit that referenced this pull request Nov 12, 2024
Summary:
Pull Request resolved: #46484

We recently realized that we don't have TS types for Codegen.
These are needed to let our users use these types when writing Specs in TS

## Changelog
[General][Added] - Add CodegenTypes for TS

Reviewed By: christophpurrer

Differential Revision: D62644516

fbshipit-source-id: 92bb7e8998d31806f6eb63319fb6d406fcd65ad8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants