Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e5c7fb9
chore(NA): introduce some ts expect errors for v5.9.3
mistic Oct 20, 2025
80e96b7
chore(NA): add latest ts expected errors
mistic Oct 20, 2025
66dd678
chore(NA): fix extra typecheck failures
mistic Oct 20, 2025
ded9440
Merge branch 'main' into upgrade-typescript-5.9.3
mistic Oct 20, 2025
46c3a9a
Merge branch 'main' into upgrade-typescript-5.9.3
mistic Oct 20, 2025
4788c0f
Merge branch 'main' into upgrade-typescript-5.9.3
mistic Oct 21, 2025
b0b2358
chore(NA): add types annotations
mistic Oct 22, 2025
d2550dd
fix(NA): adjust typecheck
mistic Oct 30, 2025
c176a72
chore(NA): merge and solve conflicts. down zod
mistic Oct 30, 2025
87353c1
fix(NA): types
mistic Oct 30, 2025
d0af48a
fix(NA): task usage
mistic Oct 30, 2025
7da45d0
fix(NA): typecheck
mistic Oct 30, 2025
67d9da3
fix(NA): typecheck requests
mistic Oct 30, 2025
cdc38ec
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine Oct 30, 2025
fc9b511
fix(NA): typecheck for latest zod
mistic Oct 31, 2025
7bb5776
Merge branch 'main' into upgrade-typescript-5.9.3
mistic Oct 31, 2025
492ca9b
chore(NA): merge and solve conflicts with main
mistic Nov 3, 2025
1bec5c5
chore(NA): merge and solve conflicts with main
mistic Nov 4, 2025
b3c6b5e
Merge branch 'main' into upgrade-typescript-5.9.3
mistic Nov 4, 2025
3f47320
fix: resolve TS errors for @obs-ux-management code.
justinkambic Nov 4, 2025
1473e88
Merge branch 'main' into upgrade-typescript-5.9.3
mistic Nov 4, 2025
081f4cc
fix: obs-ux-management ts errors.
justinkambic Nov 4, 2025
c1958fd
Merge remote-tracking branch 'upstream/main' into upgrade-typescript-…
justinkambic Nov 4, 2025
a2c2fa9
Merge branch 'upgrade-typescript-5.9.3' of github.com:mistic/kibana i…
justinkambic Nov 4, 2025
d5aad16
remove ts-expect-error where needed
markov00 Nov 4, 2025
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
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"**/@langchain/core": "^0.3.78",
"**/@langchain/google-common": "^0.2.18",
"**/@types/node": "22.15.3",
"**/@types/prop-types": "15.7.5",
"**/@typescript-eslint/utils": "8.16.0",
"**/chokidar": "^3.5.3",
"**/d3-scale/**/d3-color": "npm:@elastic/kibana-d3-color@2.0.1",
Expand All @@ -91,10 +92,10 @@
"**/langchain": "^0.3.35",
"**/remark-parse/trim": "1.0.1",
"**/sharp": "0.34.4",
"**/typescript": "5.4.5",
"**/typescript": "5.9.3",
"**/util": "^0.12.5",
"**/yauzl": "^3.2.0",
"**/zod": "^3.25.76",
"**/zod": "3.25.76",
"@aws-sdk/client-bedrock-agent-runtime": "^3.879.0",
"@aws-sdk/client-bedrock-runtime": "^3.879.0",
"@aws-sdk/client-kendra": "3.879.0",
Expand Down Expand Up @@ -2008,7 +2009,7 @@
"tree-kill": "^1.2.2",
"ts-morph": "^15.1.0",
"tsd": "^0.33.0",
"typescript": "5.4.5",
"typescript": "5.9.3",
"val-loader": "^6.0.0",
"vinyl-fs": "^4.0.0",
"watchpack": "^1.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('OverlayBannersService', () => {
i18n: i18nServiceMock.createStartContract(),
theme: themeServiceMock.createStartContract(),
uiSettings,
// @ts-expect-error upgrade typescript v5.9.3
userProfile,
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ export const expectBulkGetResult = (
) => ({
type,
id,
// @ts-expect-error upgrade typescript v5.9.3
namespaces: doc._source!.namespaces ?? [doc._source!.namespace] ?? ['default'],
...(doc._source!.originId && { originId: doc._source!.originId }),
...(doc._source!.updated_at && { updated_at: doc._source!.updated_at }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('ES Client - custom user-agent', () => {

afterAll(async () => {
try {
// @ts-expect-error upgrade typescript v5.9.3
await kibanaServer?.shutdown();
} catch (e) {
// trap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ export class ImportResolver {
return Path.resolve(REPO_ROOT, `node_modules/@typescript-eslint/parser/dist/index.js`);
}

// zod migration from v3 to v4
if (req.startsWith('zod/v4')) {
return Path.resolve(REPO_ROOT, `node_modules/zod/v4/index.cjs`);
}
if (req.startsWith('zod') || req.startsWith('zod/v3')) {
return Path.resolve(REPO_ROOT, `node_modules/zod/v3/index.cjs`);
}

// turn root-relative paths into relative paths
if (
req.startsWith('src/') ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ describe(`assertTelemetryPayload`, () => {
{
root: {
properties: {
// @ts-expect-error: TS doesn't allow pass_through with properties, but it may occur during the tests in runtime, so we want to validate this test case.
im_only_passing_through_data: { type: 'pass_through', properties: {} },
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const searchAlerts = ({
total,
querySnapshot: {
request: response?.inspect?.dsl ?? [],
// @ts-expect-error upgrade typescript v5.9.3
response: [JSON.stringify(rawResponse)] ?? [],
},
error: alertsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('useFetchAlertsFieldsQuery', () => {

expect(ReactQuery.useQuery).toHaveBeenCalledWith(expect.objectContaining({ enabled: false }));

// @ts-expect-error upgrade typescript v5.9.3
rerender({ ruleTypeIds: ['apm'] });

expect(ReactQuery.useQuery).toHaveBeenCalledWith(expect.objectContaining({ enabled: true }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const { dotTextTransform } = require('./dot_text');
const { babelTransform } = require('./babel');

module.exports = {
/**
* @type {Record<string, import('./types').Transform>}
*/
TRANSFORMS: {
'.peggy': peggyTransform,
'.text': dotTextTransform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function ColorRanges({
gutterSize="s"
>
{colorRanges.map((colorRange, index) => (
<EuiFlexItem grow={false} key={`${colorRange.end ?? 0 + colorRange.start ?? 0}${index}`}>
<EuiFlexItem grow={false} key={`${colorRange.end} - ${colorRange.start}${index}`}>
<ColorRangeItem
colorRange={colorRange}
dispatch={dispatch}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export function getHelpForAllCommands({
return [
chalk.bold.whiteBright.bgBlack(` ${dedent(command.usage || '') || command.name} `),
` ${indent(dedent(command.description || 'Runs a dev task'), 2)}`,
// @ts-expect-error upgrade typescript v5.9.3
...([indent(options, 2)] || []),
].join('\n');
})
Expand Down
3 changes: 2 additions & 1 deletion src/platform/packages/shared/kbn-dev-utils/src/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import { Transform } from 'stream';

import type File from 'vinyl';
import type { DirectoryFile } from 'vinyl';

interface BufferedFile extends File {
contents: Buffer;
isDirectory(): false;
isDirectory(): this is DirectoryFile;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export const getFieldValue = <TRecord extends DataTableRecord, TField extends st
field: TField & keyof TRecord['flattened']
): TRecord['flattened'][TField] => {
const value = record.flattened[field];
// @ts-expect-error upgrade typescript v5.9.3
return Array.isArray(value) ? value[0] : value;
};
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const deriveValue = (type: SettingType, value: unknown): Value => {
case 'boolean':
return Boolean(value);
case 'array':
return Array.isArray(value) ? value : [value];
return (Array.isArray(value) ? value : [value]) as Value;
default:
return value as string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export function calculateObjectDiff<TBase extends Obj, TCompare extends Obj>(
removedMap[key] = [];
updatedMap[key] = [];
diffRecursive(
// @ts-expect-error upgrade typescript v5.9.3
base[key] as Obj,
// @ts-expect-error upgrade typescript v5.9.3
compare[key] as Obj,
addedMap[key] as Obj,
removedMap[key] as Obj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = (request, options) => {
}

if (request.startsWith('zod/v4/')) {
return resolve.sync(`${request}/index.cjs`, {
return resolve.sync(`zod/v4/index.cjs`, {
basedir: options.basedir,
extensions: options.extensions,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const buildDataViewMock = ({
toMinimalSpec: () => ({}),
} as unknown as DataView;

// @ts-expect-error upgrade typescript v5.9.3
dataView.isTimeBased = () => !!timeFieldName;

return dataView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const combineCompatibleChildrenApis = <ApiType extends unknown, Publishin
const compatibleChildren: Array<Observable<PublishingSubjectType>> = [];
for (const child of Object.values(children)) {
if (isCompatible(child) && isObservable(child[observableKey]))
// @ts-expect-error upgrade typescript v5.9.3
compatibleChildren.push(child[observableKey] as BehaviorSubject<PublishingSubjectType>);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ describe('AlertsDataGrid bulk actions', () => {
return (
<QueryClientProvider client={queryClient} context={AlertsQueryContext}>
<IntlProvider locale="en">
{/* @ts-expect-error upgrade typescript v5.9.3 */}
<AlertsTableContextProvider value={renderContext}>
<AlertsDataGrid {...({ ...props, renderContext } as BaseAlertsDataGridProps)} />
</AlertsTableContextProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export const RuleActionsSettings = (props: RuleActionsSettingsProps) => {
? getDurationUnitValue(action.frequency?.throttle)
: 'h';

// @ts-expect-error upgrade typescript v5.9.3
const [minimumActionThrottle = -1, minimumActionThrottleUnit] = [
intervalNumber,
intervalUnit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "../../../../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [ ]
},
"include": [
"**/*.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const AddData: FC<Props> = ({ addBasePath, features }) => {

AddData.propTypes = {
addBasePath: PropTypes.func.isRequired,
// @ts-expect-error upgrade typescript v5.9.3
features: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const ManageData: FC<Props> = ({ addBasePath, features }) => {
};

ManageData.propTypes = {
// @ts-expect-error upgrade typescript v5.9.3
features: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function TimeIntervalParamEditor({
const helpText = (
<>
{scaledHelpText}
{get(editorConfig, 'interval.help') || selectOptionHelpText}
{editorConfig.interval?.help ?? selectOptionHelpText}
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ export function createVegaRequestHandler(

timeCache.setTimeRange(timeRange);

let dataView: DataView;
let dataView: DataView | undefined;
const firstFilterIndex = filters[0]?.meta.index;
if (firstFilterIndex) {
dataView = await dataViews.get(firstFilterIndex).catch(() => undefined);
try {
dataView = await dataViews.get(firstFilterIndex);
} catch {
// silently catch
}
}

const esQueryConfigs = getEsQueryConfig(uiSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ export const renderEndzoneTooltip =
);
}

return renderValue ? formattedValue : null;
return renderValue ? formattedValue : <></>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import { getForceNowFromUrl } from './get_force_now_from_url';
const originalLocation = window.location;
afterAll(() => {
// @ts-expect-error upgrade typescript v5.9.3
window.location = originalLocation;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ class DataTableFormatClass extends Component<
}
}

// @ts-expect-error upgrade typescript v5.9.3
export const DataTableFormat = withEuiTablePersist(DataTableFormatClass, {
tableId: 'inspectorDataTable',
pageSizeOptions: PAGE_SIZE_OPTIONS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ export class FieldEditor extends PureComponent<FieldEdiorProps, FieldEditorState
redirectAway();
})
.catch(() => {
// @ts-expect-error upgrade typescript v5.9.3
if (oldField) {
indexPattern.fields.update(oldField);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe('test fetchAll', () => {
{ _id: '1', _index: 'logs' },
{ _id: '2', _index: 'logs' },
];
// @ts-expect-error upgrade typescript v5.9.3
searchSource.getField('index')!.isTimeBased = () => false;
const documents = hits.map((hit) => buildDataTableRecord(hit, dataViewMock));
mockFetchDocuments.mockResolvedValue({ records: documents });
Expand All @@ -161,6 +162,7 @@ describe('test fetchAll', () => {

test('should use charts query to fetch total hit count when chart is visible', async () => {
const collect = subjectCollector(subjects.totalHits$);
// @ts-expect-error upgrade typescript v5.9.3
searchSource.getField('index')!.isTimeBased = () => true;
subjects.totalHits$.next({
fetchStatus: FetchStatus.LOADING,
Expand All @@ -183,6 +185,7 @@ describe('test fetchAll', () => {
test('should only fail totalHits$ query not main$ for error from that query', async () => {
const collectTotalHits = subjectCollector(subjects.totalHits$);
const collectMain = subjectCollector(subjects.main$);
// @ts-expect-error upgrade typescript v5.9.3
searchSource.getField('index')!.isTimeBased = () => false;
const hits = [{ _id: '1', _index: 'logs' }];
const documents = hits.map((hit) => buildDataTableRecord(hit, dataViewMock));
Expand Down Expand Up @@ -217,6 +220,7 @@ describe('test fetchAll', () => {

test('should not set COMPLETE if an ERROR has been set on main$', async () => {
const collectMain = subjectCollector(subjects.main$);
// @ts-expect-error upgrade typescript v5.9.3
searchSource.getField('index')!.isTimeBased = () => false;
mockFetchDocuments.mockRejectedValue({ msg: 'This query failed' });
subjects.totalHits$.next({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('Test discover app state container', () => {
const toasts = discoverServiceMock.core.notifications.toasts;
stateStorage = createKbnUrlStateStorage({
useHash: storeInSessionStorage,
// @ts-expect-error upgrade typescript v5.9.3
history,
...(toasts && withNotifyOnErrors(toasts)),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ const getFieldValues = <TRecord extends DataTableRecord, TField extends string>(
field: TField & keyof TRecord['flattened']
): TRecord['flattened'][TField][] => {
const value = record.flattened[field];
return Array.isArray(value) ? value : [value];
return (Array.isArray(value) ? value : [value]) as TRecord['flattened'][TField][];
};
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ export class Execution<
if (completionFlag && hash) {
const sideEffectResult = this.#getSideEffectFn(fn, args);
while (this.functionCache.size >= maxCacheSize) {
this.functionCache.delete(this.functionCache.keys().next().value);
const nextValue = this.functionCache.keys().next()?.value;
if (typeof nextValue === 'string') this.functionCache.delete(nextValue);
}
this.functionCache.set(hash, {
value: lastValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ describe('Executor', () => {
it('caches the result of function', async () => {
await executor.run('theme size default=12', null, { allowCache: true }).toPromise();
expect(functionCache.size).toEqual(1);
const entry = functionCache.keys().next().value;
// non-null assertion true by construction
const entry = functionCache.keys().next().value!;
functionCache.set(entry, fakeCacheEntry);
const result = await executor
.run('theme size default=12', null, { allowCache: true })
Expand All @@ -347,7 +348,8 @@ describe('Executor', () => {
it('doesnt cache if allowCache flag is false', async () => {
await executor.run('theme size default=12', null, { allowCache: true }).toPromise();
expect(functionCache.size).toEqual(1);
const entry = functionCache.keys().next().value;
// non-null assertion true by construction
const entry = functionCache.keys().next().value!;
functionCache.set(entry, fakeCacheEntry);
const result = await executor
.run('theme size default=12', null, { allowCache: false })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe('useExpressionRenderer', () => {
} as unknown as typeof expressionLoader;

expressionLoaderSpy.mockImplementation(() => expressionLoader);
hook = renderHook(
(params: ExpressionRendererParams) => useExpressionRenderer(nodeRef, params),
hook = renderHook<ReturnType<typeof useExpressionRenderer>, ExpressionRendererParams>(
(params) => useExpressionRenderer(nodeRef, params),
{ initialProps: { expression: 'something' } }
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ describe('TopNavMenu', () => {
const refresh = () => {
new Promise(async (resolve, reject) => {
try {
// @ts-expect-error upgrade typescript v5.9.3
if (dom) {
act(() => {
dom.update();
});
}

// @ts-expect-error upgrade typescript v5.9.3
setImmediate(() => resolve(dom)); // flushes any pending promises
} catch (error) {
reject(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ class SavedObjectFinderUiClass extends React.Component<
}
}

// @ts-expect-error upgrade typescript v5.9.3
export const SavedObjectFinderUi = withEuiTablePersist(SavedObjectFinderUiClass, {
get: (props) => ({
tableId: `soFinder-${props.id}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class UiActionsExecutionService {
},
alwaysShowPopup?: boolean
): Promise<void> {
// @ts-expect-error upgrade typescript v5.9.3
const shouldBatch = !(await action.shouldAutoExecute?.({ ...context, trigger })) ?? false;
const task: ExecuteActionTask = {
action,
Expand Down
Loading