Skip to content

Commit

Permalink
add typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Nov 22, 2024
1 parent 8c05e9c commit 7508ec6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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.
8 changes: 8 additions & 0 deletions www/resources/template/integration/typescript_dto.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* A simple student struct
*/
export interface Student {
firstName?: string
lastName?: string
age?: number
}
5 changes: 5 additions & 0 deletions www/resources/template/integration/typescript_integration.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const student: Student = JSON.parse('{...}');

const output = JSON.stringify(student);

console.log(output);

0 comments on commit 7508ec6

Please sign in to comment.