Hey devtools-dev,
Today two small TypeScript improvements have landed:
1. Return types of functions/method declarations in the `front_end/` are now required by ESLint. This change reflects the internal TypeScript style guide. We are working on enabling this rule for non-`front_end/` code as well.
2. We have added a new function called `assertNever` to Platform (
https://crrev.com/c/2589953). This function can be used to enforce exhaustive switch statements during compile time. In the default-clause of a switch statement (given that all values of an enum/union have been handled), TypeScript infers the switched-value to be of type `never`. As such, you can call `assertNever` with its value to ensure the type remains `never`. When you add new values to the enum/union and you forget to handle it in the switch branches, the compiler will throw an error. For additional examples, see
https://crrev.com/c/2589954
Let us know if you run into any issues.
Cheers,
LON