nestjs-filter
Typed query filters from @FilterFor / @ApplyFilter.
If you use nestjs-filter, register
the filter extension. It discovers @ApplyFilter/@FilterFor on your controllers and
adds a typed filterQuery() helper to every matching api.ts leaf, backed by
@dudousxd/nestjs-filter-client.
pnpm add -D @dudousxd/nestjs-filter-codegenimport { nestjsFilterCodegen } from '@dudousxd/nestjs-filter-codegen';
NestjsCodegenModule.forRoot({
contracts: { glob: 'src/**/*.controller.ts' },
codegen: { outDir: 'src/generated' },
extensions: [nestjsFilterCodegen()],
});@Controller('tasks')
export class TasksController {
@Get()
@ApplyFilter(TaskFilter)
list(@FilterFor(TaskFilter) query: FilterQuery) { /* … */ }
}The extension types filterQuery() over the route's filterable fields (with their
resolved types — enums, dates, relations), so building a filter on the client is fully
typed. The leaf exposes it directly:
import { api } from '../lib/api';
const query = api.tasks.list().filterQuery()
.where('status', 'eq', 'open')
.build();
useQuery(api.tasks.list({ query }).queryOptions());It's the same builder as filterQueryTyped() from @dudousxd/nestjs-filter-client, but
pre-typed to the route's fields so you don't repeat the field union by hand.
Field types come from the filter class / @FilterFor parameter — named enums and type
aliases are referenced by name in the generated types.