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
Merged

chore: upgrade to typescript 5 #2345

merged 10 commits into from
Jan 24, 2024

Conversation

BlairCurrey
Copy link
Contributor

@BlairCurrey BlairCurrey commented Jan 16, 2024

Changes proposed in this pull request

  • upgrades typescript to 5.3.3 and fixes a resulting build error

Context

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Documentation added
  • Make sure that all checks pass
  • Postman collection updated

Copy link

netlify bot commented Jan 16, 2024

Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit 1e8bfbb
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/65b1286b4b877900076dd090

@github-actions github-actions bot added pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. type: source Changes business logic pkg: auth Changes in the GNAP auth package. pkg: mock-ase labels Jan 16, 2024
@@ -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

// 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

@@ -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.

@BlairCurrey BlairCurrey marked this pull request as ready for review January 16, 2024 18:38
@BlairCurrey
Copy link
Contributor Author

I also went through the list of settings being deprecated and found that we are not using any of them: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#deprecations-and-default-changes

Copy link
Member

@sabineschaller sabineschaller left a comment

Choose a reason for hiding this comment

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

Thank you @BlairCurrey ! Just one small question.

Comment on lines 67 to 72
/* Advanced Options */
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
// "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"resolveJsonModule": true
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there something off with the curly braces or why is that highlighted in red?

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 think github's syntax highlighting for json just doesnt understand comments in json. You can see the same thing here for example: https://github.com/mui/material-ui/blob/4b735de27e84a0221f42530d281f6d718ee8a7e1/packages/mui-utils/tsconfig.build.json#L4

Copy link
Contributor Author

@BlairCurrey BlairCurrey Jan 22, 2024

Choose a reason for hiding this comment

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

I see you're referring to the curly brace specifically... part of the same issue though it looks like. It's fine locally. As a sanity check I added an extra brace and that makes the build command fail. Which is not happening here in CI so I think we're good.

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 removed the unused option for good measure but it doesnt change anything. looks like that's just the way it is on main too https://github.com/interledger/rafiki/blob/main/tsconfig.build.json

This is actually kinda weird, since some other tsconfigs with comments show the same way: https://github.com/yurtsiv/mermaid/blob/5d4d7c5fbfa21bc9d4974613fb7052144df336e0/todo-fix-root-level-tsconfig.json

while others do not: https://github.com/Ejden/vuetify/blob/1b8a04b9d936ba98d9e37ce711fd49aef53b1213/tsconfig.json

In the ones with red syntax highlighting the comma is at the end of the comment instead of the value. Not sure if thats the cause but prettier forces that on our end and it's just a display issue on github after all.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for digging so deep into this!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After you pointed it out it really bugged me that I wasn't entirely sure why this happens 😆

mkurapov
mkurapov previously approved these changes Jan 23, 2024
@@ -42,7 +42,7 @@
"testcontainers": "^10.5.0",
"tmp": "^0.2.1",
"ts-node": "^10.9.2",
"typescript": "^4.9.5"
"typescript": "^5.3.3"
Copy link
Contributor

@mkurapov mkurapov Jan 23, 2024

Choose a reason for hiding this comment

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

do we actually need to specify this across all of the different packages, or is having it once in the root package.json enough?

