Using Typescript on Client #145
Closed
pavish
announced in
Maintainer discussions
Replies: 1 comment
-
@pavish I realized I never responded to this discussion. I'm fine with using TypeScript. Can you add this decision to the engineering decisions wiki page? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
Currently we use Svelte with Javascript for the UI. I was thinking it would make more sense to use Svelte with Typescript for the following reasons:
new Error({ code: '503', detail: 'service unavailable' })
. While JS treats this as completely valid code, and during runtime will printnew error: [Object object]
, TS will show an error during compilation time.The major reason to use TS is that we will be accepting contributions from the community.
Using JS would mean that during review, we need to be extra careful with types, especially in cases where variables may belong to multiple types or be null or undefined, leading to subtle bugs which we won't be able to catch early on.
As the code base becomes larger with more contributors, this will become extremely hard to maintain. Using TS, will save us from that trouble.
Drawbacks:
What is done
I have ported the existing code to TS in my current working branch: readonly_table
Since we are in the early stages, the changes specific to the port are minimal. The existing code structure is the same, we just add type definitions to variables and methods.
Some discussions/articles:
Beta Was this translation helpful? Give feedback.
All reactions