You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hilla (correctly) tries to map Map<String,String> to TS Record<string,string> however since the class being mapped here is a Record, it tries to extend it and causes name clashes with TS Record.
Versions:
- Vaadin / Hilla version: Hilla 1.3.2
- Node version: v18.10.0
- Java version: 17
- OS version: macOS 13.1
- Browser version (if applicable):
- Application Server (if applicable):
- IDE/Editor (if applicable): IntelliJ IDEA
The text was updated successfully, but these errors were encountered:
@VerebG, thanks for your suggestion. But my problem is not related to not-null and undefined.
Hilla generates TS interfaces for every superclass to preserve inheritance semantics. In case my case, since every record is a subclass of java.lang.Record Hilla generates a Record TS interface. The name Record interferes with the built-in TS type Record<any,any>1 which is used to denote a Map-like structure.
Understand. Probably I saw same things between my and your problem, but now I recognised this is not same :)
For my case is connecting to Map<> but in the funcation return:
public @Nonnull Map<@Nonnull String, @Nonnull List<@Nonnull LogEntryDto>> getAllEntry() {}
If I not putting @nonnull annotation every keyword, Hilla generator putting '| undifined' to endpoint while the funcation return value never should be null.
Description of the bug
Using a Java Record with a
Map<String,String
field as the input/output of an endpoint, produces invalid TypeScript definitions.Minimal reproducible example
Expected behavior
Expected TS code
Since it's a JVM Record, no need to create another empty interface
Record
and extend it.Actual behaviour
Generated TS code
Hilla (correctly) tries to map
Map<String,String>
to TSRecord<string,string>
however since the class being mapped here is aRecord
, it tries to extend it and causes name clashes with TSRecord
.Versions:
The text was updated successfully, but these errors were encountered: