Skip to content

Commit

Permalink
♻️ Add missing types on exported (#5203)
Browse files Browse the repository at this point in the history
**Description**

<!-- Please provide a short description and potentially linked issues
justifying the need for this PR -->

In order to toggle ON the flag `isolatedDeclarations` and allow us to
use something else than tsc to build our project (not sure we will do
one day), we start to make some types more explicit on our exported
symbols.

This PR does not fix everything as some of the fixes would require some
minor (subtle) breaking changes!

<!-- * 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: ♻️ Refactoring
- [x] Impacts: None

<!-- [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?
-->
  • Loading branch information
dubzzz authored Aug 10, 2024
1 parent e6db4ed commit 49746db
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .yarn/versions/4e927b19.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
releases:
fast-check: patch

declined:
- "@fast-check/ava"
- "@fast-check/jest"
- "@fast-check/vitest"
- "@fast-check/worker"
2 changes: 1 addition & 1 deletion packages/fast-check/src/check/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @remarks Since 1.8.0
* @public
*/
export const cloneMethod = Symbol.for('fast-check/cloneMethod');
export const cloneMethod: unique symbol = Symbol.for('fast-check/cloneMethod');

/**
* Object instance that should be cloned from one generation/shrink to another
Expand Down
2 changes: 1 addition & 1 deletion packages/fast-check/src/stream/Stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Stream<T> implements IterableIterator<T> {
next(): IteratorResult<T> {
return this.g.next();
}
[safeSymbolIterator](): IterableIterator<T> {
[Symbol.iterator](): IterableIterator<T> {
// /*DEBUG*/ this.closeCurrentStream();
return this.g;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fast-check/src/utils/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const safePositiveInfinity = Number.POSITIVE_INFINITY;
* @remarks Since 2.17.0
* @public
*/
export const toStringMethod = Symbol.for('fast-check/toStringMethod');
export const toStringMethod: unique symbol = Symbol.for('fast-check/toStringMethod');
/**
* Interface to implement for {@link toStringMethod}
*
Expand Down Expand Up @@ -62,7 +62,7 @@ export function hasToStringMethod<T>(instance: T): instance is T & WithToStringM
* @remarks Since 2.17.0
* @public
*/
export const asyncToStringMethod = Symbol.for('fast-check/asyncToStringMethod');
export const asyncToStringMethod: unique symbol = Symbol.for('fast-check/asyncToStringMethod');
/**
* Interface to implement for {@link asyncToStringMethod}
*
Expand Down

0 comments on commit 49746db

Please sign in to comment.