This PR adds the ability to initialize the value of the state property in the Session and Channel constructor options objects.
While enabling the user to construct and set the session/channel state in a single statement, this also allows the TypeScript compiler to automatically infer the state type from the given state value, rather than it having to explicitly defined by passing a type/interface to the State generic.
This PR adds the ability to initialize the value of the
state
property in theSession
andChannel
constructoroptions
objects.While enabling the user to construct and set the session/channel state in a single statement, this also allows the TypeScript compiler to automatically infer the state type from the given state value, rather than it having to explicitly defined by passing a type/interface to the
State
generic.Before:
After: