databag icon indicating copy to clipboard operation
databag copied to clipboard

Move to Typescript

Open lil5 opened this issue 1 year ago • 11 comments

I'd like to use this project in a different project, I'd need to build an sdk based off the app/mobile/src/api files. Even then I'd be coding in the dark without types. A good first step would be to move to Typescript.

lil5 avatar Apr 22 '24 05:04 lil5

yes, I have some regret not starting off with typescript and have been postponing the refactor effort. I've added it to my backlog list for tracking, but I have a few features I've committed to first.

balzack avatar Apr 22 '24 05:04 balzack

If it's alright with you I'd like to move to strict = false first, this makes most JavaScript okay for TypeScript. It allows for untyped code and missing types.

That way the types can follow organically.

I'd like to help out with this change.

Are your unmerged branches very different from main?

lil5 avatar Apr 22 '24 21:04 lil5

I currently only have two relevant branches: fdroid: the release branch for fdroid. almost identical to main, but with firebase removed since it's not opensource. webrtc: very old and has a stalled effort of embedding a stun/turn server

I appreciate any help with the migration towards typescript. thank you.

balzack avatar Apr 22 '24 23:04 balzack

rnr -rf '(.*)\.jsx$' '$1.tsx' ./src ./test

rnr has been a huge help

lil5 avatar Apr 23 '24 22:04 lil5

  1. You've made it impossible to separate the frontend from the backend an /api prefix would have been great. This would allow for a Vite dev server + live reload and a reverse proxy to the backend.

Thus I'm unable to debug what is going wrong, currently running the frontend requires debugging minimized code.

  1. The absolute paths are a nightmare to work with in typescript/babel/jest/vite at the least use a ~

This where my participation ends, I hope I've given you some helpful advice

lil5 avatar May 12 '24 10:05 lil5

Yes, I understand. For my reference can you point me to an example of your point 2 and what you would have expected to see instead. Thanks for your advice.

balzack avatar May 12 '24 14:05 balzack

Instead of using absolute imports like "components/card.tsx" use "src/components/card.tsx" or "~/src/components/card.tsx" simpler still "./../card.tsx"

I attempted to add each dir in src as a base in my configs but it just becomes a buggy mess.

lil5 avatar May 13 '24 22:05 lil5

Okay I see what you mean. I appreciate all of your advice and will incorporate it as I go forward.

balzack avatar May 14 '24 05:05 balzack