Skip to content

Commit e83a86c

Browse files
committed
Update consolidated snippets
1 parent c7788d0 commit e83a86c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

public/consolidated/typescript.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,23 @@
1515
"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
]
18+
},
19+
{
20+
"name": "React Helpers",
21+
"snippets": [
22+
{
23+
"title": "Functional Component",
24+
"description": "Functional component for React JS with props.",
25+
"author": "gihanrangana",
26+
"tags": [
27+
"typescript",
28+
"fuctional-component",
29+
"react-props",
30+
"reactjs"
31+
],
32+
"contributors": [],
33+
"code": "import React from 'react';\n\ninterface ComponentNameProps {\n // Define specific props here\n}\n\nconst ComponentName: React.FC<ComponentNameProps> = (props) => {\n return (\n <div>\n {/* Add component content here */}\n </div>\n );\n};\n\nexport default ComponentName;\n"
34+
}
35+
]
1836
}
1937
]

0 commit comments

Comments
 (0)