8. Use TypeScript for static type checking#

8.1. Status#

Accepted

8.2. Context#

As documented in OEP-0011-0004, the Open edX community has previously decided against adopting TypeScript. In the time since that decision was made, TypeScript has grown to be quite popular and commonplace for JavaScript developers. This has led to more discussion within the community about the pros and cons of adopting TypeScript.

8.3. Decision#

Considering the benefits of TypeScript, such as the ability to ensure proper API usage through type definitions and to catch bugs at build time, the Open edX community has decided to incorporate TypeScript into frontend repositories.

Frontend repositories within the Open edX project will be updated to support the use of TypeScript, without requiring existing frontend JavaScript code to be rewritten in TypeScript.

8.4. Consequence#

TypeScript will be utilized in portions of frontend repositories where it can provide the most value.

8.5. Rejected Alternatives#

  1. Continue without TypeScript

    It is possible to use other tools to add some of the functionality TypeScript provides to JavaScript code. However, considering the main point of opposition to TypeScript adoption was keeping a low barrier of entry for frontend developers, this could be counterproductive.

  2. Rewrite Open edX JavaScript in TypeScript

    It would be possible to convert all JavaScript throughout the Open edX project (or any given repository within the project) to TypeScript. It is not clear what the benefit of doing so would be.