@@ -386,15 +386,19 @@ Note that `constant('string to match')` returns a `Decoder<string>` which fails
386
386
387
387
Providing the type parameter is only necessary for type-literal strings and numbers, as detailed by this table:
388
388
389
- | Decoder | Type |
390
- | ---------------------------- | ----------------- |
391
- | constant(true) | Decoder<true> |
392
- | constant(false) | Decoder<false> |
393
- | constant(null) | Decoder<null> |
394
- | constant('alaska') | Decoder<string> |
395
- | constant<'alaska'>('alaska') | Decoder<'alaska'> |
396
- | constant(50) | Decoder<number> |
397
- | constant<50>(50) | Decoder<50> |
389
+ | Decoder | Type |
390
+ | ---------------------------- | ---------------------|
391
+ | constant(true) | Decoder<true> |
392
+ | constant(false) | Decoder<false> |
393
+ | constant(null) | Decoder<null> |
394
+ | constant('alaska') | Decoder<string> |
395
+ | constant<'alaska'>('alaska') | Decoder<'alaska'> |
396
+ | constant(50) | Decoder<number> |
397
+ | constant<50>(50) | Decoder<50> |
398
+ | constant([1,2,3]) | Decoder<number[]> |
399
+ | constant<[1,2,3]>([1,2,3]) | Decoder<[1,2,3]> |
400
+ | constant({x: 't'}) | Decoder<{x: string}> |
401
+ | constant<{x: 't'}>({x: 't'}) | Decoder<{x: 't'}> |
398
402
399
403
One place where this happens is when a type-literal is in an interface:
400
404
0 commit comments