-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
π·οΈ Better typings for constant
#4999
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9864176:
|
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## next-3_18_0 #4999 +/- ##
============================================
Coverage 96.73% 96.73%
============================================
Files 213 213
Lines 16252 16252
Branches 2652 2652
============================================
Hits 15721 15721
Misses 531 531
Flags with carried forward coverage won't be shown. Click here to find out more. β View full report in Codecov by Sentry. |
π A preview of the new documentation is available at: http://664c462f56a6519ceb08f739--dubzzz-fast-check.netlify.app |
@@ -119,7 +119,7 @@ describe('webUrl (integration)', () => { | |||
function webUrlConstraintsBuilder(onlySmall?: boolean): fc.Arbitrary<WebUrlConstraints> { | |||
return fc.record( | |||
{ | |||
validSchemes: fc.constant(['ftp']), | |||
validSchemes: fc.constant<string[]>(['ftp']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #5007
**Description** As recommended by #4047, let's leverage const generics to make usage of `constant` even simpler for TS users. Not really a breaking change on its own but given we play with types and change the way we declare some, let's be safe and pack this change with other "next major" devs. <!-- Please provide a short description and potentially linked issues hustifying the need for this PR --> <!-- * Your PR is fixing a bug or regression? Check for existing issues related to this bug and link them --> <!-- * Your PR is adding a new feature? Make sure there is a related issue or discussion attached to it --> <!-- You can provide any additional context to help into understanding what's this PR is attempting to solve: reproduction of a bug, code snippets... --> **Checklist** β _Don't delete this checklist and make sure you do the following before opening the PR_ - [x] The name of my PR follows [gitmoji](https://gitmoji.dev/) specification - [x] My PR references one of several related issues (if any) - [x] New features or breaking changes must come with an associated Issue or Discussion - [x] My PR does not add any new dependency without an associated Issue or Discussion - [x] My PR includes bumps details, please run `yarn bump` and flag the impacts properly - [x] My PR adds relevant tests and they would have failed without my PR (when applicable) <!-- More about contributing at https://github.com/dubzzz/fast-check/blob/main/CONTRIBUTING.md --> **Advanced** <!-- How to fill the advanced section is detailed below! --> - [x] Category: π·οΈ Add or update types - [x] Impacts: Typings <!-- [Category] Please use one of the categories below, it will help us into better understanding the urgency of the PR --> <!-- * β¨ Introduce new features --> <!-- * π Add or update documentation --> <!-- * β Add or update tests --> <!-- * π Fix a bug --> <!-- * π·οΈ Add or update types --> <!-- * β‘οΈ Improve performance --> <!-- * _Other(s):_ ... --> <!-- [Impacts] Please provide a comma separated list of the potential impacts that might be introduced by this change --> <!-- * Generated values: Can your change impact any of the existing generators in terms of generated values, if so which ones? when? --> <!-- * Shrink values: Can your change impact any of the existing generators in terms of shrink values, if so which ones? when? --> <!-- * Performance: Can it require some typings changes on user side? Please give more details --> <!-- * Typings: Is there a potential performance impact? In which cases? -->
**Description** As recommended by #4047, let's leverage const generics to make usage of `constant` even simpler for TS users. Not really a breaking change on its own but given we play with types and change the way we declare some, let's be safe and pack this change with other "next major" devs. <!-- Please provide a short description and potentially linked issues hustifying the need for this PR --> <!-- * Your PR is fixing a bug or regression? Check for existing issues related to this bug and link them --> <!-- * Your PR is adding a new feature? Make sure there is a related issue or discussion attached to it --> <!-- You can provide any additional context to help into understanding what's this PR is attempting to solve: reproduction of a bug, code snippets... --> **Checklist** β _Don't delete this checklist and make sure you do the following before opening the PR_ - [x] The name of my PR follows [gitmoji](https://gitmoji.dev/) specification - [x] My PR references one of several related issues (if any) - [x] New features or breaking changes must come with an associated Issue or Discussion - [x] My PR does not add any new dependency without an associated Issue or Discussion - [x] My PR includes bumps details, please run `yarn bump` and flag the impacts properly - [x] My PR adds relevant tests and they would have failed without my PR (when applicable) <!-- More about contributing at https://github.com/dubzzz/fast-check/blob/main/CONTRIBUTING.md --> **Advanced** <!-- How to fill the advanced section is detailed below! --> - [x] Category: π·οΈ Add or update types - [x] Impacts: Typings <!-- [Category] Please use one of the categories below, it will help us into better understanding the urgency of the PR --> <!-- * β¨ Introduce new features --> <!-- * π Add or update documentation --> <!-- * β Add or update tests --> <!-- * π Fix a bug --> <!-- * π·οΈ Add or update types --> <!-- * β‘οΈ Improve performance --> <!-- * _Other(s):_ ... --> <!-- [Impacts] Please provide a comma separated list of the potential impacts that might be introduced by this change --> <!-- * Generated values: Can your change impact any of the existing generators in terms of generated values, if so which ones? when? --> <!-- * Shrink values: Can your change impact any of the existing generators in terms of shrink values, if so which ones? when? --> <!-- * Performance: Can it require some typings changes on user side? Please give more details --> <!-- * Typings: Is there a potential performance impact? In which cases? -->
**Description** As recommended by #4047, let's leverage const generics to make usage of `constant` even simpler for TS users. Not really a breaking change on its own but given we play with types and change the way we declare some, let's be safe and pack this change with other "next major" devs. <!-- Please provide a short description and potentially linked issues hustifying the need for this PR --> <!-- * Your PR is fixing a bug or regression? Check for existing issues related to this bug and link them --> <!-- * Your PR is adding a new feature? Make sure there is a related issue or discussion attached to it --> <!-- You can provide any additional context to help into understanding what's this PR is attempting to solve: reproduction of a bug, code snippets... --> **Checklist** β _Don't delete this checklist and make sure you do the following before opening the PR_ - [x] The name of my PR follows [gitmoji](https://gitmoji.dev/) specification - [x] My PR references one of several related issues (if any) - [x] New features or breaking changes must come with an associated Issue or Discussion - [x] My PR does not add any new dependency without an associated Issue or Discussion - [x] My PR includes bumps details, please run `yarn bump` and flag the impacts properly - [x] My PR adds relevant tests and they would have failed without my PR (when applicable) <!-- More about contributing at https://github.com/dubzzz/fast-check/blob/main/CONTRIBUTING.md --> **Advanced** <!-- How to fill the advanced section is detailed below! --> - [x] Category: π·οΈ Add or update types - [x] Impacts: Typings <!-- [Category] Please use one of the categories below, it will help us into better understanding the urgency of the PR --> <!-- * β¨ Introduce new features --> <!-- * π Add or update documentation --> <!-- * β Add or update tests --> <!-- * π Fix a bug --> <!-- * π·οΈ Add or update types --> <!-- * β‘οΈ Improve performance --> <!-- * _Other(s):_ ... --> <!-- [Impacts] Please provide a comma separated list of the potential impacts that might be introduced by this change --> <!-- * Generated values: Can your change impact any of the existing generators in terms of generated values, if so which ones? when? --> <!-- * Shrink values: Can your change impact any of the existing generators in terms of shrink values, if so which ones? when? --> <!-- * Performance: Can it require some typings changes on user side? Please give more details --> <!-- * Typings: Is there a potential performance impact? In which cases? -->
**Description** As recommended by #4047, let's leverage const generics to make usage of `constant` even simpler for TS users. Not really a breaking change on its own but given we play with types and change the way we declare some, let's be safe and pack this change with other "next major" devs. <!-- Please provide a short description and potentially linked issues hustifying the need for this PR --> <!-- * Your PR is fixing a bug or regression? Check for existing issues related to this bug and link them --> <!-- * Your PR is adding a new feature? Make sure there is a related issue or discussion attached to it --> <!-- You can provide any additional context to help into understanding what's this PR is attempting to solve: reproduction of a bug, code snippets... --> **Checklist** β _Don't delete this checklist and make sure you do the following before opening the PR_ - [x] The name of my PR follows [gitmoji](https://gitmoji.dev/) specification - [x] My PR references one of several related issues (if any) - [x] New features or breaking changes must come with an associated Issue or Discussion - [x] My PR does not add any new dependency without an associated Issue or Discussion - [x] My PR includes bumps details, please run `yarn bump` and flag the impacts properly - [x] My PR adds relevant tests and they would have failed without my PR (when applicable) <!-- More about contributing at https://github.com/dubzzz/fast-check/blob/main/CONTRIBUTING.md --> **Advanced** <!-- How to fill the advanced section is detailed below! --> - [x] Category: π·οΈ Add or update types - [x] Impacts: Typings <!-- [Category] Please use one of the categories below, it will help us into better understanding the urgency of the PR --> <!-- * β¨ Introduce new features --> <!-- * π Add or update documentation --> <!-- * β Add or update tests --> <!-- * π Fix a bug --> <!-- * π·οΈ Add or update types --> <!-- * β‘οΈ Improve performance --> <!-- * _Other(s):_ ... --> <!-- [Impacts] Please provide a comma separated list of the potential impacts that might be introduced by this change --> <!-- * Generated values: Can your change impact any of the existing generators in terms of generated values, if so which ones? when? --> <!-- * Shrink values: Can your change impact any of the existing generators in terms of shrink values, if so which ones? when? --> <!-- * Performance: Can it require some typings changes on user side? Please give more details --> <!-- * Typings: Is there a potential performance impact? In which cases? -->
**Description** As recommended by #4047, let's leverage const generics to make usage of `constant` even simpler for TS users. Not really a breaking change on its own but given we play with types and change the way we declare some, let's be safe and pack this change with other "next major" devs. <!-- Please provide a short description and potentially linked issues hustifying the need for this PR --> <!-- * Your PR is fixing a bug or regression? Check for existing issues related to this bug and link them --> <!-- * Your PR is adding a new feature? Make sure there is a related issue or discussion attached to it --> <!-- You can provide any additional context to help into understanding what's this PR is attempting to solve: reproduction of a bug, code snippets... --> **Checklist** β _Don't delete this checklist and make sure you do the following before opening the PR_ - [x] The name of my PR follows [gitmoji](https://gitmoji.dev/) specification - [x] My PR references one of several related issues (if any) - [x] New features or breaking changes must come with an associated Issue or Discussion - [x] My PR does not add any new dependency without an associated Issue or Discussion - [x] My PR includes bumps details, please run `yarn bump` and flag the impacts properly - [x] My PR adds relevant tests and they would have failed without my PR (when applicable) <!-- More about contributing at https://github.com/dubzzz/fast-check/blob/main/CONTRIBUTING.md --> **Advanced** <!-- How to fill the advanced section is detailed below! --> - [x] Category: π·οΈ Add or update types - [x] Impacts: Typings <!-- [Category] Please use one of the categories below, it will help us into better understanding the urgency of the PR --> <!-- * β¨ Introduce new features --> <!-- * π Add or update documentation --> <!-- * β Add or update tests --> <!-- * π Fix a bug --> <!-- * π·οΈ Add or update types --> <!-- * β‘οΈ Improve performance --> <!-- * _Other(s):_ ... --> <!-- [Impacts] Please provide a comma separated list of the potential impacts that might be introduced by this change --> <!-- * Generated values: Can your change impact any of the existing generators in terms of generated values, if so which ones? when? --> <!-- * Shrink values: Can your change impact any of the existing generators in terms of shrink values, if so which ones? when? --> <!-- * Performance: Can it require some typings changes on user side? Please give more details --> <!-- * Typings: Is there a potential performance impact? In which cases? -->
Description
As recommended by #4047, let's leverage const generics to make usage of
constant
even simpler for TS users.Not really a breaking change on its own but given we play with types and change the way we declare some, let's be safe and pack this change with other "next major" devs.
Checklist β Don't delete this checklist and make sure you do the following before opening the PR
yarn bump
and flag the impacts properlyAdvanced