Update to TypeScript 6.0 (#43141)

<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [ ] QA'd all new/changed functionality manually
This commit is contained in:
Ian Littman 2026-04-09 08:28:59 -05:00 committed by GitHub
parent f64f0697ce
commit f829170923
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 51 additions and 40 deletions

1
changes/ts6 Normal file
View file

@ -0,0 +1 @@
* Upgraded to TypeScript 6.0 for the app frontend.

View file

@ -24,9 +24,9 @@
"msw": "^1.1.0",
"sass-loader": "^13.2.0",
"style-loader": "^3.3.1",
"ts-jest": "^29.0.5",
"ts-jest": "^29.4.9",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"typescript": "^6.0.2",
"webpack": "^5.105.0",
"webpack-cli": "^5.0.1",
"webpack-merge": "^5.8.0"
@ -6629,9 +6629,9 @@
}
},
"node_modules/semver": {
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"version": "7.7.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
"dev": true,
"license": "ISC",
"bin": {
@ -7110,19 +7110,19 @@
"dev": true
},
"node_modules/ts-jest": {
"version": "29.4.6",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.4.6.tgz",
"integrity": "sha512-fSpWtOO/1AjSNQguk43hb/JCo16oJDnMJf3CdEGNkqsEX3t0KX96xvyX1D7PfLCpVoKu4MfVrqUkFyblYoY4lA==",
"version": "29.4.9",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.4.9.tgz",
"integrity": "sha512-LTb9496gYPMCqjeDLdPrKuXtncudeV1yRZnF4Wo5l3SFi0RYEnYRNgMrFIdg+FHvfzjCyQk1cLncWVqiSX+EvQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"bs-logger": "^0.2.6",
"fast-json-stable-stringify": "^2.1.0",
"handlebars": "^4.7.8",
"handlebars": "^4.7.9",
"json5": "^2.2.3",
"lodash.memoize": "^4.1.2",
"make-error": "^1.3.6",
"semver": "^7.7.3",
"semver": "^7.7.4",
"type-fest": "^4.41.0",
"yargs-parser": "^21.1.1"
},
@ -7139,7 +7139,7 @@
"babel-jest": "^29.0.0 || ^30.0.0",
"jest": "^29.0.0 || ^30.0.0",
"jest-util": "^29.0.0 || ^30.0.0",
"typescript": ">=4.3 <6"
"typescript": ">=4.3 <7"
},
"peerDependenciesMeta": {
"@babel/core": {
@ -7218,16 +7218,17 @@
}
},
"node_modules/typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz",
"integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
"node": ">=14.17"
}
},
"node_modules/uglify-js": {

View file

@ -19,9 +19,9 @@
"msw": "^1.1.0",
"sass-loader": "^13.2.0",
"style-loader": "^3.3.1",
"ts-jest": "^29.0.5",
"ts-jest": "^29.4.9",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"typescript": "^6.0.2",
"webpack": "^5.105.0",
"webpack-cli": "^5.0.1",
"webpack-merge": "^5.8.0"

View file

@ -8,14 +8,14 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
export const handlers = [
// Return the actual webassembly file
rest.get(/\/wa-sqlite-async.wasm$/, (_req, res, ctx) => {
rest.get(/\/wa-sqlite-async\.wasm$/, (_req, res, ctx) => {
const wasm = readFileSync(
__dirname + "/../../node_modules/wa-sqlite/dist/wa-sqlite-async.wasm"
);
return res(
ctx.status(200),
ctx.set("Content-Type", "application/wasm"),
ctx.body(wasm)
ctx.body(new Uint8Array(wasm))
);
}),
];

View file

@ -3,16 +3,16 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react",
"lib": [
"es2020",
"dom"
],
"lib": ["es2020", "dom"],
"module": "es2020",
"moduleResolution": "node",
"moduleResolution": "bundler",
"outDir": "dist/js",
"rootDir": "src",
"sourceMap": true,
"target": "es2015"
"skipLibCheck": true,
"strict": false,
"target": "es2015",
"types": ["chrome", "jest", "node"]
},
"exclude": [
"node_modules",

View file

@ -53,6 +53,8 @@ const ActionButton = (buttonProps: IActionButtonProps): JSX.Element | null => {
isDisabled,
tooltipContent,
} = buttonProps;
const resolvedButtonText =
typeof buttonText === "function" ? buttonText(targetIds) : buttonText;
const onButtonClick = useActionCallback(onClick || noop);
// hideButton is intended to provide a flexible way to specify show/hide conditions via a boolean or a function that evaluates to a boolean
@ -88,7 +90,7 @@ const ActionButton = (buttonProps: IActionButtonProps): JSX.Element | null => {
{iconPosition === "left" && iconSvg && (
<Icon name={iconSvg} color={iconColor} />
)}
{buttonText}
{resolvedButtonText}
{iconPosition !== "left" && iconSvg && (
<Icon name={iconSvg} color={iconColor} />
)}

View file

@ -319,6 +319,10 @@ const TableContainer = <T,>({
const renderFilterActionButton = () => {
// always !!actionButton here, this is for type checker
if (actionButton) {
const resolvedButtonText =
typeof actionButton.buttonText === "function"
? actionButton.buttonText(actionButton.targetIds ?? [])
: actionButton.buttonText;
const button = (
<Button
disabled={
@ -329,7 +333,7 @@ const TableContainer = <T,>({
className={`${baseClass}__table-action-button`}
>
<>
{actionButton.buttonText}
{resolvedButtonText}
{actionButton.iconSvg && (
<Icon
name={actionButton.iconSvg}

View file

@ -7,7 +7,7 @@ import {
RenderResult,
waitFor,
} from "@testing-library/react";
import type { UserEvent } from "@testing-library/user-event/dist/types/setup/setup";
import type { UserEvent } from "@testing-library/user-event";
import userEvent from "@testing-library/user-event";
import { QueryClient, QueryClientProvider } from "react-query";

View file

@ -99,7 +99,7 @@
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "15.0.2",
"@testing-library/user-event": "14.5.2",
"@tsconfig/recommended": "1.0.1",
"@tsconfig/recommended": "^1.0.13",
"@types/chrome": "0.0.237",
"@types/classnames": "0.0.32",
"@types/content-disposition": "0.5.4",
@ -170,7 +170,7 @@
"storybook": "8.6.17",
"trace-unhandled": "2.0.1",
"ts-loader": "6.2.2",
"typescript": "4.7",
"typescript": "^6.0.2",
"webpack": "5.105.0",
"webpack-cli": "5.0.1",
"webpack-notifier": "1.12.0"

View file

@ -1,15 +1,18 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"compilerOptions": {
"baseUrl": "./frontend",
"target": "ES2019",
"moduleResolution": "bundler",
"noUncheckedSideEffectImports": false,
"sourceMap": true,
"jsx": "react",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"lib": ["ES2021.String", "ES2020.Promise"],
"types": ["*"],
"paths": {
"node-sql-parser": ["../node_modules/@sgress454/node-sql-parser"]
"*": ["./frontend/*"],
"node-sql-parser": ["./node_modules/@sgress454/node-sql-parser"]
}
},
"include": ["./frontend/**/*"],

View file

@ -2754,10 +2754,10 @@
resolved "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.2.tgz"
integrity sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==
"@tsconfig/recommended@1.0.1":
version "1.0.1"
resolved "https://registry.npmjs.org/@tsconfig/recommended/-/recommended-1.0.1.tgz"
integrity sha512-2xN+iGTbPBEzGSnVp/Hd64vKJCJWxsi9gfs88x4PPMyEjHJoA3o5BY9r5OLPHIZU2pAQxkSAsJFqn6itClP8mQ==
"@tsconfig/recommended@^1.0.13":
version "1.0.13"
resolved "https://registry.yarnpkg.com/@tsconfig/recommended/-/recommended-1.0.13.tgz#269fce3ad04ca70b93269ff44cca81b950f542da"
integrity sha512-sySRuBfMKyKO/j2ZAhR8kSembhjuPEV4Ra3AHtmWLq51+iGaudr45crPSzNC5b7/Ctrh9dfUpBuTlYrH6rM58Q==
"@types/aria-query@^5.0.1":
version "5.0.4"
@ -11282,10 +11282,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
typescript@4.7:
version "4.7.4"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==
typescript@^6.0.2:
version "6.0.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.2.tgz#0b1bfb15f68c64b97032f3d78abbf98bdbba501f"
integrity sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==
unbox-primitive@^1.1.0:
version "1.1.0"