[Question] Should the IPlayFabResultCommon interface extend the IPlayFabError interface?
Opened this issue · 0 comments
marcjordan commented
When stubbing out the PlayFab SDK for testing, the callback type needs an object that conforms to this interface:
export interface IPlayFabSuccessContainer<TResult extends IPlayFabResultCommon> extends IPlayFabError {
data: TResult;
}
but IPlayFabResultCommon
also extends IPlayFabError
. So while I think I should be able to use an object that looks like this:
{
code: 200,
status: 'OK',
error: '',
errorCode: 0,
errorMessage: ''
data: {
Data: {}
}
}
I'm having to build an object that looks like this in order to get Typescript to allow it as a parameter to the ApiCallback function:
{
code: 200,
status: 'OK',
error: '',
errorCode: 0,
errorMessage: ''
data: {
code: 200,
status: 'OK'
error: '',
errorCode: 0,
errorMessage: '',
Data: {}
}
}
Also, shouldn't the error
, errorCode
, and errorMessage
properties be optional? Those are not returned when the call is successful.