-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
4.15
-
None
-
Quality / Stability / Reliability
-
False
-
-
None
-
Low
-
No
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
`useK8sWatchResource` return type is incorrect.
export const useK8sWatchResource = <R extends K8sResourceCommon | K8sResourceCommon[]>( initResource: WatchK8sResource | null, initModel?: K8sModelCommon, options?: Partial<WebSocketOptions & RequestInit & { wsPrefix?: string; pathPrefix?: string }>, ): WatchK8sResult<R> => { export type WatchK8sResult<R extends K8sResourceCommon | K8sResourceCommon[]> = [ data: R, loaded: boolean, loadError: unknown, ];
`WatchK8sResult['data']` is of type `R`. However, the value of data may be `undefined` at times.
The affect of this is null checks may be missed. Or if eslint rules are in place may inform the dev that a correctly placed null check is unnecessary because the type can never be undefined.
The type for `useK8sWatchResource` should be updated to account for data possibly being `undefined`. This change needs to be applied in the dynamic-plugin-sdk.