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 Map / indexed object support for TypeScript parser #35098

Closed

Conversation

christophpurrer
Copy link
Contributor

Summary:
Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};

In TypeScript writing the same spec:

readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };

leads to an exception the TypeScript code-gen parser

    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```

This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

@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 fb-exported labels Oct 27, 2022
@facebook-github-bot
Copy link
Contributor

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

1 similar comment
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 27, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Differential Revision: D40753368

fbshipit-source-id: c8ad66eb9a16cb55eee2f228e0485e1315eb443e
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 27, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Differential Revision: D40753368

fbshipit-source-id: 3787232ad8eb85c8f1a0068e120e9d4be06a9d0f
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 28, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: bcddc571ab424becb96bb0c20486d6b6f438183c
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 28, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 682621a230710fb1f241d06fb75724a7c2eccad5
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 28, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 71d1151d5fdcdd0ba443f82bba24f2c4e833d337
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 28, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 22b7df8600144fa100d08c94096dc4fb16191cfb
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 28, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 9d0b76cebbcf8dea170b6bfce7174564a69548a6
@facebook-github-bot
Copy link
Contributor

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

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Oct 28, 2022
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 66b2d55607a7520c798a2e709a1a9f1333188ebd
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: cc99f91485bc6ec77a07599f8a43a909a50f85b2
@facebook-github-bot
Copy link
Contributor

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

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by Christoph Purrer in 87c356d.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 30, 2022
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Pull Request resolved: facebook#35098

Changelog:
[General][Fixed] [react-native-codegen] react-native-codegen : Add Map / indexed object support for TypeScript parser

In flow we can expose Maps via the following syntax in TM specs

`
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
`

In TypeScript writing the same spec:

`
readonly getMap: (arg: { [key: string]: number | null; }) => { [key: string]: number | null; };
`

leads to an exception the TypeScript code-gen parser

```UnsupportedObjectPropertyTypeAnnotationParserError: Module NativeTurboModuleCxx: 'ObjectTypeAnnotation' cannot contain 'TSIndexSignature'.
    at react-native-github/packages/react-native-codegen/src/parsers/typescript/modules/index.js:309:23```
```
This change fixes the TypeScript parser

Reviewed By: cipolleschi

Differential Revision: D40753368

fbshipit-source-id: 0eef8ecb63d1ed049fde1e75cc6f2ec627f1f232
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.

3 participants