diff --git a/.buildkite/package-lock.json b/.buildkite/package-lock.json
index 763e8fb659c9b7..437e56299cb6c9 100644
--- a/.buildkite/package-lock.json
+++ b/.buildkite/package-lock.json
@@ -24,8 +24,8 @@
"chai": "^4.3.10",
"mocha": "^10.3.0",
"nock": "^12.0.2",
- "ts-node": "^10.7.0",
- "typescript": "^4.6.4"
+ "ts-node": "^10.9.2",
+ "typescript": "^5.1.6"
}
},
"node_modules/@cspotcode/source-map-support": {
@@ -1451,9 +1451,9 @@
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"node_modules/ts-node": {
- "version": "10.8.1",
- "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz",
- "integrity": "sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==",
+ "version": "10.9.2",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
+ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
@@ -1529,16 +1529,16 @@
}
},
"node_modules/typescript": {
- "version": "4.7.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
- "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
+ "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
- "node": ">=4.2.0"
+ "node": ">=14.17"
}
},
"node_modules/universal-user-agent": {
@@ -2707,9 +2707,9 @@
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"ts-node": {
- "version": "10.8.1",
- "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz",
- "integrity": "sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==",
+ "version": "10.9.2",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
+ "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true,
"requires": {
"@cspotcode/source-map-support": "^0.8.0",
@@ -2753,9 +2753,9 @@
"dev": true
},
"typescript": {
- "version": "4.7.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
- "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
+ "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"dev": true
},
"universal-user-agent": {
diff --git a/.buildkite/package.json b/.buildkite/package.json
index be91750b4e7973..efd66f1c17a096 100644
--- a/.buildkite/package.json
+++ b/.buildkite/package.json
@@ -26,8 +26,8 @@
"chai": "^4.3.10",
"mocha": "^10.3.0",
"nock": "^12.0.2",
- "ts-node": "^10.7.0",
- "typescript": "^4.6.4"
+ "ts-node": "^10.9.2",
+ "typescript": "^5.1.6"
},
"imports": {
"#pipeline-utils": "./pipeline-utils/index.ts",
diff --git a/package.json b/package.json
index 753100217f707c..44e4ca7d5157e7 100644
--- a/package.json
+++ b/package.json
@@ -92,7 +92,8 @@
"**/react-intl/**/@types/react": "^17.0.45",
"**/remark-parse/trim": "1.0.1",
"**/sharp": "0.32.6",
- "**/typescript": "4.9.5",
+ "**/typescript": "5.1.6",
+ "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0",
"globby/fast-glob": "^3.2.11"
},
"dependencies": {
@@ -1439,7 +1440,6 @@
"@storybook/node-logger": "^6.5.16",
"@storybook/preview-web": "^6.5.16",
"@storybook/react": "^6.5.16",
- "@storybook/react-docgen-typescript-plugin": "^1.0.1",
"@storybook/testing-react": "^1.3.0",
"@storybook/theming": "^6.5.16",
"@testing-library/jest-dom": "^5.16.5",
@@ -1756,8 +1756,8 @@
"tough-cookie": "^4.1.4",
"tree-kill": "^1.2.2",
"ts-morph": "^15.1.0",
- "tsd": "^0.20.0",
- "typescript": "4.9.5",
+ "tsd": "^0.31.1",
+ "typescript": "5.1.6",
"url-loader": "^2.2.0",
"val-loader": "^1.1.1",
"vinyl-fs": "^4.0.0",
diff --git a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts
index ea69a25e4b56a9..d403eeb31f6a92 100644
--- a/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts
+++ b/packages/core/http/core-http-router-server-internal/src/versioned_router/core_versioned_route.ts
@@ -93,6 +93,7 @@ export class CoreVersionedRoute implements VersionedRoute {
{
path: this.path,
validate: passThroughValidation,
+ // @ts-expect-error upgrade typescript v5.1.6
options: this.getRouteConfigOptions(),
},
this.requestHandler,
diff --git a/packages/core/notifications/core-notifications-browser-internal/src/toasts/global_toast_list.tsx b/packages/core/notifications/core-notifications-browser-internal/src/toasts/global_toast_list.tsx
index 39c1f1edb88895..fd871ded76c50f 100644
--- a/packages/core/notifications/core-notifications-browser-internal/src/toasts/global_toast_list.tsx
+++ b/packages/core/notifications/core-notifications-browser-internal/src/toasts/global_toast_list.tsx
@@ -30,6 +30,7 @@ interface State {
const convertToEui = (toast: ToastWithRichTitle): EuiToast => ({
...toast,
+ // @ts-expect-error upgrade typescript v5.1.6
title: toast.title instanceof Function ? : toast.title,
text: toast.text instanceof Function ? : toast.text,
});
diff --git a/packages/kbn-alerts-ui-shared/src/rule_form/rule_definition/rule_consumer_selection.tsx b/packages/kbn-alerts-ui-shared/src/rule_form/rule_definition/rule_consumer_selection.tsx
index d22a296162a598..72ea6a6b61059e 100644
--- a/packages/kbn-alerts-ui-shared/src/rule_form/rule_definition/rule_consumer_selection.tsx
+++ b/packages/kbn-alerts-ui-shared/src/rule_form/rule_definition/rule_consumer_selection.tsx
@@ -34,7 +34,6 @@ type ComboBoxOption = EuiComboBoxOptionOption;
export const RuleConsumerSelection = (props: RuleConsumerSelectionProps) => {
const { validConsumers } = props;
-
const { multiConsumerSelection, baseErrors } = useRuleFormState();
const dispatch = useRuleFormDispatch();
diff --git a/packages/kbn-es-query/src/es_query/from_filters.ts b/packages/kbn-es-query/src/es_query/from_filters.ts
index 6896825db93aba..a00b44b862b925 100644
--- a/packages/kbn-es-query/src/es_query/from_filters.ts
+++ b/packages/kbn-es-query/src/es_query/from_filters.ts
@@ -36,6 +36,7 @@ const filterNegate = (reverse: boolean) => (filter: Filter) => {
* @return {Object} the query version of that filter
*/
const translateToQuery = (filter: Partial): estypes.QueryDslQueryContainer => {
+ // @ts-expect-error upgrade typescript v5.1.6
return filter.query || filter;
};
diff --git a/packages/kbn-eslint-plugin-i18n/rules/formatted_message_should_start_with_the_right_id.ts b/packages/kbn-eslint-plugin-i18n/rules/formatted_message_should_start_with_the_right_id.ts
index 295b367c398990..e29a7aeb36318b 100644
--- a/packages/kbn-eslint-plugin-i18n/rules/formatted_message_should_start_with_the_right_id.ts
+++ b/packages/kbn-eslint-plugin-i18n/rules/formatted_message_should_start_with_the_right_id.ts
@@ -45,6 +45,7 @@ export const FormattedMessageShouldStartWithTheRightId: Rule.RuleModule = {
idAttribute.value.value;
const i18nAppId = getI18nIdentifierFromFilePath(filename, cwd);
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
diff --git a/packages/kbn-eslint-plugin-i18n/rules/i18n_translate_should_start_with_the_right_id.ts b/packages/kbn-eslint-plugin-i18n/rules/i18n_translate_should_start_with_the_right_id.ts
index 705725e5dd4eb9..4bad8bf6907afc 100644
--- a/packages/kbn-eslint-plugin-i18n/rules/i18n_translate_should_start_with_the_right_id.ts
+++ b/packages/kbn-eslint-plugin-i18n/rules/i18n_translate_should_start_with_the_right_id.ts
@@ -47,6 +47,7 @@ export const I18nTranslateShouldStartWithTheRightId: Rule.RuleModule = {
node.arguments[0].value;
const i18nAppId = getI18nIdentifierFromFilePath(filename, cwd);
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
diff --git a/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_formatted_message.ts b/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_formatted_message.ts
index 87e4350b064e1a..02da7f9f327dd9 100644
--- a/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_formatted_message.ts
+++ b/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_formatted_message.ts
@@ -40,6 +40,7 @@ export const StringsShouldBeTranslatedWithFormattedMessage: Rule.RuleModule = {
if (intent === false) return;
const i18nAppId = getI18nIdentifierFromFilePath(filename, cwd);
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
@@ -107,6 +108,7 @@ export const StringsShouldBeTranslatedWithFormattedMessage: Rule.RuleModule = {
if (intent === false) return;
const i18nAppId = getI18nIdentifierFromFilePath(filename, cwd);
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
diff --git a/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_i18n.ts b/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_i18n.ts
index b78c19fb572012..b48e5444064013 100644
--- a/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_i18n.ts
+++ b/packages/kbn-eslint-plugin-i18n/rules/strings_should_be_translated_with_i18n.ts
@@ -41,6 +41,7 @@ export const StringsShouldBeTranslatedWithI18n: Rule.RuleModule = {
if (intent === false) return;
const i18nAppId = getI18nIdentifierFromFilePath(filename, cwd);
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
@@ -105,6 +106,7 @@ export const StringsShouldBeTranslatedWithI18n: Rule.RuleModule = {
if (intent === false) return;
const i18nAppId = getI18nIdentifierFromFilePath(filename, cwd);
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
diff --git a/packages/kbn-eslint-plugin-telemetry/rules/event_generating_elements_should_be_instrumented.ts b/packages/kbn-eslint-plugin-telemetry/rules/event_generating_elements_should_be_instrumented.ts
index b150b3d696ec51..9f891f5e16ff05 100644
--- a/packages/kbn-eslint-plugin-telemetry/rules/event_generating_elements_should_be_instrumented.ts
+++ b/packages/kbn-eslint-plugin-telemetry/rules/event_generating_elements_should_be_instrumented.ts
@@ -53,6 +53,7 @@ export const EventGeneratingElementsShouldBeInstrumented: Rule.RuleModule = {
}
const hasDataTestSubjProp = checkNodeForExistingDataTestSubjProp(parent, () =>
+ // @ts-expect-error upgrade typescript v5.1.6
sourceCode.getScope(node as TSNode)
);
@@ -69,6 +70,7 @@ export const EventGeneratingElementsShouldBeInstrumented: Rule.RuleModule = {
const appName = getAppName(fileName, cwd);
// 2. Component name
+ // @ts-expect-error upgrade typescript v5.1.6
const functionDeclaration = sourceCode.getScope(node as TSNode)
.block as TSESTree.FunctionDeclaration;
const functionName = getFunctionName(functionDeclaration);
diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/functions.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/functions.ts
index 705876fca743ba..a02a09757d033f 100644
--- a/packages/kbn-esql-validation-autocomplete/src/definitions/functions.ts
+++ b/packages/kbn-esql-validation-autocomplete/src/definitions/functions.ts
@@ -1419,7 +1419,7 @@ const logDefinition: FunctionDefinition = {
// do not really care here about the base and field
// just need to check both values are not negative
for (const arg of fnDef.args) {
- if (isLiteralItem(arg) && arg.value < 0) {
+ if (isLiteralItem(arg) && Number(arg.value) < 0) {
messages.push({
type: 'warning' as const,
code: 'logOfNegativeValue',
@@ -1472,7 +1472,7 @@ const log10Definition: FunctionDefinition = {
// do not really care here about the base and field
// just need to check both values are not negative
for (const arg of fnDef.args) {
- if (isLiteralItem(arg) && arg.value < 0) {
+ if (isLiteralItem(arg) && Number(arg.value) < 0) {
messages.push({
type: 'warning' as const,
code: 'logOfNegativeValue',
diff --git a/packages/kbn-management/settings/components/field_row/description/description.tsx b/packages/kbn-management/settings/components/field_row/description/description.tsx
index 757cb22ba799ca..df1e6f85ecb35f 100644
--- a/packages/kbn-management/settings/components/field_row/description/description.tsx
+++ b/packages/kbn-management/settings/components/field_row/description/description.tsx
@@ -58,6 +58,7 @@ export const FieldDescription = ({
* Justification for dangerouslySetInnerHTML:
* Setting description may contain formatting and links to documentation.
*/
+ /* @ts-expect-error upgrade typescript v5.1.6 */
dangerouslySetInnerHTML={{ __html: content || '' }} // eslint-disable-line react/no-danger
/>
);
diff --git a/packages/kbn-repo-linter/lib/lint_target.ts b/packages/kbn-repo-linter/lib/lint_target.ts
index de16fd85e9b613..bd6d5363c05080 100644
--- a/packages/kbn-repo-linter/lib/lint_target.ts
+++ b/packages/kbn-repo-linter/lib/lint_target.ts
@@ -56,11 +56,11 @@ export abstract class LintTarget {
return this instanceof TsProjectLintTarget;
}
- getTsProject() {
+ getTsProject(): any {
return this.isPackage() || this.isTsProject() ? this.tsProject : undefined;
}
- getPkg() {
+ getPkg(): any {
return this.isPackage() ? this.pkg : undefined;
}
}
diff --git a/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts b/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts
index 72910fbe99fc45..fc48770a87f37e 100644
--- a/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts
+++ b/packages/kbn-telemetry-tools/src/tools/ts_program/ts_program.test.ts
@@ -21,7 +21,7 @@ describe('createKibanaProgram', () => {
"fetch": Object {
"typeDescriptor": Object {
"locale": Object {
- "kind": 152,
+ "kind": 154,
"type": "StringKeyword",
},
},
diff --git a/packages/kbn-telemetry-tools/src/tools/utils.ts b/packages/kbn-telemetry-tools/src/tools/utils.ts
index ff526b82e6c7a0..2e15ea82baaba3 100644
--- a/packages/kbn-telemetry-tools/src/tools/utils.ts
+++ b/packages/kbn-telemetry-tools/src/tools/utils.ts
@@ -145,8 +145,16 @@ export function getResolvedModuleSourceFile(
originalSource: ts.SourceFile,
program: ts.Program,
importedModuleName: string
-) {
- const resolvedModule = (originalSource as any).resolvedModules.get(importedModuleName);
+): ts.SourceFile {
+ // Resolve the module name to get the resolved module name result
+ const resolvedModuleNameResult = ts.resolveModuleName(
+ importedModuleName,
+ originalSource.fileName,
+ program.getCompilerOptions(),
+ ts.sys
+ );
+
+ const resolvedModule = resolvedModuleNameResult.resolvedModule;
if (!resolvedModule) {
throw new Error(
`Import for [${importedModuleName}] in [${originalSource.fileName}] could not be resolved by TypeScript`
diff --git a/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx b/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx
index 08ef78fddd25c1..0f046413a67f95 100644
--- a/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx
+++ b/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx
@@ -265,10 +265,7 @@ export const UserProfilesSelectable =