Skip to content

Commit ce85999

Browse files
docs: Update transform date-time example (#1050)
Encourage best-practices by considering nullable properties in the transform function.
1 parent 5bd90b9 commit ce85999

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ By default, openapiTS will generate `updated_at?: string;` because it’s not su
276276
const types = openapiTS(mySchema, {
277277
transform(schemaObject, metadata): string {
278278
if ("format" in schemaObject && schemaObject.format === "date-time") {
279-
return "Date";
279+
return schemaObject.nullable ? "Date | null" : "Date";
280280
}
281281
},
282282
});

0 commit comments

Comments
 (0)