Vovk.ts 2.1 - NextResponse.json type inferrence

Vovk.ts 2.1 is a small but important type update that gives additional flexibility using NextResponse when you need to define headers, cookies and oher options dynamically. Starting this version standard NextResponse.json can be used with proper type inferrence without requirement to override the return type of a client method.

/src/modules/hello-world/HelloWorldController.ts
import { get, HttpStatus } from 'vovk';
import { NextResponse } from 'next/server';
 
export default class HelloWorldController {
    @get()
    static async helloWorld(/* ... */) {
        // ...
        return NextResponse.json({ hello: 'World' }, { 
            status: HttpStatus.OK, 
            headers: { 'x-custom-header': 'value' } 
        });
    }
// ...

Client code:

import { HelloWorldController } from 'vovk-client';
 
// ...
const response = await HelloWorldController.helloWorld(); // response type is inferred as { hello: string }