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

🔧 Toggle on isolatedDeclarations flag on the project #5136

Merged
merged 33 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
35c6772
🔧 Toggle on `isolatedDeclarations` flag on the project
dubzzz Jul 16, 2024
fcd9d5b
fix poisoning
dubzzz Jul 16, 2024
146beab
fix some in fc
dubzzz Jul 16, 2024
0ddbdb1
Merge branch 'main' into iso-dec
dubzzz Jul 23, 2024
7560f21
Merge branch 'main' into iso-dec
dubzzz Aug 6, 2024
4dc1f78
fix stream
dubzzz Aug 6, 2024
9a3c464
fix wrapper
dubzzz Aug 6, 2024
1c74c13
lint wrapper
dubzzz Aug 6, 2024
c41a10d
trick to pass isolatedDeclarations on unpublished
dubzzz Aug 7, 2024
3c71345
fix vitest and jest?
dubzzz Aug 10, 2024
4212214
Revert breaking parts
dubzzz Aug 10, 2024
26861e4
Dropping isolatedDeclarations for fc
dubzzz Aug 10, 2024
e3e3cb2
Merge remote-tracking branch 'origin/main' into iso-dec
dubzzz Aug 10, 2024
37f4da0
Merge branch 'main' into iso-dec
dubzzz Sep 19, 2024
220fe48
Merge remote-tracking branch 'origin/main' into iso-dec
dubzzz Oct 29, 2024
5fe3f36
Merge remote-tracking branch 'origin/main' into iso-dec
dubzzz Nov 28, 2024
98851bc
drop useless, targeting next major rather than minor
dubzzz Nov 28, 2024
2d1d7e1
oups useless
dubzzz Nov 28, 2024
b60d02f
Merge branch 'main' into iso-dec
dubzzz Jan 9, 2025
7d79f9e
Merge branch 'main' into iso-dec
dubzzz Feb 6, 2025
c18bd70
fix
dubzzz Feb 6, 2025
d96ce5c
fix
dubzzz Feb 6, 2025
d06446d
Create blue-glasses-love.md
dubzzz Feb 6, 2025
e6751f0
doc
dubzzz Feb 6, 2025
d91b3fc
Merge branch 'iso-dec' of https://github.com/dubzzz/fast-check into i…
dubzzz Feb 6, 2025
c2a2f43
fix typecheck
dubzzz Feb 6, 2025
3bb1ae9
fix
dubzzz Feb 6, 2025
e74aea1
Apply suggestions from code review
dubzzz Feb 6, 2025
6484fc6
add missing dep
dubzzz Feb 6, 2025
ceabecf
attempt
dubzzz Feb 6, 2025
2567715
type import
dubzzz Feb 6, 2025
bd5ecc8
fix?
dubzzz Feb 6, 2025
7863a61
Merge remote-tracking branch 'origin/main' into iso-dec
dubzzz Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions packages/fast-check/src/check/model/commands/CommandWrapper.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import type {
WithAsyncToStringMethod,
WithToStringMethod} from '../../../utils/stringify';
import {
asyncToStringMethod,
hasAsyncToStringMethod,
hasToStringMethod,
toStringMethod,
toStringMethod
} from '../../../utils/stringify';
import { cloneMethod, hasCloneMethod } from '../../symbols';
import type { ICommand } from '../command/ICommand';
Expand All @@ -14,22 +17,20 @@ import type { ICommand } from '../command/ICommand';
export class CommandWrapper<Model extends object, Real, RunResult, CheckAsync extends boolean>
dubzzz marked this conversation as resolved.
Show resolved Hide resolved
implements ICommand<Model, Real, RunResult, CheckAsync>
{
[toStringMethod]?: () => string;
[asyncToStringMethod]?: () => Promise<string>;

hasRan = false;
constructor(readonly cmd: ICommand<Model, Real, RunResult, CheckAsync>) {
if (hasToStringMethod(cmd)) {
const method = cmd[toStringMethod];
this[toStringMethod] = function toStringMethod(): string {
(this as unknown as WithToStringMethod)[toStringMethod] = function toStringMethod(): string {
return method.call(cmd);
};
}
if (hasAsyncToStringMethod(cmd)) {
const method = cmd[asyncToStringMethod];
this[asyncToStringMethod] = function asyncToStringMethod(): Promise<string> {
return method.call(cmd);
};
(this as unknown as WithAsyncToStringMethod)[asyncToStringMethod] =
function asyncToStringMethod(): Promise<string> {
return method.call(cmd);
};
}
}
check(m: Readonly<Model>): CheckAsync extends false ? boolean : Promise<boolean> {
Expand Down
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');
dubzzz marked this conversation as resolved.
Show resolved Hide resolved

/**
* 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');
dubzzz marked this conversation as resolved.
Show resolved Hide resolved
/**
* 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');
dubzzz marked this conversation as resolved.
Show resolved Hide resolved
/**
* Interface to implement for {@link asyncToStringMethod}
*
Expand Down
8 changes: 4 additions & 4 deletions packages/poisoning/src/internals/PoisoningFreeArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const safeArraySort = Array.prototype.sort;
const safeObjectDefineProperty = Object.defineProperty;

/** Alias for Array.prototype.map */
export const MapSymbol = Symbol('safe.map');
export const MapSymbol: unique symbol = Symbol('safe.map');
/** Alias for Array.prototype.push */
export const PushSymbol = Symbol('safe.push');
export const PushSymbol: unique symbol = Symbol('safe.push');
/** Alias for Array.prototype.shift */
export const ShiftSymbol = Symbol('safe.shift');
export const ShiftSymbol: unique symbol = Symbol('safe.shift');
/** Alias for Array.prototype.sort */
export const SortSymbol = Symbol('safe.sort');
export const SortSymbol: unique symbol = Symbol('safe.sort');
dubzzz marked this conversation as resolved.
Show resolved Hide resolved

/** Array instance enriched with aliased methods that cannot be poisoned */
export type PoisoningFreeArray<T> = Array<T> & {
Expand Down
8 changes: 4 additions & 4 deletions packages/poisoning/src/internals/PoisoningFreeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const safeMapSet = Map.prototype.set;
const safeObjectDefineProperty = Object.defineProperty;

/** Alias for Map.prototype.get */
export const GetSymbol = Symbol('safe.get');
export const GetSymbol: unique symbol = Symbol('safe.get');
/** Alias for Map.prototype.has */
export const HasSymbol = Symbol('safe.has');
export const HasSymbol: unique symbol = Symbol('safe.has');
/** Alias for Map.prototype.entries */
export const EntriesSymbol = Symbol('safe.entries');
export const EntriesSymbol: unique symbol = Symbol('safe.entries');
/** Alias for Map.prototype.set */
export const SetSymbol = Symbol('safe.set');
export const SetSymbol: unique symbol = Symbol('safe.set');
dubzzz marked this conversation as resolved.
Show resolved Hide resolved

/** Map instance enriched with aliased methods that cannot be poisoned */
export type PoisoningFreeMap<K, V> = Map<K, V> & {
Expand Down
4 changes: 2 additions & 2 deletions packages/poisoning/src/internals/PoisoningFreeSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const safeSetHas = Set.prototype.has;
const safeObjectDefineProperty = Object.defineProperty;

/** Alias for Set.prototype.add */
export const AddSymbol = Symbol('safe.add');
export const AddSymbol: unique symbol = Symbol('safe.add');
/** Alias for Set.prototype.has */
export const HasSymbol = Symbol('safe.has');
export const HasSymbol: unique symbol = Symbol('safe.has');
dubzzz marked this conversation as resolved.
Show resolved Hide resolved

/** Set instance enriched with aliased methods that cannot be poisoned */
export type PoisoningFreeSet<K> = Set<K> & {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"noEmit": true,
"declaration": false,
"declaration": true,
"isolatedDeclarations": true,
"incremental": false,
"sourceMap": true,
"target": "es2017",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.publish.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"noEmit": false,
"declaration": false,
"isolatedDeclarations": false,
"removeComments": true,
"sourceMap": false
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.publish.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
"isolatedDeclarations": true,
"removeComments": false,
"sourceMap": false,
"stripInternal": true
Expand Down
Loading