Skip to content

Commit ebbe21d

Browse files
committed
chore(patterns): Deprecate "sloppy" interface guard option
1 parent 0808eea commit ebbe21d

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

packages/patterns/NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
User-visible changes in `@endo/patterns`:
22

3+
# Next release
4+
5+
- The `sloppy` option for `@endo/patterns` interface guards is deprecated. Use `defaultGuards` instead.
6+
37
# 1.7.0 (2025-07-11)
48

59
- `@endo/marshal` introduces an environment variable config option `ENDO_RANK_STRINGS` to change the rank ordering of strings from the current (incorrect) ordering by UTF-16 code unit used by JavaScript's `<` and `.sort()` operations to (correct and OCapN-conformant) ordering by Unicode code point. It currently defaults to "utf16-code-unit-order", matching the previously-unconditional behavior.

packages/patterns/src/types.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,16 +558,29 @@ export type MakeInterfaceGuardStrict = <
558558
>(
559559
interfaceName: string,
560560
methodGuards: M,
561-
options: { defaultGuards?: undefined; sloppy?: false },
561+
options: {
562+
defaultGuards?: undefined;
563+
/**
564+
* @deprecated This has no effect.
565+
*/
566+
sloppy?: false;
567+
},
562568
) => InterfaceGuard<M>;
563569

564570
/**
565571
* Overload for sloppy interface guards (looser typing).
572+
* @deprecated Use {@link MakeInterfaceGuardStrict} or {@link MakeInterfaceGuardGeneral} instead.
566573
*/
567574
export type MakeInterfaceGuardSloppy = (
568575
interfaceName: string,
569576
methodGuards: any,
570-
options: { defaultGuards?: 'passable' | 'raw'; sloppy?: true },
577+
options: {
578+
defaultGuards?: 'passable' | 'raw';
579+
/**
580+
* @deprecated Use `defaultGuards: undefined` instead.
581+
*/
582+
sloppy?: true;
583+
},
571584
) => InterfaceGuard<any>;
572585

573586
/**
@@ -578,7 +591,13 @@ export type MakeInterfaceGuardGeneral = <
578591
>(
579592
interfaceName: string,
580593
methodGuards: M,
581-
options?: { defaultGuards?: DefaultGuardType; sloppy?: boolean },
594+
options?: {
595+
defaultGuards?: DefaultGuardType;
596+
/**
597+
* @deprecated Use `defaultGuards` instead.
598+
*/
599+
sloppy?: boolean;
600+
},
582601
) => InterfaceGuard<M>;
583602

584603
/**
@@ -657,6 +676,9 @@ export type InterfaceGuardPayload<
657676
T[Extract<keyof T, symbol>]
658677
>;
659678
defaultGuards?: DefaultGuardType;
679+
/**
680+
* @deprecated Use `defaultGuards` instead.
681+
*/
660682
sloppy?: boolean;
661683
};
662684

0 commit comments

Comments
 (0)