elastic/kibana
Vedi su GitHub[saved objects] Improve type safety in the saved objects repository
Open
#239.468 aperta il 17 ott 2025
Feature:Saved ObjectsTeam:Coregood first issue💝community
Metriche repository
- Star
- (19.065 star)
- Metriche merge PR
- (Merge medio 1g 16h) (999 PR mergiate in 30 g)
Descrizione
The is an existing pattern of using // @ts-expect-error MultiGetHit._source is optional comments in the saved object repository code that weakens the type safety.
We should use a type guard instead
/**
* Type guard to check if an item is a GetGetResult.
*/
export function isGetGetResult<TDocument = unknown>(
item: MgetResponseItem<TDocument>
): item is GetGetResult<TDocument> {
return (item as MgetMultiGetError).error === undefined;
}
Originally posted by @rudolf in https://github.com/elastic/kibana/pull/224411#discussion_r2348988329