Let's say for example I have an interface which defines a boolean value and optional string:
Example
interface IError {
error: [boolean, string?];
}
Now later in the code I want to use it:
if (somethingTrue) {
error: [false]
} else {
error: [true, "Error occurred because of foo"]
}
I got this working. However, I would like to add more context to the Interface. The boolean should be named errorOccured and the string should be named message.
Tried
I was thinking about the following:
interface IError {
error: [errorOccured: boolean, message: string?];
}
Might be something obvious that I'm missing, but I just don't get it.