For info, you can use `goog.asserts.assertInstanceOf` here to avoid the typecast.