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

TypeScript: set type for body of reponse #18

Closed
Fiszcz opened this issue Nov 7, 2020 · 1 comment · Fixed by #19
Closed

TypeScript: set type for body of reponse #18

Fiszcz opened this issue Nov 7, 2020 · 1 comment · Fixed by #19
Assignees
Labels
enhancement New feature or request released

Comments

@Fiszcz
Copy link
Collaborator

Fiszcz commented Nov 7, 2020

We could add the possibility to set type for body content of response.

For example for this example mock:

const getUsersMock = mockiavelli.mockGET('/api/users', {
    status: 200,
    body: [
        { id: 123, name: 'John Doe' },
        { id: 456, name: 'Mary Jane' },
    ],
});

programmer would set type of body content:

const getUsersMock = mockiavelli.mockGET<User[]>('/api/users', {
    status: 200,
    body: [
        { id: 123, name: 'John Doe' },
        { id: 456, name: 'Mary Jane' },
    ],
});

It will help find some changes in interfaces and fast fix changes in mocked responses.

Of course generic parameter will be optional.

@Fiszcz Fiszcz self-assigned this Nov 7, 2020
@Fiszcz Fiszcz added the enhancement New feature or request label Nov 7, 2020
Fiszcz added a commit to Fiszcz/mockiavelli that referenced this issue Nov 7, 2020
Fiszcz added a commit to Fiszcz/mockiavelli that referenced this issue Nov 7, 2020
@Fiszcz Fiszcz linked a pull request Nov 7, 2020 that will close this issue
Fiszcz added a commit to Fiszcz/mockiavelli that referenced this issue Nov 14, 2020
@github-actions
Copy link

github-actions bot commented Mar 5, 2021

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant