Skip to content

Conversation

@SamChou19815
Copy link
Contributor

Summary:
GenericStyleProp is defined as

type GenericStyleProp<+T> =
  | null
  | void
  | T
  | false
  | ''
  | $ReadOnlyArray<GenericStyleProp<T>>;

and ____FlattenStyleProp_Internal is designed to reverse it. We can use conditional type to achieve it instead of $Call:

null | void | false | '' doesn't contribute to anything doing reversal, so they are mapped to empty. When we encounter $ReadOnlyArray, we recursively apply ____FlattenStyleProp_Internal. Otherwise, we return the input type.

Changelog: [Internal]

Differential Revision: D52142082

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 14, 2023
@facebook-github-bot
Copy link
Contributor

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

Summary:

`GenericStyleProp` is defined as

```
type GenericStyleProp<+T> =
  | null
  | void
  | T
  | false
  | ''
  | $ReadOnlyArray<GenericStyleProp<T>>;
```

and `____FlattenStyleProp_Internal` is designed to reverse it. We can use conditional type to achieve it instead of $Call:

`null | void | false | ''` doesn't contribute to anything doing reversal, so they are mapped to empty. When we encounter $ReadOnlyArray, we recursively apply `____FlattenStyleProp_Internal`. Otherwise, we return the input type.

Changelog: [Internal]

Reviewed By: jbrown215

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

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

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Dec 15, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in ce69213.

Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
Summary:
Pull Request resolved: facebook#41931

`GenericStyleProp` is defined as

```
type GenericStyleProp<+T> =
  | null
  | void
  | T
  | false
  | ''
  | $ReadOnlyArray<GenericStyleProp<T>>;
```

and `____FlattenStyleProp_Internal` is designed to reverse it. We can use conditional type to achieve it instead of $Call:

`null | void | false | ''` doesn't contribute to anything doing reversal, so they are mapped to empty. When we encounter $ReadOnlyArray, we recursively apply `____FlattenStyleProp_Internal`. Otherwise, we return the input type.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D52142082

fbshipit-source-id: 590c71c6400498730675e20c67b173c3bc285d00
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.

2 participants