Skip to content

Commit 62937f5

Browse files
authored
🤖 Merge PR DefinitelyTyped#73971 feat(rails__actioncable): Add Consumer.addSubProtocol method by @shunichi
1 parent 1155b6a commit 62937f5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

‎types/rails__actioncable/index.d.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ export const adapters: {
1818
*/
1919
export class Consumer {
2020
readonly subscriptions: Subscriptions;
21+
readonly subprotocols: string[];
2122

2223
constructor(url: string);
2324
get url(): string;
2425
connect(): boolean;
2526
disconnect(): void;
27+
addSubProtocol(protocol: string): void;
2628
}
2729

2830
export interface BaseMixin {

‎types/rails__actioncable/rails__actioncable-tests.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ const consumer = createConsumer("url"); // $ExpectType Consumer
99
createConsumer(() => "url"); // $ExpectType Consumer
1010

1111
consumer.url; // $ExpectType string
12+
consumer.subprotocols; // $ExpectType string[]
1213

1314
consumer.connect(); // $ExpectType boolean
1415
consumer.disconnect(); // $ExpectType void
16+
consumer.addSubProtocol("custom-protocol"); // $ExpectType void
1517

1618
{
1719
const subscription = consumer.subscriptions.create(

0 commit comments

Comments
 (0)