Skip to content

Commit 70df5d6

Browse files
committed
Update code to match component changes
1 parent 88cb6be commit 70df5d6

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

packages/analytics/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import {
2727
} from '@firebase/component';
2828
import { ERROR_FACTORY, AnalyticsError } from './src/errors';
2929

30+
import { version } from './package.json';
31+
3032
declare global {
3133
interface Window {
3234
[key: string]: unknown;
@@ -89,12 +91,4 @@ declare module '@firebase/app-types' {
8991
interface FirebaseApp {
9092
analytics(): FirebaseAnalytics;
9193
}
92-
}
93-
94-
declare module '@firebase/component' {
95-
interface ComponentContainer {
96-
getProvider(name: typeof ANALYTICS_TYPE): Provider<FirebaseAnalytics>;
97-
}
98-
99-
interface Provider<T> {}
100-
}
94+
}

packages/app-types/index.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,19 @@ export interface FirebaseNamespace {
102102
SDK_VERSION: string;
103103
}
104104

105+
export interface PlatformLoggerService {
106+
getPlatformInfoString(): string;
107+
}
108+
109+
export interface VersionService {
110+
library: string;
111+
version: string;
112+
}
113+
105114
declare module '@firebase/component' {
106115
interface NameServiceMapping {
107116
'app': FirebaseApp;
117+
'app-version': VersionService;
118+
'platform-logger': PlatformLoggerService;
108119
}
109120
}

packages/app/src/firebaseApp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class FirebaseAppImpl implements FirebaseApp {
6767
this._addComponent(
6868
new Component(
6969
'platform-logger',
70-
container => new PlatformLoggerService(container),
70+
(container: ComponentContainer) => new PlatformLoggerService(container),
7171
ComponentType.PRIVATE
7272
)
7373
);

packages/app/src/firebaseNamespaceCore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { FirebaseAppLiteImpl } from './lite/firebaseAppLite';
3434
import { DEFAULT_ENTRY_NAME } from './constants';
3535
import { version } from '../../firebase/package.json';
3636
import { logger } from './logger';
37-
import { Component, ComponentType } from '@firebase/component';
37+
import { Component, ComponentType, Name } from '@firebase/component';
3838
import { VersionService } from './version-service';
3939

4040
/**
@@ -243,7 +243,7 @@ function registerVersionComponent(
243243
): FirebaseServiceNamespace<FirebaseService> | null {
244244
return registerComponent(
245245
new Component(
246-
`${library}-version`,
246+
`${library}-version` as Name,
247247
() => {
248248
return new VersionService(library, version);
249249
},

0 commit comments

Comments
 (0)