Skip to content

Commit 7d42b3d

Browse files
bean property path extension: have get return a non-nullable string
1 parent 7a6317b commit 7d42b3d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

typescript-generator-core/src/main/java/cz/habarta/typescript/generator/ext/BeanPropertyPathExtension.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ private static void emitFieldsClass(Writer writer, Settings settings) {
5252
List<String> fieldsClassLines = Arrays.asList(
5353
"class Fields {",
5454
" protected $$parent: Fields | undefined;",
55-
" protected $$name: string | undefined;",
55+
" protected $$name: string;",
5656
" constructor(parent?: Fields, name?: string) {",
5757
" this.$$parent = parent;",
58-
" this.$$name = name;",
58+
" this.$$name = name || '';",
5959
" };",
60-
" get(): string | undefined {",
61-
" if (this.$$parent && this.$$parent.get()) {",
62-
" return this.$$name ? this.$$parent.get() + \".\" + this.$$name : this.$$parent.get();",
60+
" get(): string {",
61+
" if (this.$$parent && this.$$parent.get().length > 0) {",
62+
" return this.$$parent.get() + \".\" + this.$$name;",
6363
" } else {",
6464
" return this.$$name;",
6565
" }",

0 commit comments

Comments
 (0)