Skip to content

RocketChatClient's constructor options are untyped, so unrecognized keys still pass silently #345

Description

@diegolmello

What happens

RocketChatClient is the entry point every consumer builds. Its constructor in lib/clients/Rocketchat.ts is:

constructor ({ logger = Logger, ...config }: any) {
  super({ ...config, logger })
  this.ddp = new Driver({ ...config, logger })
}

The options bag is any, and it spreads into both Api and Driver. #340 gave Api's constructor a named IApiOptions, but the any above erases it before it can reject anything: a misspelled or unsupported key typechecks at the only call site anyone actually uses, and the mistake shows up as missing behaviour at runtime.

This is the hazard CLAUDE.md names — config spreads into the REST base, Driver and Socket, and only Socket re-picks the keys it knows, so an unrecognized option silently reaches the driver.

What to do

Give the constructor a named options type covering the keys it and its two collaborators actually read, and use it in place of any.

Unlike #340, this one is expected to surface real call-site breakage — in the SDK and in the consuming app, which constructs RocketChatClient directly. That is the point of the change, and the reason it wants its own PR.

Follow-up to #340.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageMaintainer needs to evaluate this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions