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

[Typo]: There is a syntax mistake on react docs GetStarted/Installation/Using Typescript #6697

Closed
developeruzairsaleem opened this issue Mar 14, 2024 · 2 comments

Comments

@developeruzairsaleem
Copy link

Summary

Hey I found this typo on docs under GetStarted/Installation/using Typescript page under the "useReducer" section, the code includes ";" but it should be ","

Page

https://react.dev/learn/typescript

Details

Hey I found this typo on docs under GetStarted/Installation/using Typescript page under the "useReducer" section, the code includes ";" but it should be ","
The code is written as follows
type CounterAction =
| { type: "reset" }
| { type: "setCount"; value: State["count"] }

With ";" in object it should be a "," after the type:"setCount"
The updated code should look like this
type CounterAction =
| { type: "reset" }
| { type: "setCount", value: State["count"] }
Thanks.

@pwbriggs
Copy link

Hey there, @developeruzairsaleem! 👋

The line you're referring to is not an object, it is an object type. In TypeScript, ; or , can be used in object types, and many codebases opt to use a semicolon to help differentiate the object type from an actual object.

@developeruzairsaleem
Copy link
Author

Thanks By the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants