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.
When stubbing out the PlayFab SDK for testing, the callback type needs an object that conforms to this interface:
but
IPlayFabResultCommonalso extendsIPlayFabError. So while I think I should be able to use an object that looks like this: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:
Also, shouldn't the
error,errorCode, anderrorMessageproperties be optional? Those are not returned when the call is successful.