Skip to content

Commit 7634598

Browse files
committed
feat(react-ts): improve default types
1 parent 9d54a2a commit 7634598

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to the "vscode-js-ts-react-nextjs-snippets" extension will b
55
## 1.11.0 <small>- 2022/09/06</small>
66

77
- Added Redux snippet (`rxDispatch`, `rxStore`, `rxSlice`)
8+
- Improved React TS snippets
89

910
## 1.10.0 <small>- 2022/07/19</small>
1011

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "JS/TS React/Next.js Snippets",
44
"description": "Snippets for JS/TS, React/Next.js, React Query, SWR, Jest, React Hook Form, & many more",
55
"icon": "images/logo.png",
6-
"version": "1.10.0",
6+
"version": "1.11.0",
77
"publisher": "afifu",
88
"keywords": [
99
"vscode",

snippets/typescript.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
"prefix": "rFC.TS.$$rFC.(type)",
343343
"body": [
344344
"type Props = {",
345-
"\t$2: unknown;",
345+
"\t$2: ReactNode;",
346346
"}",
347347
"",
348348
"export default function ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}}({ ${2:children} }: Props) {$0",
@@ -359,7 +359,7 @@
359359
"prefix": "rFCe.TS.$$rFCe.(type)",
360360
"body": [
361361
"type Props = {",
362-
"\t$2: unknown;",
362+
"\t$2: ReactNode;",
363363
"}",
364364
"",
365365
"function ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}}({ ${2:children} }: Props) {$0",
@@ -378,7 +378,7 @@
378378
"prefix": "rAFC.TS.$$rAFC.(type)",
379379
"body": [
380380
"type Props = {",
381-
"\t$2: unknown;",
381+
"\t$2: ReactNode;",
382382
"}",
383383
"",
384384
"export const ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}} = ({ ${2:children} }: Props) => {$0",
@@ -395,7 +395,7 @@
395395
"prefix": "rAFCe.TS.$$rAFCe.(type)",
396396
"body": [
397397
"type Props = {",
398-
"\t$2: unknown;",
398+
"\t$2: ReactNode;",
399399
"}",
400400
"",
401401
"const ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}} = ({ ${2:children} }: Props) => {$0",
@@ -414,7 +414,7 @@
414414
"prefix": "rFC.TS.$$rFC.(interface)",
415415
"body": [
416416
"interface Props {",
417-
"\t$2: unknown;",
417+
"\t$2: ReactNode;",
418418
"}",
419419
"",
420420
"export default function ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}}({ ${2:children} }: Props) {$0",
@@ -431,7 +431,7 @@
431431
"prefix": "rFCe.TS.$$rFCe.(interface)",
432432
"body": [
433433
"interface Props {",
434-
"\t$2: unknown;",
434+
"\t$2: ReactNode;",
435435
"}",
436436
"",
437437
"function ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}}({ ${2:children} }: Props) {$0",
@@ -450,7 +450,7 @@
450450
"prefix": "rAFC.TS.$$rAFC.(interface)",
451451
"body": [
452452
"interface Props {",
453-
"\t$2: unknown;",
453+
"\t$2: ReactNode;",
454454
"}",
455455
"",
456456
"export const ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}} = ({ ${2:children} }: Props) => {$0",
@@ -467,7 +467,7 @@
467467
"prefix": "rAFCe.TS.$$rAFCe.(interface)",
468468
"body": [
469469
"interface Props {",
470-
"\t$2: unknown;",
470+
"\t$2: ReactNode;",
471471
"}",
472472
"",
473473
"const ${1:${RELATIVE_FILEPATH/(^.+?(?=[\\/\\\\][^\\/\\\\]+[\\/\\\\][^\\/\\\\]+\\.[jt]sx?))|(\\.[jt]sx?$|[\\/\\\\](?:index|\\[).*|.+[\\/\\\\](?!(?:index|\\[))|[.\\-_\\/\\\\])|(\\w+)/${3:/capitalize}/g}} = ({ ${2:children} }: Props) => {$0",

src/snippets/react-ts.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const tsReactFnComp: Snippet = {
55
prefix: ['rFC', '(type)'],
66
body: [
77
'type Props = {',
8-
'\t$2: unknown;',
8+
'\t$2: ReactNode;',
99
'}',
1010
'',
1111
`export default function \${1:${FILENAME_PASCALCASE}}({ \${2:children} }: Props) {$0`,
@@ -21,7 +21,7 @@ export const tsReactFnCompExport: Snippet = {
2121
prefix: ['rFCe', '(type)'],
2222
body: [
2323
'type Props = {',
24-
'\t$2: unknown;',
24+
'\t$2: ReactNode;',
2525
'}',
2626
'',
2727
`function \${1:${FILENAME_PASCALCASE}}({ \${2:children} }: Props) {$0`,
@@ -39,7 +39,7 @@ export const tsReactArrowFnComp: Snippet = {
3939
prefix: ['rAFC', '(type)'],
4040
body: [
4141
'type Props = {',
42-
'\t$2: unknown;',
42+
'\t$2: ReactNode;',
4343
'}',
4444
'',
4545
`export const \${1:${FILENAME_PASCALCASE}} = ({ \${2:children} }: Props) => {$0`,
@@ -55,7 +55,7 @@ export const tsReactArrowFnCompExport: Snippet = {
5555
prefix: ['rAFCe', '(type)'],
5656
body: [
5757
'type Props = {',
58-
'\t$2: unknown;',
58+
'\t$2: ReactNode;',
5959
'}',
6060
'',
6161
`const \${1:${FILENAME_PASCALCASE}} = ({ \${2:children} }: Props) => {$0`,
@@ -73,7 +73,7 @@ export const tsReactFnCompV2: Snippet = {
7373
prefix: ['rFC', '(interface)'],
7474
body: [
7575
'interface Props {',
76-
'\t$2: unknown;',
76+
'\t$2: ReactNode;',
7777
'}',
7878
'',
7979
`export default function \${1:${FILENAME_PASCALCASE}}({ \${2:children} }: Props) {$0`,
@@ -89,7 +89,7 @@ export const tsReactFnCompExportV2: Snippet = {
8989
prefix: ['rFCe', '(interface)'],
9090
body: [
9191
'interface Props {',
92-
'\t$2: unknown;',
92+
'\t$2: ReactNode;',
9393
'}',
9494
'',
9595
`function \${1:${FILENAME_PASCALCASE}}({ \${2:children} }: Props) {$0`,
@@ -107,7 +107,7 @@ export const tsReactArrowFnCompV2: Snippet = {
107107
prefix: ['rAFC', '(interface)'],
108108
body: [
109109
'interface Props {',
110-
'\t$2: unknown;',
110+
'\t$2: ReactNode;',
111111
'}',
112112
'',
113113
`export const \${1:${FILENAME_PASCALCASE}} = ({ \${2:children} }: Props) => {$0`,
@@ -123,7 +123,7 @@ export const tsReactArrowFnCompExportV2: Snippet = {
123123
prefix: ['rAFCe', '(interface)'],
124124
body: [
125125
'interface Props {',
126-
'\t$2: unknown;',
126+
'\t$2: ReactNode;',
127127
'}',
128128
'',
129129
`const \${1:${FILENAME_PASCALCASE}} = ({ \${2:children} }: Props) => {$0`,

0 commit comments

Comments
 (0)