Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/460.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add return type to createInitialState
10 changes: 8 additions & 2 deletions src/components/bridge-info-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export interface MSC2346Content extends MappingInfo {
bridgebot: string;
}

export interface InitialEvent {
type: string,
content: Record<string, unknown>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just MSC2346Content?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes sorry, I should have explained that. First, because callers need to cast it to a record of unknown anyway: https://github.com/matrix-org/matrix-appservice-irc/blob/3158cc521140ca6883e157ddb0bf01e96d455af4/src/provisioning/Provisioner.ts#L582

and also because I am working on adding support for MSC3968 and MSC3969, which will need genericity in the record type

state_key: string,
}

interface Opts<BridgeMappingInfo> {
/**
* The name of the bridge implementation, ideally in Java package naming format:
Expand Down Expand Up @@ -110,11 +116,11 @@ export class BridgeInfoStateSyncer<BridgeMappingInfo> {
}
}

public async createInitialState(roomId: string, bridgeMappingInfo: BridgeMappingInfo) {
public async createInitialState(roomId: string, bridgeMappingInfo: BridgeMappingInfo): Promise<InitialEvent> {
const mapping = await this.opts.getMapping(roomId, bridgeMappingInfo);
return {
type: BridgeInfoStateSyncer.EventType,
content: this.createBridgeInfoContent(mapping),
content: this.createBridgeInfoContent(mapping) as unknown as Record<string, unknown>,
state_key: this.createStateKey(mapping),
};
}
Expand Down