Adding strong checks on messages exchanged using generic-type-guard
This commit is contained in:
parent
83fa23a82d
commit
5178dff108
5 changed files with 39 additions and 14 deletions
7
front/src/Api/Events/IframeEvent.ts
Normal file
7
front/src/Api/Events/IframeEvent.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
interface IframeEvent {
|
||||
type: string;
|
||||
data: unknown;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const isIframeEventWrapper = (event: any): event is IframeEvent => typeof event.type === 'string' && typeof event.data === 'object';
|
Loading…
Add table
Add a link
Reference in a new issue