Closed nicoabie closed 8 months ago
export type NonEmptyArray<T> = [T, ...T[]]; export type PossiblyEmptyArray<T> = T[];
we can use NonEmptyArray when uses in doing an inner join
ie:
select u.name, p.title, p.content from users u inner join posts p on u.id = p.user_id
would be typed as
{ name: string; posts: NonEmptyArray<{ title: string; content: string; }>; }
and we can use PossiblyEmptyArray when uses in doing an left join
select u.name, p.title, p.content from users u left join posts p on u.id = p.user_id
{ name: string; posts: PossiblyEmptyArray<{ title: string; content: string; }>; }
implemented in #42
we can use NonEmptyArray when uses in doing an inner join
ie:
would be typed as
and we can use PossiblyEmptyArray when uses in doing an left join
ie:
would be typed as