Skip to content

Comments

Add ts hooks support#89

Merged
gragland merged 3 commits intouidotdev:masterfrom
bozheville:add-ts-hooks-support
Aug 10, 2020
Merged

Add ts hooks support#89
gragland merged 3 commits intouidotdev:masterfrom
bozheville:add-ts-hooks-support

Conversation

@bozheville
Copy link
Contributor

Hey @gragland,

Here's my proposal for adding TypeScript support.

This is an entirely soft change, that adds a button "View in TypeScript/JavaScript" for hooks with definned tsCode field.

image

if you accept this approach, I will start updating hooks. There is one sample hook for now - useAsync

@gragland
Copy link
Contributor

gragland commented Aug 8, 2020

Awesome! Love this and happy to merge. My only nitpick would be to keep the TS version as similar as possible (hook usage at the top, same order of imports, etc) so it's easier to see what's changing when toggling between.

@bozheville bozheville force-pushed the add-ts-hooks-support branch from eb77fbe to 0f62a80 Compare August 9, 2020 03:04
@bozheville
Copy link
Contributor Author

Completely agree. I updated my last commit

@gragland gragland merged commit e6deb8d into uidotdev:master Aug 10, 2020
@gragland
Copy link
Contributor

Thanks! This is now live. Looking forward to seeing more :)

@trblackw
Copy link

@bozheville Can you share with me your strategy to converting your TS versions to markdown? Are you just using an external markdown editor/converter? Trying to figure out the best approach.

@gragland
Copy link
Contributor

gragland commented Aug 13, 2020

@trblackw Right now the code is escaped and then stored in the markdown frontmatter (not ideal and something I'd like to fix). So generally you'd just want to grab the non-TS code version, unescape it (here's an online tool), work on it in your own editor, then escape it before pasting it back in under the frontmatter tsCode key. That's my process, although maybe @bozheville has a better answer.

@bozheville
Copy link
Contributor Author

@trblackw, I use an awful primitive and long manual way. I paste code into an empty file in VSCode and replace \n with \\r\\n. I decided that looking for a better way will take more time than converting everything this way

@bozheville bozheville deleted the add-ts-hooks-support branch August 15, 2020 02:22
benadam11 pushed a commit that referenced this pull request May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants