Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Should the IPlayFabResultCommon interface extend the IPlayFabError interface? #118

Open
marcjordan opened this issue May 24, 2022 · 0 comments

Comments

@marcjordan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant