So I have a TypeScript method that yields a structured object:
export interface LoginResult{
success:Boolean,
message:String
}
login():LoginResult{
...
// handle login process
return {
success: successVal,
message: messageVal
}
}
Instead of explicitly defining the interface, I'd prefer to specify the return type inline within the method call. It would look something like this:
login():LoginResult:{success:Boolean, message:String}{
...
// handle login process
return {
success: successVal,
message: messageVal
}
}
I am curious if this is achievable and if so, what would be the correct syntax for it?