Ende.BrowserWindowSerializable
type alias · desktop apps only
type Ende.BrowserWindowSerializable<T> = unknown extends T ? T : T extends BrowserWindowLeaf ? T : T extends (...args: any[]) => any ? never : T extends readonly (infer U)[] ? readonly BrowserWindowSerializable<U>[] : T extends object ? { [K in keyof T]: BrowserWindowSerializable<T[K]> } : neverMaps T to itself if every value it can hold survives the trip across
the webview boundary, and to never at the first member that does not.
T is serializable when [T] extends [BrowserWindowSerializable<T>].
This is a structural walk rather than a plain union because TypeScript
never gives an interface an implicit index signature: a union arm of
{ [key: string]: unknown } would reject every user-declared interface,
including Ende.FileInfo. Recursing through properties instead accepts
interfaces, and rejects the values that silently serialize to {} —
Date, Map, Set, class instances with methods, and functions.
unknown extends T holds only for unknown and any. Both are let
through: nothing can be proven about them, and rejecting them would
break Record<string, unknown> payloads.
undefined (and optional) properties are dropped during serialization,
and a handler that returns nothing resolves as null in the webview.