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

chore: upgrade to typescript 5 #2345

Merged
merged 10 commits into from
Jan 24, 2024
1 change: 0 additions & 1 deletion localenv/mock-account-servicing-entity/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"target": "ES2019",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"prettier": "^3.2.2",
"ts-jest": "^29.1.1",
"tunnelmole": "^2.2.13",
"typescript": "^4.9.5",
"typescript": "^5.3.3",
"uuid": "^9.0.1"
},
"dependenciesMeta": {
Expand Down
3 changes: 1 addition & 2 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"node-mocks-http": "^1.14.1",
"openapi-types": "^12.1.3",
"pino-pretty": "^10.3.1",
"testcontainers": "^10.5.0",
"typescript": "^4.9.5"
"testcontainers": "^10.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/auth/src/graphql/scalars/UInt8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function coerceUInt8Value(value: number | string | unknown): number {
throw new TypeError('Provided value is not number or string.')
}
const nValue = Number(value)
if (Number.isInteger(nValue) && value >= 0 && value <= 255) {
if (Number.isInteger(nValue) && nValue >= 0 && nValue <= 255) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same change made in backend)

fixes new rule: Forbidden Implicit Coercions in Relational Operators

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#forbidden-implicit-coercions-in-relational-operators

return nValue
}
throw new GraphQLError('Provided value is not a UInt8.', {
Expand Down
4 changes: 1 addition & 3 deletions packages/auth/src/tests/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ export function createContext<T extends AppContext>(
maxAge: 60 * 1000,
signed: true
},
// Only accepts Middleware<DefaultState, DefaultContext> for some reason, koa is Middleware<DefaultState, AppContext>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
koa as any
koa
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that this "any" assertion wasn't needed

)
)
const ctx = koa.createContext(req, res)
Expand Down
3 changes: 1 addition & 2 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"rosie": "^2.1.1",
"testcontainers": "^10.5.0",
"tmp": "^0.2.1",
"ts-node": "^10.9.2",
"typescript": "^4.9.5"
"ts-node": "^10.9.2"
},
"dependencies": {
"@adonisjs/fold": "^8.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/graphql/scalars/UInt8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function coerceUInt8Value(value: number | string | unknown): number {
throw new TypeError('Provided value is not number or string.')
}
const nValue = Number(value)
if (Number.isInteger(nValue) && value >= 0 && value <= 255) {
if (Number.isInteger(nValue) && nValue >= 0 && nValue <= 255) {
return nValue
}
throw new GraphQLError('Provided value is not a UInt8.', {
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"eslint-plugin-react": "^7.33.2",
"postcss": "^8.4.30",
"prettier": "^3.2.2",
"tailwindcss": "^3.4.1",
"typescript": "^4.9.5"
"tailwindcss": "^3.4.1"
},
"engines": {
"node": "18"
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"target": "ES2019",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same change made a few other places)

forceConsistentCasingInFileNames is now true by default so I removed this because its now redundant. Just wanted to clarify that this isnt changing the configuration.

"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
Expand Down
3 changes: 1 addition & 2 deletions packages/token-introspection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"devDependencies": {
"@types/node": "^18.7.12",
"nock": "^13.4.0",
"openapi-typescript": "^6.7.4",
"typescript": "^4.9.5"
"openapi-typescript": "^6.7.4"
},
"dependencies": {
"@interledger/openapi": "1.2.1",
Expand Down
Loading