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 typescript to 5.4 #35181

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"to-json-schema": "^0.2.5",
"toposort": "^2.0.2",
"tslib": "^2.3.1",
"typescript": "4.9.5",
"typescript": "5.4",
"unescape-js": "^1.1.4",
"url-search-params-polyfill": "^8.0.0",
"uuid": "^9.0.0",
Expand Down Expand Up @@ -373,7 +373,7 @@
"redux-devtools-extension": "^2.13.8",
"redux-mock-store": "^1.5.4",
"redux-saga-test-plan": "^4.0.6",
"ts-jest": "27.0.0",
"ts-jest": "29.1.0",
"ts-jest-mock-import-meta": "^0.12.0",
"ts-loader": "^9.4.1",
"ts-node": "^10.9.1",
Expand Down
4 changes: 2 additions & 2 deletions app/client/packages/ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"rollup-plugin-generate-package-json": "^3.2.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-typescript2": "^0.32.0",
"typescript": "4.5.5",
"typescript": "5.4",
"unescape-js": "^1.1.4"
},
"devDependencies": {
Expand All @@ -37,6 +37,6 @@
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"jest": "29.0.3",
"ts-jest": "29.0.1"
"ts-jest": "29.1.0"
}
}
10 changes: 9 additions & 1 deletion app/client/packages/design-system/ads/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ module.exports = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"], // Optional: Additional setup
testEnvironment: "jsdom",
transform: {
"^.+\\.(ts|tsx)$": "ts-jest", // Use ts-jest for transforming TypeScript files
"^.+\\.(ts|tsx)$": [
"ts-jest",
{
useESM: true,
tsconfig: {
verbatimModuleSyntax: false,
},
},
], // Use ts-jest for transforming TypeScript files
"\\.(svg)$": "<rootDir>/fileTransformer.js", // Create this file for SVG handling (see below)
},
moduleNameMapper: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export type IconProps = {
wrapperColor?: string;
} & React.HTMLAttributes<HTMLSpanElement>;

export { IconNames };
export type { IconNames };
10 changes: 10 additions & 0 deletions app/client/packages/design-system/theming/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
const { globals } = require("@design-system/widgets-old/jest.config");

