Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to TypeScript 5 #8561

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
42ab67f
Updgrade to TS5
dlarocque Oct 8, 2024
7aa5fa2
Remove passes of decorators to TS factory functions
dlarocque Oct 9, 2024
df4da35
Format
dlarocque Oct 9, 2024
d93358a
Update TS in packages that used older TS versions
dlarocque Oct 9, 2024
c58e63b
Convert `EmulatorConfig`'s `HostAndPort` to be an optional property
dlarocque Oct 10, 2024
195c230
Update API reports
dlarocque Oct 16, 2024
353229b
Update yarn.lock
dlarocque Oct 16, 2024
a96166d
Cleanup
dlarocque Oct 16, 2024
40b0930
Upgrade ts-essentials to latest
dlarocque Oct 16, 2024
f1116fa
Format and move prune-dts test folder
dlarocque Oct 16, 2024
6d3fe14
Fix unknown comparison with number
dlarocque Oct 17, 2024
1fb70f2
Fix remote-config timeoutStub types
dlarocque Oct 17, 2024
6bda4e2
Make Auth Recaptcha request extend object
dlarocque Oct 18, 2024
9628d69
Declare Firestore Data Converter test type `MyModelType` as PartialWi…
dlarocque Oct 18, 2024
9d2fd68
Revert firestore lite typings test fix
dlarocque Oct 18, 2024
b82f2b6
Disable import/no-extraneous-dependencies for auth recaptcha tests
dlarocque Oct 21, 2024
b19aebd
Explicitly type Firestore data converter in type tests
dlarocque Oct 21, 2024
7aa755a
Downgrade `@types/node` to 18.19.57
dlarocque Oct 21, 2024
aa51e66
Revert "Convert `EmulatorConfig`'s `HostAndPort` to be an optional pr…
dlarocque Oct 21, 2024
db3b0d5
Don't throw an error in case where only one of host or port are defines
dlarocque Oct 21, 2024
2b830aa
Merge branch 'main' into dl/ts5
dlarocque Oct 22, 2024
e7b9b12
Throw error if only one of host or port are defined
dlarocque Oct 22, 2024
c27254f
Update API reports
dlarocque Oct 22, 2024
e27616b
Add outer host and port check, and move tests back
dlarocque Oct 23, 2024
fcc03ad
Merge branch 'main' into dl/ts5
dlarocque Oct 23, 2024
d693bfd
Update devsite docs
dlarocque Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Prune .d.ts",
"program": "${workspaceRoot}/repo-scripts/prune-dts/node_modules/.bin/_mocha",
"cwd": "${workspaceRoot}/repo-scripts/prune-dts",
"args": [
"--require",
"ts-node/register",
"--timeout",
"5000",
"${workspaceFolder}/repo-scripts/prune-dts/*.test.ts"
],
"env": {
"TS_NODE_COMPILER_OPTIONS" : "{\"module\":\"commonjs\"}"
},
"sourceMaps": true,
},
{
"type": "node",
"request": "launch",
Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"karma-typescript": "5.5.4",
"karma-typescript-es6-transform": "5.5.4",
"mocha": "9.2.2",
"typescript": "4.7.4",
"typescript": "5.5.4",
"webpack": "5.76.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.11.1"
Expand Down
2 changes: 1 addition & 1 deletion integration/compat-interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@firebase/remote-config-compat": "0.2.10"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"engines": {
"node": ">=18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion integration/compat-typings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"firebase": "*"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"engines": {
"node": ">=18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion integration/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"karma-typescript": "5.5.4",
"mocha": "9.2.2",
"npm-run-all": "4.1.5",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"engines": {
"node": ">=18.0.0"
Expand Down
2 changes: 1 addition & 1 deletion integration/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"karma-spec-reporter": "0.0.36",
"mocha": "9.2.2",
"ts-loader": "9.5.1",
"typescript": "4.2.2",
"typescript": "5.5.4",
"webpack": "5.76.0",
"webpack-stream": "7.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@types/long": "4.0.2",
"@types/mocha": "9.1.1",
"@types/mz": "2.7.8",
"@types/node": "16.18.68",
"@types/node": "18.19.57",
"@types/request": "2.48.12",
"@types/sinon": "9.0.11",
"@types/sinon-chai": "3.2.12",
Expand Down Expand Up @@ -156,7 +156,7 @@
"tsec": "0.2.8",
"tslint": "6.1.3",
"typedoc": "0.16.11",
"typescript": "4.7.4",
"typescript": "5.5.4",
"watch": "1.0.2",
"webpack": "5.76.0",
"yargs": "17.7.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"rollup": "2.79.1",
"@rollup/plugin-json": "4.1.0",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/analytics-compat",
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-interop-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/analytics-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/analytics",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-check-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/app-check",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-check-interop-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/app-check-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/app-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/app-check",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@rollup/plugin-json": "4.1.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/app-compat",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@firebase/logger": "0.2.6"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-typescript2": "0.31.2",
"rollup-plugin-dts": "5.3.1",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/app",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-compat/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"rollup-plugin-sourcemaps": "0.6.3",
"rollup-plugin-typescript2": "0.31.2",
"rollup-plugin-uglify": "6.0.4",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/auth-compat/demo",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-typescript2": "0.31.2",
"selenium-webdriver": "4.8.0",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/auth-compat",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-interop-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/auth-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"rollup-plugin-typescript2": "0.31.2",
"selenium-webdriver": "4.8.0",
"totp-generator": "0.0.14",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/auth",
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,20 @@ export async function _performSignInRequest<T, V extends IdTokenResponse>(
request?: T,
customErrorMap: Partial<ServerErrorMap<ServerError>> = {}
): Promise<V> {
const serverResponse = (await _performApiRequest<T, V | IdTokenMfaResponse>(
const serverResponse = await _performApiRequest<T, V | IdTokenMfaResponse>(
auth,
method,
path,
request,
customErrorMap
)) as V;
);
if ('mfaPendingCredential' in serverResponse) {
_fail(auth, AuthErrorCode.MFA_REQUIRED, {
_serverResponse: serverResponse
});
}

return serverResponse;
return serverResponse as V;
}

export function _getFinalTarget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class RecaptchaEnterpriseVerifier {
}
}

export async function injectRecaptchaFields<T>(
export async function injectRecaptchaFields<T extends object>(
auth: AuthInternal,
request: T,
action: RecaptchaActionName,
Expand Down Expand Up @@ -238,7 +238,7 @@ type ActionMethod<TRequest, TResponse> = (
request: TRequest
) => Promise<TResponse>;

export async function handleRecaptchaFlow<TRequest, TResponse>(
export async function handleRecaptchaFlow<TRequest extends object, TResponse>(
authInstance: AuthInternal,
request: TRequest,
actionName: RecaptchaActionName,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/platform_browser/strategies/phone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export async function updatePhoneNumber(
}

// Helper function that fetches and injects a reCAPTCHA v2 token into the request.
export async function injectRecaptchaV2Token<T>(
export async function injectRecaptchaV2Token<T extends object>(
auth: AuthInternal,
request: T,
recaptchaV2Verifier: ApplicationVerifierInternal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import sinonChai from 'sinon-chai';
// eslint-disable-next-line import/no-extraneous-dependencies
import {
linkWithPhoneNumber,
PhoneAuthProvider,
Expand Down
2 changes: 1 addition & 1 deletion packages/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"devDependencies": {
"rollup": "2.79.1",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/component",
Expand Down
2 changes: 1 addition & 1 deletion packages/data-connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@firebase/app": "0.10.15",
"rollup": "2.79.1",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/data-connect",
Expand Down
2 changes: 1 addition & 1 deletion packages/database-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"devDependencies": {
"@firebase/app-compat": "0.2.45",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/database-compat",
Expand Down
10 changes: 6 additions & 4 deletions packages/database-compat/test/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,11 @@ describe('Transaction Tests', () => {
ref1.transaction(
current => {
retries++;
// We should be getting server events while the transaction is outstanding.
for (let i = 0; i < (current || 0); i++) {
expect(events[i]).to.equal(i);
if (typeof current === 'number') {
// We should be getting server events while the transaction is outstanding.
for (let i = 0; i < (current || 0); i++) {
expect(events[i]).to.equal(i);
}
}

if (current === SETS - 1) {
Expand Down Expand Up @@ -919,7 +921,7 @@ describe('Transaction Tests', () => {
current => {
if (current == null) {
return 0;
} else if (current < COUNT) {
} else if (typeof current === 'number' && current < COUNT) {
return (current as number) + 1;
} else {
shouldCommit = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/database-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.7.4"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@firebase/app": "0.10.15",
"rollup": "2.79.1",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/database",
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
"gulp": "4.0.2",
"gulp-sourcemaps": "3.0.0",
"gulp-replace": "1.1.4",
"typescript": "4.2.2",
"typescript": "5.5.4",
"rollup-plugin-license": "3.0.1"
},
"components": [
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"rollup-plugin-typescript2": "0.31.2",
"@rollup/plugin-node-resolve": "13.3.0",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"license": "Apache-2.0",
"typings": "dist/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"typescript": "4.2.2"
"typescript": "5.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"rollup-plugin-typescript2": "0.31.2",
"rollup-plugin-dts": "5.3.1",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.5.4"
},
"repository": {
"directory": "packages/firestore",
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/scripts/build-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading