Skip to content

Conversation

@arushikesarwani94
Copy link
Contributor

Summary:
Previously, the parser was mapping to Array when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

StringLiteralUnionTypeAnnotation already had support for types, that can be expanded to all Union types so as to incorporate the Unions of different types.

{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.

Changelog: [Internal]

Differential Revision: D86501597

@meta-codesync
Copy link

meta-codesync bot commented Nov 11, 2025

@arushikesarwani94 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D86501597.

@meta-cla meta-cla 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 Nov 11, 2025
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 13, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 14, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 14, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 14, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 14, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 14, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
@arushikesarwani94 arushikesarwani94 force-pushed the export-D86501597 branch 2 times, most recently from 49c24d7 to 9cec0e4 Compare November 15, 2025 23:02
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 15, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 15, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
@arushikesarwani94 arushikesarwani94 force-pushed the export-D86501597 branch 2 times, most recently from a06e626 to e012f3f Compare November 18, 2025 10:11
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 18, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types in parser logic.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 18, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types in parser logic.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 18, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types in parser logic.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 18, 2025
Summary:
Pull Request resolved: facebook#54489

Previously, the parser was mapping to Array<any> when the element types of union were different. This caused compat checker to not recognize changes in unions of different types.

`StringLiteralUnionTypeAnnotation`  already had support for `types`, that can be expanded to all Union types so as to incorporate the Unions of different types in parser logic.
```
{
  type: 'StringLiteralUnionTypeAnnotation',
  types: [
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'light'
    },
    {
      type: 'StringLiteralTypeAnnotation'
      value: 'dark'
    },
  ],
}
```

NOTE: Generators behavior still remain unchanged hence don't allow unions of different types. Only RN Compat Checker consumes this.

The value of this is that the compat checker can now error when the union of different types changes.
Also for consistency added support for similar literal types for Number & Boolean i.e `NumberLiteralTypeAnnotation` & `BooleanLiteralTypeAnnotation`

Changelog: [Internal]

Differential Revision: D86501597
@arushikesarwani94 arushikesarwani94 force-pushed the export-D86501597 branch 2 times, most recently from c23be31 to 44ced73 Compare November 23, 2025 18:54
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 23, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Nov 25, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 1, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 2, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 2, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 2, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
@arushikesarwani94 arushikesarwani94 force-pushed the export-D86501597 branch 2 times, most recently from 688e51d to cfbdd4a Compare December 2, 2025 23:33
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 2, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 2, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
@arushikesarwani94 arushikesarwani94 force-pushed the export-D86501597 branch 2 times, most recently from cee3b22 to 0eb6c8b Compare December 3, 2025 00:19
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 3, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing StringLiteralUnionTypeAnnotation.

Changelog: [Internal]

Differential Revision: D86501597
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Dec 3, 2025
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing `StringLiteralUnionTypeAnnotation`.

Changelog: [Internal]

**NOTE:** In case this needs to be reverted for any breakage to OTA Compat Checker v2, consider disabling it with D88289605 instead of reverting this change.

Differential Revision: D86501597
…book#54489)

Summary:
Pull Request resolved: facebook#54489

Adding support for Unions in react-native-codegen & Compat Checker so that they can allow non-homogenous types and un-special casing `StringLiteralUnionTypeAnnotation`.

Changelog: [Internal]

**NOTE:** In case this needs to be reverted for any breakage to OTA Compat Checker v2, consider disabling it with D88289605 instead of reverting this change.

Reviewed By: RSNara

Differential Revision: D86501597
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @arushikesarwani94 in 95cc1e7

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

@react-native-bot react-native-bot added the Merged This PR has been merged. label Dec 5, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 5, 2025

This pull request has been merged in 95cc1e7.

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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants