Skip to content

Commit 55f03e0

Browse files
mydeas1gr1d
andauthored
build: Update to typescript 5.8.0 (#17710)
This updates the TS version we use to 5.8.0. We still downlevel to 3.8 so this should not be breaking (even if we were to use newer features eventually), downlevel-dts will fail/or our tests anyhow if we use some features that cannot be downlevelled. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Upgrade TypeScript to 5.8 across the repo, adjust tsconfigs and deps, and fix minor type issues to satisfy stricter checks. > > - **Tooling/Versions**: > - Bump `typescript` to `~5.8.0` and update version guard in `scripts/verify-packages-versions.js`. > - Update `yarn.lock` and package constraints; add new e2e app `dev-packages/e2e-tests/test-applications/generic-ts5.0`. > - **TS Configs**: > - Add `moduleResolution: "Node16"` in multiple `tsconfig.json` files and test configs. > - Add `@types/node` and include `"node"` in `types` where needed (e.g., Hydrogen test app). > - **Type/Code Adjustments**: > - Remove unnecessary casts and add explicit non-null assertions for `Map.keys().next().value`. > - Simplify handler registration (`handlers[type].push(handler)`), and minor TS cleanups in profiling/LRU/debug-id utilities. > - Cloudflare/Nuxt/SvelteKit: relax Request typing and use `@ts-expect-error` for `cf` init property; avoid unused CF type import. > - Next.js webpack: remove unnecessary non-null assertion when joining `appDirPath`. > - Remix: streamline FormData attribute handling and vendor instrumentation check. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5ec5959. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: s1gr1d <[email protected]>
1 parent af83b87 commit 55f03e0

File tree

32 files changed

+85
-38
lines changed

32 files changed

+85
-38
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@sentry:registry=http://127.0.0.1:4873
2+
@sentry-internal:registry=http://127.0.0.1:4873
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as _SentryReplay from '@sentry-internal/replay';
2+
import * as _SentryBrowser from '@sentry/browser';
3+
import * as _SentryCore from '@sentry/core';
4+
import * as _SentryNode from '@sentry/node';
5+
import * as _SentryWasm from '@sentry/wasm';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "@sentry-internal/ts5.0-test",
3+
"private": true,
4+
"license": "MIT",
5+
"scripts": {
6+
"build:types": "pnpm run type-check",
7+
"ts-version": "tsc --version",
8+
"type-check": "tsc --project tsconfig.json",
9+
"test:build": "pnpm install && pnpm run build:types",
10+
"test:assert": "pnpm -v"
11+
},
12+
"devDependencies": {
13+
"typescript": "5.0.2",
14+
"@types/node": "^18.19.1"
15+
},
16+
"dependencies": {
17+
"@sentry/browser": "latest || *",
18+
"@sentry/core": "latest || *",
19+
"@sentry/node": "latest || *",
20+
"@sentry-internal/replay": "latest || *",
21+
"@sentry/wasm": "latest || *"
22+
},
23+
"volta": {
24+
"extends": "../../package.json"
25+
}
26+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"include": ["index.ts"],
3+
"compilerOptions": {
4+
"lib": ["es2018", "DOM"],
5+
"skipLibCheck": false,
6+
"noEmit": true,
7+
"types": [],
8+
"target": "es2018",
9+
"moduleResolution": "node"
10+
}
11+
}

dev-packages/e2e-tests/test-applications/hydrogen-react-router-7/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@total-typescript/ts-reset": "^0.4.2",
4242
"@types/eslint": "^8.4.10",
4343
"@types/react": "^18.2.22",
44+
"@types/node": "^18.19.1",
4445
"@types/react-dom": "^18.2.7",
4546
"esbuild": "0.25.0",
4647
"eslint": "^9.18.0",

dev-packages/e2e-tests/test-applications/hydrogen-react-router-7/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"forceConsistentCasingInFileNames": true,
1515
"skipLibCheck": true,
1616
"baseUrl": ".",
17-
"types": ["@shopify/oxygen-workers-types"],
17+
"types": ["@shopify/oxygen-workers-types", "node"],
1818
"paths": {
1919
"~/*": ["app/*"]
2020
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
"size-limit": "~11.1.6",
136136
"sucrase": "^3.35.0",
137137
"ts-node": "10.9.1",
138-
"typescript": "~5.0.0",
138+
"typescript": "~5.8.0",
139139
"vitest": "^3.2.4",
140140
"yalc": "^1.0.0-pre.53",
141141
"yarn-deduplicate": "6.0.2"

packages/browser-utils/src/metrics/instrument.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ function instrumentPerformanceObserver(type: InstrumentHandlerTypePerformanceObs
301301

302302
function addHandler(type: InstrumentHandlerType, handler: InstrumentHandlerCallback): void {
303303
handlers[type] = handlers[type] || [];
304-
(handlers[type] as InstrumentHandlerCallback[]).push(handler);
304+
handlers[type].push(handler);
305305
}
306306

307307
// Get a callback which can be called to remove the instrumentation handler

packages/browser/src/profiling/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,8 @@ export function addProfileToGlobalCache(profile_id: string, profile: JSSelfProfi
564564
PROFILE_MAP.set(profile_id, profile);
565565

566566
if (PROFILE_MAP.size > 30) {
567-
const last: string = PROFILE_MAP.keys().next().value;
567+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
568+
const last = PROFILE_MAP.keys().next().value!;
568569
PROFILE_MAP.delete(last);
569570
}
570571
}

packages/core/src/instrument/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const instrumented: { [key in InstrumentHandlerType]?: boolean } = {};
2121
/** Add a handler function. */
2222
export function addHandler(type: InstrumentHandlerType, handler: InstrumentHandlerCallback): void {
2323
handlers[type] = handlers[type] || [];
24-
(handlers[type] as InstrumentHandlerCallback[]).push(handler);
24+
handlers[type].push(handler);
2525
}
2626

2727
/**

0 commit comments

Comments
 (0)