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

fix(types): support optional path parameters #2368

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

kettanaito
Copy link
Member

@kettanaito kettanaito commented Nov 22, 2024

Changes

  • MSW now allows to describe optional path parameters (previously a type error—all parameters were expected to be non-nullable):
// Optional path parameter.
http.get<{ id?: string }>('/user/:id?', resolver)

Warning

Note that MSW uses path-to-regexp@6.3.0, which doesn't support all the modern PTR syntax.

@kettanaito kettanaito merged commit 3b7b776 into main Nov 22, 2024
11 checks passed
@kettanaito kettanaito deleted the fix/types-optional-params branch November 22, 2024 17:57
@kettanaito
Copy link
Member Author

Released: v2.6.6 🎉

This has been released in v2.6.6!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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

Successfully merging this pull request may close these issues.

1 participant