reference
TypeScript
Full type inference for query results, including joins with aliased columns.
Published: September 6, 2026Updated: September 6, 2026
The SDK is fully typed. Pass your row type as a generic for full IntelliSense:
interface Post {
id: string
title: string
status: 'draft' | 'published'
created_at: string
}
const { data } = await postbase.from<Post>('posts').select('*').eq('status', 'published')
// data is Post[] | nullThis also works with joins — define the type using the aliased key names:
interface ApiWithPlan {
api_id: string
name: string
plan_id: string
plan_name: string
}
const { data } = await postbase
.from<ApiWithPlan>('apis')
.join('pricing_plans', { on: 'apis.pricing_plan_id = pricing_plans.id', type: 'left' })
.select('apis.id as api_id, apis.name, pricing_plans.id as plan_id, pricing_plans.name as plan_name')
// data is ApiWithPlan[] | null