Skip to content

Commit 7eaa39f

Browse files
committed
# is now //
1 parent c5848bf commit 7eaa39f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

public/consolidated/typescript.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"typedefinition"
1313
],
1414
"contributors": [],
15-
"code": "type Exclusive<T, U = T> = T | U extends Record<string, unknown>\n ?\n | ({ [P in Exclude<keyof T, keyof U>]?: never } & U)\n | ({ [P in Exclude<keyof U, keyof T>]?: never } & T)\n : T | U;\n\n\n# Usage:\ntype A = { name: string; email?: string; provider?: string };\ntype B = { name: string; phone?: string; country?: string };\n\ntype EitherOr = Exclusive<A, B>;\n\nconst w: EitherOr = { name: \"John\", email: \"j@d.c\" }; // ✅\nconst x: EitherOr = { name: \"John\", phone: \"+123 456\" }; // ✅\nconst y: EitherOr = { name: \"John\", email: \"\", phone: \"\" }; // ⛔️\nconst z: EitherOr = { name: \"John\", phne: \"\", provider: \"\" }; // ⛔️\n"
15+
"code": "type Exclusive<T, U = T> = T | U extends Record<string, unknown>\n ?\n | ({ [P in Exclude<keyof T, keyof U>]?: never } & U)\n | ({ [P in Exclude<keyof U, keyof T>]?: never } & T)\n : T | U;\n\n\n// Usage:\ntype A = { name: string; email?: string; provider?: string };\ntype B = { name: string; phone?: string; country?: string };\n\ntype EitherOr = Exclusive<A, B>;\n\nconst w: EitherOr = { name: \"John\", email: \"j@d.c\" }; // ✅\nconst x: EitherOr = { name: \"John\", phone: \"+123 456\" }; // ✅\nconst y: EitherOr = { name: \"John\", email: \"\", phone: \"\" }; // ⛔️\nconst z: EitherOr = { name: \"John\", phne: \"\", provider: \"\" }; // ⛔️\n"
1616
}
1717
]
1818
}

snippets/typescript/helper-types/exclusive-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Exclusive<T, U = T> = T | U extends Record<string, unknown>
1313
: T | U;
1414

1515

16-
# Usage:
16+
// Usage:
1717
type A = { name: string; email?: string; provider?: string };
1818
type B = { name: string; phone?: string; country?: string };
1919

0 commit comments

Comments
 (0)