diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b4bf3..de8e687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +* Fixed default state type when creating sessions and channels with `createSession` and `createChannel` being set to `unknown` instead of `DefaultSessionState` and `DefaultChannelState`, respectively. + ## 0.13.0 - 2024-08-23 ### Added diff --git a/src/createChannel.ts b/src/createChannel.ts index 5918557..130c711 100644 --- a/src/createChannel.ts +++ b/src/createChannel.ts @@ -1,6 +1,10 @@ -import {Channel} from "./Channel"; +import {Channel, DefaultChannelState} from "./Channel"; +import {DefaultSessionState} from "./Session"; -const createChannel = ( +const createChannel = < + State = DefaultChannelState, + SessionState = DefaultSessionState, +>( ...args: ConstructorParameters> ): Channel => new Channel(...args); diff --git a/src/createSession.ts b/src/createSession.ts index 85018e0..9f6c26a 100644 --- a/src/createSession.ts +++ b/src/createSession.ts @@ -1,9 +1,9 @@ -import {Session} from "./Session"; +import {Session, DefaultSessionState} from "./Session"; /** * Create a new session and return the session instance once it has connected. */ -const createSession = ( +const createSession = ( ...args: ConstructorParameters> ): Promise> => new Promise((resolve) => {