TypeScript Integration

The TypeScript TypeSchema integration uses only interfaces to describe the JSON payload. Note TypeScript is a special case since with TypeScript we only describe the JSON payload we don`t actually parse the JSON payload and transform it into actual objects.

DTO

/**
 * A simple student struct
 */
export interface Student {
    firstName?: string
    lastName?: string
    age?: number
}

Integration

const student: Student = JSON.parse('{...}');

const output = JSON.stringify(student);

console.log(output);