hiyaryan / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling distorted thinking and finding alternative modes of thought (i.e. reframing) while cognitive distortions are occurring. The CDJ does that work for you. -- The CDJ is in beta testing!!
https://thecdj.app
3 stars 0 forks source link

Migrate backend from JavaScript to TypeScript and TDD. #154

Open hiyaryan opened 2 months ago

hiyaryan commented 2 months ago

This PR is for the backend migration from JavaScript to TypeScript.

Initial commit

With these changes, the backend can now transpile TypeScript code to JavaScript.

TypeScript migration strategy

With strict mode on, types may not be inferred. Therefore, it is best to work incrementally.

The following is a strategy that can be used for the migration.

  1. Rename a file from .js to .ts
  2. Write unit tests for file.
  3. Make unit tests pass by resolving any errors, TS or newly discovered.
  4. Perform manual end-to-end testing.
  5. Commit and repeat.

This PR closes #139

hiyaryan commented 2 months ago

Stricter settings have been turned on in tsconfig. This includes,

See Moving to TypeScript Files for rationale.

hiyaryan commented 4 weeks ago

Note on CodeFactor issues. We can resolve any remaining at the end of this PR when we're ready to merge into main, or in our sub-PRs if we come across them.