module.exports = {
preset: "ts-jest",
roots: ["<rootDir>/src"],
testEnvironment: "jsdom",
globals: {
"ts-jest": {
useESM: true,
tsconfig: {
verbatimModuleSyntax: false,
},
},
},
};
8 changes: 8 additions & 0 deletions app/client/packages/design-system/widgets/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ module.exports = {
"\\.(css)$": "<rootDir>../../../test/__mocks__/styleMock.js",
"@design-system/widgets": "<rootDir>/src/",
},
globals: {
"ts-jest": {
useESM: true,
tsconfig: {
verbatimModuleSyntax: false,
},
},
},
};
10 changes: 9 additions & 1 deletion app/client/packages/dsl/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
module.exports = {
transform: {
"^.+\\.(png|js|ts|tsx)$": "ts-jest",
"^.+\\.(png|js|ts|tsx)$": [
"ts-jest",
{
useESM: true,
tsconfig: {
verbatimModuleSyntax: false,
},
},
],
},
verbose: true,
};
2 changes: 1 addition & 1 deletion app/client/packages/dsl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"rollup-plugin-generate-package-json": "^3.2.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-typescript2": "^0.32.0",
"typescript": "4.5.5"
"typescript": "5.4"
},
"devDependencies": {
"@rollup/plugin-json": "^6.0.0",
Expand Down
4 changes: 2 additions & 2 deletions app/client/packages/rts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"esbuild": "^0.19.4",
"jest": "^29.3.1",
"supertest": "^6.3.3",
"ts-jest": "^29.0.3",
"ts-jest": "29.1.0",
"tsc-alias": "^1.8.2",
"typescript": "4.9.5"
"typescript": "5.4"
}
}
6 changes: 3 additions & 3 deletions app/client/packages/rts/src/controllers/Ast/AstController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class AstController extends BaseController {
} catch (err) {
return super.sendError(
res,
super.serverErrorMessaage,
this.serverErrorMessage,
[err.message],
StatusCodes.INTERNAL_SERVER_ERROR,
);
Expand All @@ -65,7 +65,7 @@ export default class AstController extends BaseController {
} catch (err) {
return super.sendError(
res,
super.serverErrorMessaage,
this.serverErrorMessage,
[err.message],
StatusCodes.INTERNAL_SERVER_ERROR,
);
Expand Down Expand Up @@ -93,7 +93,7 @@ export default class AstController extends BaseController {
} catch (err) {
return super.sendError(
res,
super.serverErrorMessaage,
this.serverErrorMessage,
[err.message],
StatusCodes.INTERNAL_SERVER_ERROR,
);
Expand Down
2 changes: 1 addition & 1 deletion app/client/packages/rts/src/controllers/BaseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ResponseData {
}

export default class BaseController {
serverErrorMessaage = "Something went wrong";
serverErrorMessage = "Something went wrong";
sendResponse(
response: Response,
result?: unknown,
Expand Down
4 changes: 2 additions & 2 deletions app/client/packages/rts/src/controllers/Dsl/DslController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class DSLController extends BaseController {
} catch (err) {
return super.sendError(
res,
super.serverErrorMessaage,
this.serverErrorMessage,
[err.message],
StatusCodes.INTERNAL_SERVER_ERROR,
);
Expand All @@ -28,7 +28,7 @@ export default class DSLController extends BaseController {
} catch (err) {
return super.sendError(
res,
super.serverErrorMessaage,
this.serverErrorMessage,
[err.message],
StatusCodes.INTERNAL_SERVER_ERROR,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class HealthCheckController extends BaseController {
} catch (err) {
return super.sendError(
res,
super.serverErrorMessaage,
this.serverErrorMessage,
[err.message],
StatusCodes.INTERNAL_SERVER_ERROR,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function DocsSearchModal({
className={`${className}`}
data-testid="t--global-search-modal"
>
{/* @ts-expect-error Figure out how to pass string to constant className */}
<ModalBody className={`${className}`}>{children}</ModalBody>
Copy link
Contributor Author

@znamenskii-ilia znamenskii-ilia Jul 30, 2024

Choose a reason for hiding this comment

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

@albinAppsmith after upgrading TS version we get an error that string can't be assigned to constant class name. I suppressed the error for now. May I ask you to check and fix it later when you have time?

</StyledDocsSearchModal>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ function GitConnection({ isImport }: Props) {

return (
<>
{/* @ts-expect-error Figure out how to pass string to constant className */}
<ModalBody className={Classes.GIT_SYNC_MODAL}>
<Container
data-testid="t--git-connection-container"
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ export const removeFalsyEntries = (arr: any[]): any[] => {
* ['Pawan', 'Goku'] -> false
* { name: "Pawan"} -> false
*/
export const isString = (str: any) => {
export const isString = (str: any): str is string => {
return typeof str === "string" || str instanceof String;
};

Expand Down
4 changes: 2 additions & 2 deletions app/client/src/workers/Evaluation/indirectEval.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function indirectEval(script: string) {
/* Indirect eval to prevent local scope access.
Ref. - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#description */
// @ts-expect-error We want evaluation to be done only on global scope and shouldn't have access to any local scope variable.
// Ref. - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#description
return (1, eval)(script);
}
2 changes: 1 addition & 1 deletion app/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"sourceMap": true,
"baseUrl": "./src",
"noFallthroughCasesInSwitch": true,
"importsNotUsedAsValues": "error"
"verbatimModuleSyntax": true
},
"include": ["./src/**/*", "./packages"],
"exclude": ["./packages/rts", "**/node_modules", "**/.*/"]
Expand Down
Loading
Loading