Skip to content

Commit d8a3afa

Browse files
chore: Update Typescript to 4.x (#1541)
This is the second PR of a series of changes to update @google-cloud/firestore dependency to 5.x. This is a follow-up to #1540 - Upgraded Typescript from ~3.7.3 to ~4.4.3 - Fixed TS2790: The operand of a 'delete' operator must be optional errors Note: Manually tested for backwards compatibility on TS 3.7.x to 4.5.x. We will add TS compatibility tests to CIs in the future.
1 parent db137e9 commit d8a3afa

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
"sinon": "^9.0.0",
219219
"sinon-chai": "^3.0.0",
220220
"ts-node": "^10.2.0",
221-
"typescript": "^3.7.3",
221+
"typescript": "^4.4.3",
222222
"yargs": "^17.0.1"
223223
}
224224
}

test/integration/auth.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ describe('admin.auth', () => {
12591259
const actualTenantObj = actualTenant.toJSON();
12601260
if (authEmulatorHost) {
12611261
// Not supported in Auth Emulator
1262-
delete (actualTenantObj as {testPhoneNumbers: Record<string, string>}).testPhoneNumbers;
1262+
delete (actualTenantObj as {testPhoneNumbers?: Record<string, string>}).testPhoneNumbers;
12631263
delete expectedCreatedTenant.testPhoneNumbers;
12641264
}
12651265
expect(actualTenantObj).to.deep.equal(expectedCreatedTenant);
@@ -1617,7 +1617,7 @@ describe('admin.auth', () => {
16171617
const actualTenantObj = actualTenant.toJSON();
16181618
if (authEmulatorHost) {
16191619
// Not supported in Auth Emulator
1620-
delete (actualTenantObj as {testPhoneNumbers: Record<string, string>}).testPhoneNumbers;
1620+
delete (actualTenantObj as {testPhoneNumbers?: Record<string, string>}).testPhoneNumbers;
16211621
delete expectedCreatedTenant.testPhoneNumbers;
16221622
}
16231623
expect(actualTenantObj).to.deep.equal(expectedCreatedTenant);
@@ -1649,15 +1649,15 @@ describe('admin.auth', () => {
16491649
.then((actualTenant) => {
16501650
const actualTenantObj = actualTenant.toJSON();
16511651
// Not supported in Auth Emulator
1652-
delete (actualTenantObj as {testPhoneNumbers: Record<string, string>}).testPhoneNumbers;
1652+
delete (actualTenantObj as {testPhoneNumbers?: Record<string, string>}).testPhoneNumbers;
16531653
delete expectedUpdatedTenant.testPhoneNumbers;
16541654
expect(actualTenantObj).to.deep.equal(expectedUpdatedTenant);
16551655
return getAuth().tenantManager().updateTenant(createdTenantId, updatedOptions2);
16561656
})
16571657
.then((actualTenant) => {
16581658
const actualTenantObj = actualTenant.toJSON();
16591659
// Not supported in Auth Emulator
1660-
delete (actualTenantObj as {testPhoneNumbers: Record<string, string>}).testPhoneNumbers;
1660+
delete (actualTenantObj as {testPhoneNumbers?: Record<string, string>}).testPhoneNumbers;
16611661
delete expectedUpdatedTenant2.testPhoneNumbers;
16621662
expect(actualTenantObj).to.deep.equal(expectedUpdatedTenant2);
16631663
});
@@ -2150,8 +2150,8 @@ describe('admin.auth', () => {
21502150
// Not supported in ID token,
21512151
delete decodedIdToken.nonce;
21522152
// exp and iat may vary depending on network connection latency.
2153-
delete decodedIdToken.exp;
2154-
delete decodedIdToken.iat;
2153+
delete (decodedIdToken as any).exp;
2154+
delete (decodedIdToken as any).iat;
21552155
expect(decodedIdToken).to.deep.equal(payloadClaims);
21562156
});
21572157
});

test/unit/auth/tenant.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ describe('Tenant', () => {
8686
it('should return the expected server request without multi-factor and phone config', () => {
8787
const tenantOptionsClientRequest = deepCopy(clientRequestWithoutMfa);
8888
const tenantOptionsServerRequest = deepCopy(serverRequestWithoutMfa);
89-
delete tenantOptionsServerRequest.name;
89+
delete (tenantOptionsServerRequest as any).name;
9090
expect(Tenant.buildServerRequest(tenantOptionsClientRequest, !createRequest))
9191
.to.deep.equal(tenantOptionsServerRequest);
9292
});
9393

9494
it('should return the expected server request with multi-factor and phone config', () => {
9595
const tenantOptionsClientRequest = deepCopy(clientRequest);
9696
const tenantOptionsServerRequest = deepCopy(serverRequest);
97-
delete tenantOptionsServerRequest.name;
97+
delete (tenantOptionsServerRequest as any).name;
9898
expect(Tenant.buildServerRequest(tenantOptionsClientRequest, !createRequest))
9999
.to.deep.equal(tenantOptionsServerRequest);
100100
});
@@ -134,7 +134,7 @@ describe('Tenant', () => {
134134
const tenantOptionsClientRequest = deepCopy(clientRequest);
135135
const tenantOptionsServerRequest = deepCopy(serverRequest);
136136
tenantOptionsClientRequest.testPhoneNumbers = null;
137-
delete tenantOptionsServerRequest.name;
137+
delete (tenantOptionsServerRequest as any).name;
138138
tenantOptionsServerRequest.testPhoneNumbers = {};
139139

140140
expect(Tenant.buildServerRequest(tenantOptionsClientRequest, !createRequest))
@@ -181,7 +181,7 @@ describe('Tenant', () => {
181181
it('should return the expected server request without multi-factor and phone config', () => {
182182
const tenantOptionsClientRequest: CreateTenantRequest = deepCopy(clientRequestWithoutMfa);
183183
const tenantOptionsServerRequest: TenantServerResponse = deepCopy(serverRequestWithoutMfa);
184-
delete tenantOptionsServerRequest.name;
184+
delete (tenantOptionsServerRequest as any).name;
185185

186186
expect(Tenant.buildServerRequest(tenantOptionsClientRequest, createRequest))
187187
.to.deep.equal(tenantOptionsServerRequest);
@@ -190,7 +190,7 @@ describe('Tenant', () => {
190190
it('should return the expected server request with multi-factor and phone config', () => {
191191
const tenantOptionsClientRequest: CreateTenantRequest = deepCopy(clientRequest);
192192
const tenantOptionsServerRequest: TenantServerResponse = deepCopy(serverRequest);
193-
delete tenantOptionsServerRequest.name;
193+
delete (tenantOptionsServerRequest as any).name;
194194

195195
expect(Tenant.buildServerRequest(tenantOptionsClientRequest, createRequest))
196196
.to.deep.equal(tenantOptionsServerRequest);
@@ -224,7 +224,7 @@ describe('Tenant', () => {
224224
const tenantOptionsClientRequest = deepCopy(clientRequest);
225225
const tenantOptionsServerRequest = deepCopy(serverRequest);
226226
tenantOptionsClientRequest.testPhoneNumbers = null;
227-
delete tenantOptionsServerRequest.name;
227+
delete (tenantOptionsServerRequest as any).name;
228228
tenantOptionsServerRequest.testPhoneNumbers = {};
229229

230230
expect(() => {

test/unit/security-rules/security-rules.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ describe('SecurityRules', () => {
825825

826826
it('should resolve with RulesetMetadataList when the response contains no page token', () => {
827827
const response = deepCopy(LIST_RULESETS_RESPONSE);
828-
delete response.nextPageToken;
828+
delete (response as any).nextPageToken;
829829
const stub = sinon
830830
.stub(SecurityRulesApiClient.prototype, 'listRulesets')
831831
.resolves(response);

0 commit comments

Comments
 (0)