Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit911f928

Browse files
authored
docs: fix incorrect union type explanation- Corrected A | B explanati… (#793)
* docs: fix incorrect union type explanation- Corrected A | B explanation from 'both at once' to 'either A or B'- Added clarification about intersection types (A & B) - Updated docs/basic/troubleshooting/types.mdFixes#787* chore: regenerate README.md from docs* fix: use fresh yarn.lock from main branch
1 parent25d30ac commit911f928

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,7 @@ class App extends React.Component<
20382038

20392039
[View in the TypeScript Playground](https://www.typescriptlang.org/play/?jsx=2#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wFgAoCtAGxQGc64BBMMOJADxiQDsATRsnQwAdAGFckHrxgAeCnDgBvAL4AaBcs2K0EAK48YALjg89IAEZIocAD6m91agG44AejdxqwANZI4MAAWwHSaKhQAfFrkinQwKNxwALzRijr6hiZmTmHOmkT81gAUAJSpaUQwelA8cLJ8wABucBA8Yt5oPklKpclRQSEiwDxoRCAyRQCMJSoRSgN0InEJSCK6BjAqsm4NjRF5MXDhh8OjSOOGyXBFKCDGDpbWZUlRStoBwYt0SDAAyvHcIrLRIva5vQ5pODrTLXYGraHwWz2AAMZQA1HBbjB3ioSiUDooVAcVEA)
20402040

2041-
**Type Guarding**: Sometimes Union Types solve a problem in one area but create another downstream. If`A` and`B` are both object types,`A | B`isn't "either A or B", it is "A or B or both at once", which causes some confusion ifyouexpected ittobe theformer. Learn how to write checks, guards, and assertions (also see the Conditional Rendering section below). For example:
2041+
**Type Guarding**: Sometimes Union Types solve a problem in one area but create another downstream. If`A` and`B` are both object types,`A | B`means "either A or B" (not both at once - that would be an intersection type`A & B`). TypeScript will only let you access properties that exist on both types unlessyouuse type guardstonarrow thetype. Learn how to write checks, guards, and assertions (also see the Conditional Rendering section below). For example:
20422042

20432043
```ts
20442044
interfaceAdmin {

‎docs/basic/troubleshooting/types.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class App extends React.Component<
3737

3838
[View in the TypeScript Playground](https://www.typescriptlang.org/play/?jsx=2#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wFgAoCtAGxQGc64BBMMOJADxiQDsATRsnQwAdAGFckHrxgAeCnDgBvAL4AaBcs2K0EAK48YALjg89IAEZIocAD6m91agG44AejdxqwANZI4MAAWwHSaKhQAfFrkinQwKNxwALzRijr6hiZmTmHOmkT81gAUAJSpaUQwelA8cLJ8wABucBA8Yt5oPklKpclRQSEiwDxoRCAyRQCMJSoRSgN0InEJSCK6BjAqsm4NjRF5MXDhh8OjSOOGyXBFKCDGDpbWZUlRStoBwYt0SDAAyvHcIrLRIva5vQ5pODrTLXYGraHwWz2AAMZQA1HBbjB3ioSiUDooVAcVEA)
3939

40-
**Type Guarding**: Sometimes Union Types solve a problem in one area but create another downstream. If`A` and`B` are both object types,`A | B`isn't "either A or B", it is "A or B or both at once", which causes some confusion ifyouexpected ittobe theformer. Learn how to write checks, guards, and assertions (also see the Conditional Rendering section below). For example:
40+
**Type Guarding**: Sometimes Union Types solve a problem in one area but create another downstream. If`A` and`B` are both object types,`A | B`means "either A or B" (not both at once - that would be an intersection type`A & B`). TypeScript will only let you access properties that exist on both types unlessyouuse type guardstonarrow thetype. Learn how to write checks, guards, and assertions (also see the Conditional Rendering section below). For example:
4141

4242
```ts
4343
interfaceAdmin {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp