© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago
Julius

Inferring query types without queries

Is it possible to infer the type of the data response from a query without instancing a query variable? I'm asking because I had to suppress the ESLint warning for unused variables.

Some of my queries use nested selectors, and I prefer not to write complex types manually.

import { QueryData, SupabaseClient } from '@supabase/supabase-js';
import { ordersSelector } from '../querySelectors';

declare const supabase: SupabaseClient<Database>;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ordersQuery = supabase.from('orders').select(ordersSelector).single();

export type Order = QueryData<typeof _ordersQuery>;
import { QueryData, SupabaseClient } from '@supabase/supabase-js';
import { ordersSelector } from '../querySelectors';

declare const supabase: SupabaseClient<Database>;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ordersQuery = supabase.from('orders').select(ordersSelector).single();

export type Order = QueryData<typeof _ordersQuery>;
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

generating types without supabase-cli?
SupabaseSSupabase / help-and-questions
4y ago
Missing inferred types on supabase-js queries
SupabaseSSupabase / help-and-questions
3mo ago
Query Performance Advisor: no queries detected
SupabaseSSupabase / help-and-questions
2mo ago
Redux Toolkit Query & autogenerated Supabase types
SupabaseSSupabase / help-and-questions
3y ago