From b3d9dea52ba69e18b59454baa6565c791b9d858d Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 13 Apr 2021 15:49:43 +0200 Subject: [PATCH] build(docs-infra): add correct types to tuples (#41596) This is to fix the below error: ``` tools/firebase-test-utils/FirebaseRedirect.ts:17:50 - error TS2345: Argument of type '(string | RegExp)[][]' is not assignable to parameter of type 'ReplacementDetail[]'. Type '(string | RegExp)[]' is missing the following properties from type 'ReplacementDetail': 0, 1 17 return XRegExp.replaceEach(this.destination, [...paramReplacers, ...restReplacers]); ``` https://app.circleci.com/pipelines/github/angular/angular/31076/workflows/5fd3851e-ae9e-4d77-b0ef-366ba38a9088/jobs/961795 PR Close #41596 --- aio/tools/firebase-test-utils/FirebaseGlob.ts | 2 +- aio/tools/firebase-test-utils/FirebaseRedirect.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aio/tools/firebase-test-utils/FirebaseGlob.ts b/aio/tools/firebase-test-utils/FirebaseGlob.ts index 6db7470cbb..fa857e0409 100644 --- a/aio/tools/firebase-test-utils/FirebaseGlob.ts +++ b/aio/tools/firebase-test-utils/FirebaseGlob.ts @@ -60,7 +60,7 @@ export class FirebaseGlob { const result: { [key: string]: string } = {}; const names = this.regex.xregexp.captureNames || []; - names.forEach(name => result[name] = (match[name])); + names.forEach(name => result[name] = match.groups![name]); return result; } } diff --git a/aio/tools/firebase-test-utils/FirebaseRedirect.ts b/aio/tools/firebase-test-utils/FirebaseRedirect.ts index b8983a7678..d0957e158c 100644 --- a/aio/tools/firebase-test-utils/FirebaseRedirect.ts +++ b/aio/tools/firebase-test-utils/FirebaseRedirect.ts @@ -12,8 +12,8 @@ export class FirebaseRedirect { return undefined; } - const paramReplacers = Object.keys(this.glob.namedParams).map(name => [ XRegExp(`:${name}`, 'g'), match[name] ]); - const restReplacers = Object.keys(this.glob.restParams).map(name => [ XRegExp(`:${name}\\*`, 'g'), match[name] ]); + const paramReplacers = Object.keys(this.glob.namedParams).map<[RegExp, string]>(name => [ XRegExp(`:${name}`, 'g'), match[name] ]); + const restReplacers = Object.keys(this.glob.restParams).map<[RegExp, string]>(name => [ XRegExp(`:${name}\\*`, 'g'), match[name] ]); return XRegExp.replaceEach(this.destination, [...paramReplacers, ...restReplacers]); } }