Skip to content

JetBrains: Increase type-safety of JS -> Java bridge

Warren Gifford requested to merge ps/jetbrains-type-safety into main

Created by: philipp-spiess

I saw some unsafe typings and wanted to fix it. Going forward we should probably also encode the expected return type to avoid casting it.

This PR:

  • Changes the Action type to be an enum instead of a loosely typed object.
  • Changes the mock to use an exhaustive switch so that we get a type error when we add a new action that is not implemented (as opposed to a runtime error)

Test plan

  • TS build works
  • Here's an example of the exhaustive switch statement failing: exhaustive test

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading