with my generated endpoint ‘ServiceA’ that i have decorated with @BrowserCallable and @Service. I am seeing that my type T that is returned from function A in Service A has the generated type of List | undefined) : undefined. im unsure why the type is undefined as i dont return null from the service. i have seen other examples where there is no return type of undefiend. anyone ran into same problem ? thanks
Did you add NonNull annotations?
thanks for the input. i have since added the Nonnull import from jakarta, but seems to have the seem result as before. From my Java class the return type is a List, but when setting state using react, type MyTYPE is not assignable to (MyType | undefined). i can get the data no problem… <:typescript:784303298127593492>
See here for documentation on the feature: https://hilla.dev/docs/react/reference/type-nullability
As for the latest issue you’re seeing, you also need to add NonNull to the generic type parameter of your List return type:
@Nonnull
public List<@NonNull MyType> list() {
}
If you find dealing with nullability too much of a hassle you can also declare everything in a package as non-null: https://hilla.dev/docs/react/reference/type-nullability#nonnullapi
thanks so much!! it was the @Nonnull on the type! cheers guys!