Nullable ts fields

This commit is contained in:
Tobe O 2018-03-30 00:16:04 -04:00
parent ea88a84e5d
commit c02c95344c
5 changed files with 18 additions and 15 deletions

View file

@ -1,3 +1,6 @@
# 2.0.4
* Fields in TypeScript definitions are now nullable by default.
# 2.0.3
* Added a `TypeScriptDefinitionBuilder`.

View file

@ -144,7 +144,7 @@ class TypeScriptDefinitionBuilder implements Builder {
field.name, field.type, ext, buildStep);
// foo: string;
buf.writeln('$alias: $typeScriptType;');
buf.writeln('$alias?: $typeScriptType;');
}
buf

View file

@ -1,5 +1,5 @@
name: angel_serialize_generator
version: 2.0.3
version: 2.0.4
description: Model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/serialize

View file

@ -1,9 +1,9 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
interface Library {
id: string;
collection: BookCollection;
created_at: any;
updated_at: any;
id?: string;
collection?: BookCollection;
created_at?: any;
updated_at?: any;
}
interface BookCollection {
[key: string]: Book;

View file

@ -1,12 +1,12 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
interface Book {
id: string;
author: string;
title: string;
description: string;
page_count: number;
not_models: any[];
camelCase: string;
created_at: any;
updated_at: any;
id?: string;
author?: string;
title?: string;
description?: string;
page_count?: number;
not_models?: any[];
camelCase?: string;
created_at?: any;
updated_at?: any;
}