From 90ccf48129fb5771b4d2eaf2e0af1a1966d8e112 Mon Sep 17 00:00:00 2001 From: Talha Abid Date: Mon, 26 Jul 2021 18:14:25 -0400 Subject: [PATCH 1/3] add a typed functional react component for tsx files --- typescript-tsx-mode/.yas-parents | 3 +++ typescript-tsx-mode/componentTSX | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 typescript-tsx-mode/componentTSX diff --git a/typescript-tsx-mode/.yas-parents b/typescript-tsx-mode/.yas-parents index a540072f..cd4130c3 100644 --- a/typescript-tsx-mode/.yas-parents +++ b/typescript-tsx-mode/.yas-parents @@ -1 +1,4 @@ ++web-react-mode typescript-mode +rjsx-mode + diff --git a/typescript-tsx-mode/componentTSX b/typescript-tsx-mode/componentTSX new file mode 100644 index 00000000..05edb944 --- /dev/null +++ b/typescript-tsx-mode/componentTSX @@ -0,0 +1,16 @@ +# -*- mode: snippet -*- +# contributor: Talha Abid +# name: componentTSX +# key: componentTSX +# -- +import React from 'react'; + +interface ${1:`(f-base buffer-file-name)`}PropTypes { + +} + +const $1 = (props: $1PropTypes) => ( + $0 +); + +export { $1 }; \ No newline at end of file From f1f06b3abb36cfe5dafeb2a55a0e1e9c21f1e474 Mon Sep 17 00:00:00 2001 From: Talha Abid <15316071+TalhaAbid@users.noreply.github.com> Date: Mon, 26 Jul 2021 21:18:09 -0400 Subject: [PATCH 2/3] Changed to file-name-base and shorter key --- typescript-tsx-mode/componentTSX | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typescript-tsx-mode/componentTSX b/typescript-tsx-mode/componentTSX index 05edb944..8169c296 100644 --- a/typescript-tsx-mode/componentTSX +++ b/typescript-tsx-mode/componentTSX @@ -1,11 +1,11 @@ # -*- mode: snippet -*- # contributor: Talha Abid -# name: componentTSX -# key: componentTSX +# name: functionalComponentTSX +# key: fct # -- import React from 'react'; -interface ${1:`(f-base buffer-file-name)`}PropTypes { +interface ${1:`(file-name-base buffer-file-name)`}PropTypes { } @@ -13,4 +13,4 @@ const $1 = (props: $1PropTypes) => ( $0 ); -export { $1 }; \ No newline at end of file +export { $1 }; From 1fec2f94b557292613ed2b4c22527ac1d685afc2 Mon Sep 17 00:00:00 2001 From: Talha Abid <15316071+TalhaAbid@users.noreply.github.com> Date: Sat, 25 Dec 2021 12:23:58 -0500 Subject: [PATCH 3/3] Update componentTSX --- typescript-tsx-mode/componentTSX | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/typescript-tsx-mode/componentTSX b/typescript-tsx-mode/componentTSX index 8169c296..c00b8c16 100644 --- a/typescript-tsx-mode/componentTSX +++ b/typescript-tsx-mode/componentTSX @@ -6,11 +6,10 @@ import React from 'react'; interface ${1:`(file-name-base buffer-file-name)`}PropTypes { - } -const $1 = (props: $1PropTypes) => ( +const $1 = ({}: $1PropTypes) => ( $0 ); -export { $1 }; +export default { $1 };