File tree Expand file tree Collapse file tree
packages/analytics/client/src/analytics_client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,8 +168,9 @@ export class AnalyticsClient implements IAnalyticsClient {
168168 this . optInConfig$ . next ( optInConfigInstance ) ;
169169 } ;
170170
171- // @ts -expect-error upgrade typescript v4.9.5
172- public registerContextProvider = < Context > ( contextProviderOpts : ContextProviderOpts < Context > ) => {
171+ public registerContextProvider = < Context extends Partial < EventContext > > (
172+ contextProviderOpts : ContextProviderOpts < Context >
173+ ) => {
173174 this . contextService . registerContextProvider ( contextProviderOpts ) ;
174175 } ;
175176
Original file line number Diff line number Diff line change @@ -27,10 +27,10 @@ export class ContextService {
2727 * Registers a context provider, and subscribes to any updates from it.
2828 * @param contextProviderOpts The options to register the context provider {@link ContextProviderOpts}
2929 */
30- public registerContextProvider < Context > ( {
30+ public registerContextProvider < Context extends Partial < EventContext > > ( {
3131 name,
3232 context$,
33- schema, // @ts -expect-error upgrade typescript v4.9.5
33+ schema,
3434 } : ContextProviderOpts < Context > ) {
3535 if ( this . contextProvidersSubscriptions . has ( name ) ) {
3636 throw new Error ( `Context provider with name '${ name } ' already registered` ) ;
@@ -58,9 +58,8 @@ export class ContextService {
5858 } )
5959 )
6060 . subscribe ( ( context ) => {
61- // We store each context linked to the context provider so they can increase and reduce
61+ // We store each context linked to the context provider, so they can increase and reduce
6262 // the number of fields they report without having left-overs in the global context.
63- // @ts -expect-error upgrade typescript v4.9.5
6463 this . contextProvidersRegistry . set ( name , context ) ;
6564
6665 // For every context change, we rebuild the global context.
Original file line number Diff line number Diff line change @@ -205,8 +205,9 @@ export interface IAnalyticsClient {
205205 *
206206 * @track -adoption
207207 */
208- // @ts -expect-error upgrade typescript v4.9.5
209- registerContextProvider : < Context > ( contextProviderOpts : ContextProviderOpts < Context > ) => void ;
208+ registerContextProvider : < Context extends Partial < EventContext > > (
209+ contextProviderOpts : ContextProviderOpts < Context >
210+ ) => void ;
210211 /**
211212 * Removes the context provider and stop enriching the events from its context.
212213 * @param contextProviderName The name of the context provider to remove.
You can’t perform that action at this time.
0 commit comments