Skip to content

Commit d87d3a8

Browse files
authored
Update typing for new TS version (#6365)
1 parent efe2000 commit d87d3a8

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

packages/analytics/src/get-config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ async function attemptFetchDynamicConfigWithRetry(
188188
logger.warn(
189189
`Timed out fetching this Firebase app's measurement ID from the server.` +
190190
` Falling back to the measurement ID ${measurementId}` +
191-
` provided in the "measurementId" field in the local Firebase config. [${e.message}]`
191+
` provided in the "measurementId" field in the local Firebase config. [${
192+
(e as Error)?.message
193+
}]`
192194
);
193195
return { appId, measurementId };
194196
}
@@ -203,13 +205,14 @@ async function attemptFetchDynamicConfigWithRetry(
203205

204206
return response;
205207
} catch (e) {
206-
if (!isRetriableError(e)) {
208+
const error = e as Error;
209+
if (!isRetriableError(error)) {
207210
retryData.deleteThrottleMetadata(appId);
208211
if (measurementId) {
209212
logger.warn(
210213
`Failed to fetch this Firebase app's measurement ID from the server.` +
211214
` Falling back to the measurement ID ${measurementId}` +
212-
` provided in the "measurementId" field in the local Firebase config. [${e.message}]`
215+
` provided in the "measurementId" field in the local Firebase config. [${error?.message}]`
213216
);
214217
return { appId, measurementId };
215218
} else {
@@ -218,7 +221,7 @@ async function attemptFetchDynamicConfigWithRetry(
218221
}
219222

220223
const backoffMillis =
221-
Number(e.customData.httpStatus) === 503
224+
Number(error?.customData?.httpStatus) === 503
222225
? calculateBackoffMillis(
223226
backoffCount,
224227
retryData.intervalMillis,

packages/messaging/src/internals/requests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export async function requestDeleteToken(
141141
}
142142
} catch (err) {
143143
throw ERROR_FACTORY.create(ErrorCode.TOKEN_UNSUBSCRIBE_FAILED, {
144-
errorInfo: err
144+
errorInfo: (err as Error)?.toString()
145145
});
146146
}
147147
}

repo-scripts/size-analysis/analyze-all-bundles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function generateReportForBundles(
6161
input: version ? `${outputDir}/${bundle}` : `${definitionDir}/${bundle}`,
6262
bundler: Bundler.Rollup,
6363
mode: version ? Mode.Npm : Mode.Local,
64-
output: output,
64+
output,
6565
debug: true
6666
};
6767
console.log(`Running for bundle "${bundle}" with mode "${option.mode}".`);
@@ -78,7 +78,7 @@ function overwriteVersion(
7878
bundle: string,
7979
temp: string,
8080
version: string
81-
) {
81+
): void {
8282
const definitions = JSON.parse(
8383
fs.readFileSync(`${definitionDir}/${bundle}`, { encoding: 'utf-8' })
8484
);
@@ -93,7 +93,7 @@ function overwriteVersion(
9393
});
9494
}
9595

96-
function parseAnalysisOutput(product: string, output: string) {
96+
function parseAnalysisOutput(product: string, output: string): Report[] {
9797
const analyses = JSON.parse(fs.readFileSync(output, { encoding: 'utf-8' }));
9898
const results: Report[] = [];
9999
for (const analysis of analyses) {

repo-scripts/size-analysis/test/size-analysis.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('extractExports', () => {
196196
describe('extractAllTopLevelSymbols', () => {
197197
let subsetExportsBundleFile: string;
198198
let extractedDeclarations: MemberList;
199-
before(function () {
199+
before(() => {
200200
const start = Date.now();
201201
subsetExportsBundleFile = getSubsetExportsBundleFilePath();
202202
extractedDeclarations = extractAllTopLevelSymbols(subsetExportsBundleFile);

0 commit comments

Comments
 (0)