@@ -11,6 +11,8 @@ export type IntegrationIndex = {
1111 [ key : string ] : Integration ;
1212} ;
1313
14+ type IntegrationWithDefaultInstance = Integration & { isDefaultInstance ?: true } ;
15+
1416/**
1517 * Remove duplicates from the given array, preferring the last instance of any duplicate. Not guaranteed to
1618 * preserve the order of integrations in the array.
@@ -20,10 +22,10 @@ export type IntegrationIndex = {
2022function filterDuplicates ( integrations : Integration [ ] ) : Integration [ ] {
2123 const integrationsByName : { [ key : string ] : Integration } = { } ;
2224
23- integrations . forEach ( currentInstance => {
25+ integrations . forEach ( ( currentInstance : IntegrationWithDefaultInstance ) => {
2426 const { name } = currentInstance ;
2527
26- const existingInstance = integrationsByName [ name ] ;
28+ const existingInstance : IntegrationWithDefaultInstance | undefined = integrationsByName [ name ] ;
2729
2830 // We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a
2931 // default instance to overwrite an existing user instance
@@ -43,7 +45,7 @@ export function getIntegrationsToSetup(options: Pick<Options, 'defaultIntegratio
4345 const userIntegrations = options . integrations ;
4446
4547 // We flag default instances, so that later we can tell them apart from any user-created instances of the same class
46- defaultIntegrations . forEach ( integration => {
48+ defaultIntegrations . forEach ( ( integration : IntegrationWithDefaultInstance ) => {
4749 integration . isDefaultInstance = true ;
4850 } ) ;
4951
0 commit comments