data becomes never[] when destructuring with a fallback value

DDani;10/13/2022
Currently it doesn't seem possible to set a fallback value on a destructured data property, for example:

const { data = []  } = trpc.useQuery(['company.listIds']);
// expecting data to be the inferred type { id: string }[] but instead it's never[] 


// This somehow works
const query = trpc.useQuery(['company.listIds']);
const { data = [] } = query;
// data is correctly typed as { id: string }[]

The "equivalent" with pure react-query:
interface Company {
  id: string;
}
const { data = [] } = useQuery<Company[]>(['company.listIds'], someFetchFunction);
// data is correctly typed as Company[]


Does anyone know if there's a way to achieve the same behaviour of react-query in @trpc/react?
UUUnknown User10/13/2022
Message Not Public
Sign In & Join Server To View
DDani;10/13/2022
Tried this, while the actual data value at runtime is an array, the type is still
{ id: string }[] | undefined
UUUnknown User10/13/2022
2 Messages Not Public
Sign In & Join Server To View
DDani;10/13/2022
Hm that makes sense, this also seems to be the behaviour with react-query
DDani;10/13/2022
Nope, keepPreviousData doesn't change the type
UUUnknown User10/13/2022
10 Messages Not Public
Sign In & Join Server To View
A/Kalex / KATT10/13/2022
Interesting, maybe we need overloads too then