Skip to content

Commit 4869766

Browse files
fairkingManweill
authored andcommitted
Creating objects with strong type validation #153
1 parent 65b25f5 commit 4869766

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/templates/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export function classTemplate(
8080
)
8181
.join('')}
8282
83-
constructor(data: (undefined | any) = {}){
84-
${props.map(p => classConstructorTemplate(p.name)).join('')}
83+
constructor(data: ${name} = {}){
84+
Object.assign(this, data);
8585
}
8686
${generateValidationModel ? classValidationModelTemplate(props) : ''}
8787
}

0 commit comments

Comments
 (0)