userfront-core icon indicating copy to clipboard operation
userfront-core copied to clipboard

`sendLoginLink` exported return type is wrong

Open moroshko opened this issue 4 years ago • 3 comments

sendLoginLink returns data, but the exported types says it returns void.

Would be great to properly type this function.

Thanks :)

moroshko avatar Oct 28 '21 07:10 moroshko

Updated with @userfront/[email protected]

tyrw avatar Nov 04 '21 20:11 tyrw

@tyrw The updated types do not seem to include possible errors. For example, if you try to login using the email [email protected] the response is:

{
  error: "Bad Request"
  message: "Email format is invalid"
  statusCode: 400
}

which is not assignable to LinkResponse.

moroshko avatar Nov 04 '21 22:11 moroshko

@moroshko Thanks for the follow up. We're on the fence about switching this library over to typescript (JS encourages readability and contributions from those that don't know TS). That said, it would be less prone to issues like this.

We'll try to add the error responses, and if it's starting to look hard to track, will make an issue to convert to TS so these things are all auto-generated.

tyrw avatar Nov 04 '21 22:11 tyrw

Added to Linear, DEV-757

RJFelix avatar Oct 19 '23 17:10 RJFelix