Skip to content

Function parameter disrepancies between CryptoStore and some subclasses #2113

@ShadowJonathan

Description

@ShadowJonathan
export interface ISessionInfo {
    deviceKey?: string;
    sessionId?: string;
    session?: string;
    lastReceivedMessageTs?: number;
}

interface CryptoStore {
    getEndToEndSession(
        deviceKey: string,
        sessionId: string,
        txn: unknown,
        func: (session: ISessionInfo) => void,
    ): void;
}
class Backend implements CryptoStore {
    public getEndToEndSession(
        deviceKey: string,
        sessionId: string,
        txn: IDBTransaction,
        func: (sessions: { [ sessionId: string ]: ISessionInfo }) => void,
    ): void {}
}
class IndexedDBCryptoStore implements CryptoStore {
    public getEndToEndSession(
        deviceKey: string,
        sessionId: string,
        txn: IDBTransaction,
        func: (sessions: { [ sessionId: string ]: ISessionInfo }) => void,
    ): void {}
}

This is allowed, because ISessionInfo (as an interface) only "comments" on the properties of corresponding types, so ISessionInfo, only having optional properties, could apply over any type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions