Skip to content

Commit

Permalink
Fixing types for StreamChat constructor
Browse files Browse the repository at this point in the history
Fixes #250
  • Loading branch information
vishalnarkhede committed Mar 27, 2020
1 parent a0c2ef0 commit 583b528
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion types/stream-chat/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ export interface StreamChatOptions {
export type EventHandler = (event: Event) => void;

export class StreamChat {
constructor(key: string, secretOrOptions?: string, options?: StreamChatOptions);
constructor(key: string, options?: StreamChatOptions);
constructor(key: string, secret?: string, options?: StreamChatOptions);

key: string;
userToken?: string;
Expand Down
5 changes: 5 additions & 0 deletions types/stream-chat/test-stream-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ const client = new StreamChat(apiKey, null, {
logger: (logLevel: string, msg: string, extraData: {}) => {},
});

const clientWithoutSecret = new StreamChat(apiKey, {
timeout: 3000,
logger: (logLevel: string, msg: string, extraData: {}) => {},
});

const devToken = client.devToken('joshua'); // $ExpectType string
client.createToken('james', 3600); // $ExpectType string
client.getAuthType(); // $ExpectType string
Expand Down

0 comments on commit 583b528

Please sign in to comment.