@BlairCurrey BlairCurrey requested a review from mkurapov January 24, 2024 15:15
@BlairCurrey BlairCurrey merged commit 8430b2c into main Jan 24, 2024
22 checks passed
@BlairCurrey BlairCurrey deleted the bc/upgrade-ts branch January 24, 2024 15:24
BlairCurrey added a commit that referenced this pull request Jan 24, 2024
chore: upgrade to typescript 5 (#2345)

* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges
BlairCurrey added a commit that referenced this pull request Jan 25, 2024
chore: upgrade to typescript 5 (#2345)

* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges
BlairCurrey added a commit that referenced this pull request Jan 26, 2024
* chore(frontend): update error boundaries to v2

* chore(frontend): update meta to v2

* chore(frontend): update headers to v2

* chore(frontend): update form method to v2

* chore(frontend): update to v2 dev server

* chore(frontend): update server module format to v2

* feat(frontend): typecheck cmd

* fix(frontend): type only import

* feat(frontend): ugprade remix to v2

- upgrades all remix package versions
- fixes breaking v2 change
- removes v2 future flags
- removes skipLibCheck from tsconfig

* feat: add frontend typecheck to ci

* chore(MASE): upgrade routes to remix v2

* chore(MASE): upgrade module format to v2

* chore(MASE): update to v2 dev server

* chore(MASE): update headers to v2

* chore(MASE): update form method to v2

* chore(MASE): update meta to v2

* chore(MASE): update error/catch boundary to v2

* feat(MASE): upgrade remix to v2

* fix(MASE): ts errors

* feat(MASE): add typecheck cmd to ci

* fix(frontend, MASE): remix server start

* fix(MASE): eslint

* refactor(MASE): parseQueryString to URLSearchParams

* Update .github/workflows/lint_test_build.yml

Co-authored-by: Radu-Cristian Popa <[email protected]>

* fix(frontend,MASE): update entry.server request handlers

* chore(MASE): format

* chore(MASE): rm unused quotes route

* Revert "Merge branch 'main' into bc/1464/remix-v2-updates"

This reverts commit f7149aa, reversing
changes made to 41673bb.

* chore: cherry pick merge commit after reverting in f7149aa

chore: upgrade to typescript 5 (#2345)

* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges

* fix(frontend,MASE): mobile view

* fix(frontend): no flash on mobile

* refactor: rework new cookie secure env var

* fix: move env var declaration from dockerfile to compose

* feat(backend): upgrade Rafiki to open payments package v6.5 (#2337)

* feat(backend): upgrade to open payments 6.5

* refactor: one singleton for openApi specs

* chore(deps): update dependency autoprefixer to ^10.4.17 (#2352)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore: update lockfile

* chore: rm extra space

* chore: rm unnecessary eslint ignore

---------

Co-authored-by: Radu-Cristian Popa <[email protected]>
Co-authored-by: Sabine Schaller <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
beniaminmunteanu pushed a commit that referenced this pull request Feb 2, 2024
* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges
beniaminmunteanu pushed a commit that referenced this pull request Feb 2, 2024
* chore(frontend): update error boundaries to v2

* chore(frontend): update meta to v2

* chore(frontend): update headers to v2

* chore(frontend): update form method to v2

* chore(frontend): update to v2 dev server

* chore(frontend): update server module format to v2

* feat(frontend): typecheck cmd

* fix(frontend): type only import

* feat(frontend): ugprade remix to v2

- upgrades all remix package versions
- fixes breaking v2 change
- removes v2 future flags
- removes skipLibCheck from tsconfig

* feat: add frontend typecheck to ci

* chore(MASE): upgrade routes to remix v2

* chore(MASE): upgrade module format to v2

* chore(MASE): update to v2 dev server

* chore(MASE): update headers to v2

* chore(MASE): update form method to v2

* chore(MASE): update meta to v2

* chore(MASE): update error/catch boundary to v2

* feat(MASE): upgrade remix to v2

* fix(MASE): ts errors

* feat(MASE): add typecheck cmd to ci

* fix(frontend, MASE): remix server start

* fix(MASE): eslint

* refactor(MASE): parseQueryString to URLSearchParams

* Update .github/workflows/lint_test_build.yml

Co-authored-by: Radu-Cristian Popa <[email protected]>

* fix(frontend,MASE): update entry.server request handlers

* chore(MASE): format

* chore(MASE): rm unused quotes route

* Revert "Merge branch 'main' into bc/1464/remix-v2-updates"

This reverts commit f7149aa, reversing
changes made to 41673bb.

* chore: cherry pick merge commit after reverting in f7149aa

chore: upgrade to typescript 5 (#2345)

* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges

* fix(frontend,MASE): mobile view

* fix(frontend): no flash on mobile

* refactor: rework new cookie secure env var

* fix: move env var declaration from dockerfile to compose

* feat(backend): upgrade Rafiki to open payments package v6.5 (#2337)

* feat(backend): upgrade to open payments 6.5

* refactor: one singleton for openApi specs

* chore(deps): update dependency autoprefixer to ^10.4.17 (#2352)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore: update lockfile

* chore: rm extra space

* chore: rm unnecessary eslint ignore

---------

Co-authored-by: Radu-Cristian Popa <[email protected]>
Co-authored-by: Sabine Schaller <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
beniaminmunteanu pushed a commit that referenced this pull request Feb 8, 2024
* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges
beniaminmunteanu pushed a commit that referenced this pull request Feb 8, 2024
* chore(frontend): update error boundaries to v2

* chore(frontend): update meta to v2

* chore(frontend): update headers to v2

* chore(frontend): update form method to v2

* chore(frontend): update to v2 dev server

* chore(frontend): update server module format to v2

* feat(frontend): typecheck cmd

* fix(frontend): type only import

* feat(frontend): ugprade remix to v2

- upgrades all remix package versions
- fixes breaking v2 change
- removes v2 future flags
- removes skipLibCheck from tsconfig

* feat: add frontend typecheck to ci

* chore(MASE): upgrade routes to remix v2

* chore(MASE): upgrade module format to v2

* chore(MASE): update to v2 dev server

* chore(MASE): update headers to v2

* chore(MASE): update form method to v2

* chore(MASE): update meta to v2

* chore(MASE): update error/catch boundary to v2

* feat(MASE): upgrade remix to v2

* fix(MASE): ts errors

* feat(MASE): add typecheck cmd to ci

* fix(frontend, MASE): remix server start

* fix(MASE): eslint

* refactor(MASE): parseQueryString to URLSearchParams

* Update .github/workflows/lint_test_build.yml

Co-authored-by: Radu-Cristian Popa <[email protected]>

* fix(frontend,MASE): update entry.server request handlers

* chore(MASE): format

* chore(MASE): rm unused quotes route

* Revert "Merge branch 'main' into bc/1464/remix-v2-updates"

This reverts commit f7149aa, reversing
changes made to 41673bb.

* chore: cherry pick merge commit after reverting in f7149aa

chore: upgrade to typescript 5 (#2345)

* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges

* fix(frontend,MASE): mobile view

* fix(frontend): no flash on mobile

* refactor: rework new cookie secure env var

* fix: move env var declaration from dockerfile to compose

* feat(backend): upgrade Rafiki to open payments package v6.5 (#2337)

* feat(backend): upgrade to open payments 6.5

* refactor: one singleton for openApi specs

* chore(deps): update dependency autoprefixer to ^10.4.17 (#2352)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore: update lockfile

* chore: rm extra space

* chore: rm unnecessary eslint ignore

---------

Co-authored-by: Radu-Cristian Popa <[email protected]>
Co-authored-by: Sabine Schaller <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
njlie pushed a commit that referenced this pull request Feb 29, 2024
* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges
njlie pushed a commit that referenced this pull request Feb 29, 2024
* chore(frontend): update error boundaries to v2

* chore(frontend): update meta to v2

* chore(frontend): update headers to v2

* chore(frontend): update form method to v2

* chore(frontend): update to v2 dev server

* chore(frontend): update server module format to v2

* feat(frontend): typecheck cmd

* fix(frontend): type only import

* feat(frontend): ugprade remix to v2

- upgrades all remix package versions
- fixes breaking v2 change
- removes v2 future flags
- removes skipLibCheck from tsconfig

* feat: add frontend typecheck to ci

* chore(MASE): upgrade routes to remix v2

* chore(MASE): upgrade module format to v2

* chore(MASE): update to v2 dev server

* chore(MASE): update headers to v2

* chore(MASE): update form method to v2

* chore(MASE): update meta to v2

* chore(MASE): update error/catch boundary to v2

* feat(MASE): upgrade remix to v2

* fix(MASE): ts errors

* feat(MASE): add typecheck cmd to ci

* fix(frontend, MASE): remix server start

* fix(MASE): eslint

* refactor(MASE): parseQueryString to URLSearchParams

* Update .github/workflows/lint_test_build.yml

Co-authored-by: Radu-Cristian Popa <[email protected]>

* fix(frontend,MASE): update entry.server request handlers

* chore(MASE): format

* chore(MASE): rm unused quotes route

* Revert "Merge branch 'main' into bc/1464/remix-v2-updates"

This reverts commit f7149aa, reversing
changes made to 41673bb.

* chore: cherry pick merge commit after reverting in f7149aa

chore: upgrade to typescript 5 (#2345)

* feat: upgrade ts to 5.0

* fix(auth): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore(auth): rm unecessary type assertion

* fix(backend): ts2365 build error

fixes Forbidden Implicit Coercions in Relational Operators

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

* chore: rm default tsconfig option

forceConsistentCasingInFileNames defaults to true in ts 5.0

* chore: update package versions

* chore: rm unused optoin

* chore: rm typescript dev dep from pacakges

* fix(frontend,MASE): mobile view

* fix(frontend): no flash on mobile

* refactor: rework new cookie secure env var

* fix: move env var declaration from dockerfile to compose

* feat(backend): upgrade Rafiki to open payments package v6.5 (#2337)

* feat(backend): upgrade to open payments 6.5

* refactor: one singleton for openApi specs

* chore(deps): update dependency autoprefixer to ^10.4.17 (#2352)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore: update lockfile

* chore: rm extra space

* chore: rm unnecessary eslint ignore

---------

Co-authored-by: Radu-Cristian Popa <[email protected]>
Co-authored-by: Sabine Schaller <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: auth Changes in the GNAP auth package. pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. pkg: mock-ase type: source Changes business logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants