Use widget with ! instead of ?

It cannot be `null` in the mentioned contexts as discussed with Robin.
This commit is contained in:
Daniel Abramov
2023-07-04 11:26:54 +01:00
parent 259ef27bd0
commit aaa9b7761c
2 changed files with 10 additions and 10 deletions

View File

@@ -204,11 +204,11 @@ export function InCallView({
if (widget) {
const onTileLayout = async (ev: CustomEvent<IWidgetApiRequest>) => {
setLayout("freedom");
await widget?.api.transport.reply(ev.detail, {});
await widget!.api.transport.reply(ev.detail, {});
};
const onSpotlightLayout = async (ev: CustomEvent<IWidgetApiRequest>) => {
setLayout("spotlight");
await widget?.api.transport.reply(ev.detail, {});
await widget!.api.transport.reply(ev.detail, {});
};
widget.lazyActions.on(ElementWidgetActions.TileLayout, onTileLayout);
@@ -218,8 +218,8 @@ export function InCallView({
);
return () => {
widget?.lazyActions.off(ElementWidgetActions.TileLayout, onTileLayout);
widget?.lazyActions.off(
widget!.lazyActions.off(ElementWidgetActions.TileLayout, onTileLayout);
widget!.lazyActions.off(
ElementWidgetActions.SpotlightLayout,
onSpotlightLayout
);