@@ -19,64 +19,18 @@ import {
1919 unknown ,
2020 Struct ,
2121} from '@metamask/superstruct' ;
22- import type { Context , Infer } from '@metamask/superstruct' ;
22+ import type {
23+ Context ,
24+ Infer ,
25+ ObjectSchema ,
26+ Simplify ,
27+ Optionalize ,
28+ } from '@metamask/superstruct' ;
2329
2430import type { AssertionErrorConstructor } from './assert' ;
2531import { assertStruct } from './assert' ;
2632import { hasProperty } from './misc' ;
2733
28- /**
29- * Infer a type from an object struct schema.
30- *
31- * Copied from `superstruct`.
32- */
33- type ObjectSchema = Record < string , Struct < any , any > > ;
34-
35- /**
36- * Omit properties from a type that extend from a specific type.
37- *
38- * Copied from `superstruct`.
39- */
40- type OmitBy < Type , Value > = Omit <
41- Type ,
42- {
43- [ K in keyof Type ] : Value extends Extract < Type [ K ] , Value > ? K : never ;
44- } [ keyof Type ]
45- > ;
46-
47- /**
48- * Pick properties from a type that extend from a specific type.
49- *
50- * Copied from `superstruct`.
51- */
52- type PickBy < Type , Value > = Pick <
53- Type ,
54- {
55- [ K in keyof Type ] : Value extends Extract < Type [ K ] , Value > ? K : never ;
56- } [ keyof Type ]
57- > ;
58-
59- /**
60- * Normalize properties of a type that allow `undefined` to make them optional.
61- *
62- * Copied from `superstruct`.
63- */
64- type Optionalize < ObjectType extends object > = OmitBy < ObjectType , undefined > &
65- Partial < PickBy < ObjectType , undefined > > ;
66-
67- /**
68- * Simplifies a type definition to its most basic representation.
69- *
70- * Copied from `superstruct`.
71- */
72- type Simplify < Type > = Type extends any [ ] | Date
73- ? Type
74- : {
75- [ K in keyof Type ] : Type [ K ] ;
76- // This was copied from `superstruct`, so we shouldn't change it.
77- // eslint-disable-next-line @typescript-eslint/ban-types
78- } & { } ;
79-
8034/**
8135 * Any JSON-compatible value.
8236 */
0 commit comments