Skip to content

Commit

Permalink
fix: PubSub - Resolve ts strict errors in the root import object (aws…
Browse files Browse the repository at this point in the history
…-amplify#9733)

fix: PubSub - Resolve ts strict errors in the PubSub root file
  • Loading branch information
stocaaro authored Apr 4, 2022
1 parent c1ea4e1 commit c1d360c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/pubsub/src/PubSub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export class PubSubClass {
/**
* Internal instance of AWSAppSyncProvider used by the API category to subscribe to AppSync
*/
private _awsAppSyncProvider: AWSAppSyncProvider;
private _awsAppSyncProvider?: AWSAppSyncProvider;

/**
* Internal instance of AWSAppSyncRealTimeProvider used by the API category to subscribe to AppSync
*/
private _awsAppSyncRealTimeProvider: AWSAppSyncRealTimeProvider;
private _awsAppSyncRealTimeProvider?: AWSAppSyncRealTimeProvider;

/**
* Lazy instantiate AWSAppSyncProvider when it is required by the API category
Expand Down Expand Up @@ -68,8 +68,8 @@ export class PubSubClass {
*
* @param {PubSubOptions} options - Configuration object for PubSub
*/
constructor(options: PubSubOptions) {
this._options = options;
constructor(options?: PubSubOptions) {
this._options = options ?? {};
logger.debug('PubSub Options', this._options);
this._pluggables = [];
this.subscribe = this.subscribe.bind(this);
Expand Down Expand Up @@ -120,7 +120,7 @@ export class PubSubClass {
);
}

private getProviderByName(providerName) {
private getProviderByName(providerName: string | symbol) {
if (providerName === INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER) {
return this.awsAppSyncProvider;
}
Expand Down Expand Up @@ -194,5 +194,5 @@ export class PubSubClass {
}
}

export const PubSub = new PubSubClass(null);
export const PubSub = new PubSubClass();
Amplify.register(PubSub);

0 comments on commit c1d360c

Please sign in to comment.