Type Alias FromDecoder<D>

FromDecoder: D extends Decoder<infer T> ? T : never

Extracts the type parameter T from a JsonDecoder.Decoder.

This utility type is useful when you want to get the type that a decoder will produce, without having to manually specify it.

Type Parameters

  • D

    A JsonDecoder.Decoder type

const userDecoder = JsonDecoder.object({
id: JsonDecoder.number(),
name: JsonDecoder.string()
}, 'User');

// You can extract the type from the decoder:
type User = JsonDecoder.FromDecoder<typeof userDecoder>;