alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

Export services.skillManagement.SkillManagementServiceClient from ask-smapi-sdk. #678

Closed sam-goodwin closed 2 years ago

sam-goodwin commented 3 years ago

Why isn't the type of the client exported from ask-smapi-sdk?

I am using the ask-smapi-sdk and noticed that the CustomSmapiClientBuilder exposes a private type.

export declare class CustomSmapiClientBuilder extends StandardSmapiClientBuilder {
    private apiClient;
    private apiEndpoint;
    private authEndpoint?;
    withApiEndpoint(apiEndpoint: string): CustomSmapiClientBuilder;
    withAuthEndpoint(authEndpoint: string): CustomSmapiClientBuilder;
    withApiClient(apiClient: ApiClient): CustomSmapiClientBuilder;
    /**
     * Function used to generate SkillManagementService instance.
     */
    client(): services.skillManagement.SkillManagementServiceClient;
}

Specifically:

client(): services.skillManagement.SkillManagementServiceClient;

But SkillManagementServiceClient is not exported:

export declare namespace services.skillManagement {
    /**
     *
     */
    class SkillManagementServiceClient extends BaseServiceClient {
    ..

I'm trying to write a class that wraps the client:

export class MySmapi {
  constructor(client: ????) {}
}

If the type is private, what type am i supposed to put here?

The only way to use the client is with TypeScript type inference. That's unfortunate.

ShenChen93 commented 3 years ago

Hi Sam, The services.skillManagement.SkillManagementServiceClient is exported in the smapi sdk model: https://github.com/alexa/alexa-apis-for-nodejs/blob/master/ask-smapi-model/index.ts#L6772. Thus for now developer need to import the type from model seperately.

To better improve the user experience, I think we could re-export SkillManagementServiceClient in smapi sdk. Do you think it would be good enough for developers to use this type ?

Thanks, Shen

sam-goodwin commented 3 years ago

I'd prefer to avoid re-exporting types since it breaks jump-to-definition and confuses auto import.

doiron commented 2 years ago

closing as this is exposed in the model.