@@ -2412,17 +2412,15 @@ describe("Schema", () => {
2412
2412
} )
2413
2413
2414
2414
it ( "withDecodingDefault" , ( ) => {
2415
- S . Struct ( {
2416
- a : S . optional ( S . String ) . pipe (
2415
+ when ( S . Struct ) . isCalledWith ( {
2416
+ a : when ( S . optional ( S . String ) . pipe ) . isCalledWith (
2417
2417
S . withConstructorDefault ( ( ) => undefined ) ,
2418
- // @ts -expect-error
2419
- S . withDecodingDefault ( ( ) => "" )
2418
+ expect ( S . withDecodingDefault ) . type . not . toBeCallableWith ( ( ) => "" )
2420
2419
)
2421
2420
} )
2422
- S . Struct ( {
2423
- a : S . optional ( S . String ) . pipe (
2424
- // @ts -expect-error
2425
- S . withDecodingDefault ( ( ) => undefined )
2421
+ when ( S . Struct ) . isCalledWith ( {
2422
+ a : when ( S . optional ( S . String ) . pipe ) . isCalledWith (
2423
+ expect ( S . withDecodingDefault ) . type . not . toBeCallableWith ( ( ) => undefined )
2426
2424
)
2427
2425
} )
2428
2426
expect (
@@ -2435,12 +2433,10 @@ describe("Schema", () => {
2435
2433
} )
2436
2434
2437
2435
it ( "withDefaults" , ( ) => {
2438
- S . Struct ( {
2439
- a : S . optional ( S . String ) . pipe (
2440
- S . withDefaults ( {
2441
- // @ts -expect-error
2436
+ when ( S . Struct ) . isCalledWith ( {
2437
+ a : when ( S . optional ( S . String ) . pipe ) . isCalledWith (
2438
+ expect ( S . withDefaults ) . type . not . toBeCallableWith ( {
2442
2439
decoding : ( ) => undefined ,
2443
- // @ts -expect-error
2444
2440
constructor : ( ) => undefined
2445
2441
} )
2446
2442
)
@@ -2753,9 +2749,8 @@ describe("Schema", () => {
2753
2749
// should allow generic context
2754
2750
const _f1 = < A extends string > ( schema : S . Schema < A > ) => schema . pipe ( S . maxLength ( 5 ) )
2755
2751
const _f2 = < A extends string > ( schema : S . Schema < A > ) =>
2756
- schema . pipe (
2757
- // @ts -expect-error: Type 'string' is not assignable to type 'number'
2758
- S . greaterThan ( 5 )
2752
+ when ( schema . pipe ) . isCalledWith (
2753
+ expect ( S . greaterThan ) . type . not . toBeCallableWith ( 5 )
2759
2754
)
2760
2755
// should allow string subtypes
2761
2756
pipe (
@@ -3540,12 +3535,8 @@ describe("Schema", () => {
3540
3535
> ( schema : S . Schema < A , I > ) => S . DataFromSelf ( schema )
3541
3536
const _f3 = < A extends Readonly < Record < string , unknown > > | ReadonlyArray < unknown > , I extends number > (
3542
3537
schema : S . Schema < A , I >
3543
- ) =>
3544
- // @ts -expect-error: Type 'number' is not assignable to type 'Readonly<Record<string, unknown>>'
3545
- S . DataFromSelf ( schema )
3546
- const _f4 = < A extends string > ( schema : S . Schema < A > ) =>
3547
- // @ts -expect-error: Type 'string' is not assignable to type 'Readonly<Record<string, unknown>>'
3548
- S . DataFromSelf ( schema )
3538
+ ) => expect ( S . DataFromSelf ) . type . not . toBeCallableWith ( schema )
3539
+ const _f4 = < A extends string > ( schema : S . Schema < A > ) => expect ( S . DataFromSelf ) . type . not . toBeCallableWith ( schema )
3549
3540
3550
3541
// should allow mutable arguments
3551
3542
S . DataFromSelf ( S . mutable ( S . Struct ( { a : S . NumberFromString } ) ) )
@@ -4105,8 +4096,7 @@ describe("Schema", () => {
4105
4096
} )
4106
4097
4107
4098
it ( "head" , ( ) => {
4108
- // @ts -expect-error: Type 'string' is not assignable to type 'readonly unknown[]'
4109
- S . String . pipe ( S . head )
4099
+ expect ( S . String . pipe ) . type . not . toBeCallableWith ( S . head )
4110
4100
4111
4101
const schema = S . head ( S . Array ( S . NumberFromString ) )
4112
4102
@@ -4120,8 +4110,7 @@ describe("Schema", () => {
4120
4110
} )
4121
4111
4122
4112
it ( "headNonEmpty" , ( ) => {
4123
- // @ts -expect-error: Type 'string' is not assignable to type 'readonly [unknown, ...unknown[]]'
4124
- S . String . pipe ( S . headNonEmpty )
4113
+ expect ( S . String . pipe ) . type . not . toBeCallableWith ( S . headNonEmpty )
4125
4114
4126
4115
const schema = S . headNonEmpty ( S . NonEmptyArray ( S . Number ) )
4127
4116
expect ( S . asSchema ( schema ) ) . type . toBe < S . Schema < number , readonly [ number , ...Array < number > ] > > ( )
@@ -4134,8 +4123,7 @@ describe("Schema", () => {
4134
4123
} )
4135
4124
4136
4125
it ( "headOrElse" , ( ) => {
4137
- // @ts -expect-error: Type 'string' is not assignable to type 'readonly unknown[]'
4138
- S . String . pipe ( S . headOrElse ( ) )
4126
+ expect ( S . String . pipe ) . type . not . toBeCallableWith ( S . headOrElse ( ) )
4139
4127
expect ( S . headOrElse ) . type . not . toBeCallableWith ( S . Array ( S . Number ) , ( ) => "a" )
4140
4128
when ( S . Array ( S . Number ) . pipe ) . isCalledWith ( expect ( S . headOrElse ) . type . not . toBeCallableWith ( ( ) => "a" ) )
4141
4129
0 commit comments