Skip to content

Type definition for configuration breaks documentation examples #56

@rvictorino

Description

@rvictorino

Hi,

thank you for this awesome work !

We started to use this node lib in our team and it works really well. However, in v5.2.1, it looks like type definition for type Configuration expects way too much properties in regard to the given documentation example.

For instance, with OAuth client credentials, it looks like expected properties for the configuration argument of the PubSubApiClient constructor are:

{
  authType: 'oauth-client-credentials',
  loginUrl: process.env.SALESFORCE_LOGIN_URL,
  clientId: process.env.SALESFORCE_CLIENT_ID,
  clientSecret: process.env.SALESFORCE_CLIENT_SECRET
}

However, when using the pub-sub-api-node-client package in our TS code, we get the following compilation error:

Argument of type '{ authType: string; loginUrl: string; clientId: string; clientSecret: string; }' is not assignable to parameter of type 'Configuration'.
  Type '{ authType: string; loginUrl: string; clientId: string; clientSecret: string; }' is missing the following properties from type 'Configuration': pubSubEndpoint, username, password, userToken, and 4 more.ts(2345)

This error appeared after updating dependency to pub-sub-api-node-client from 5.0.1 to 5.2.1.

Are all those properties now required ? In which case maybe we could update the doc.

If not, and if constructor is still supposed to be invoked like explained, we should maybe update type definition to reflect this.

I will make a PR with a suggested change for this second option as I suspect it is the most likely to be the one expected. Feel free to do whatever you think is relevant with it, as it is at most an educated guess of what type def could look like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions