Skip to content

Commit

Permalink
docs(adr): record decision to adopt Typed JavaScript
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Jul 24, 2023
1 parent ef29852 commit 11875a4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions doc/adr/0005-type-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 5. Type system

Date: 2023-07-23

## Status

Accepted

## Context

Farmhand is implemented with JavaScript. Given the size of the codebase, the dynamic nature of JavaScript creates some ambiguity and confusion during development. A type system helps to mitigate these challenges. The ideal type system solution would be a migration to TypeScript, but that is a significant undertaking that would take an outsize amount of effort to complete and get value from. A more approachable solution is to incorporate [Typed JavaScript](https://depth-first.com/articles/2021/11/03/typed-javascript/). Typed JavaScript can be adopted incrementally and does not introduce new syntaxes or tooling needs.

## Decision

Farmhand will transition to using Typed JavaScript. This transition will take a long time and may never be fully completed, but effort should be made to update preexisting code as it modified. Type violations will not be used to break builds until all type violations have been fixed.

## Consequences

- Code will be more clearly and completely documented
- Data type errors will be more obvious
- Improved support for automated refactoring for editors that support such features
- More verbose code
- Many features of TypeScript are unavailable in Typed JavaScript, such as proper enums and interface extension
- Errors will be shown during development in editors that support Typed JavaScript until the code has been updated to be type safe
- The transition may never be complete
- At will be much easier to transition to TypeScript if the transition to Typed JavaScript is ever completed

0 comments on commit 11875a4

Please sign in to comment.