@w5s/coreInterfacesCodecOn this pageCodec <T>HierarchyCodecEnumerableModuleModuleIndex CodeccodecDecodecodecEncodecodecSchemaCodec codecDecodecodecDecode(this: void, input: unknown, context: Context<T>): Result<T, CodecError>Returns the decoded input, Result.Ok or Result.Error()@exampleinterface SomeObject { foo: string}const someCodec: Codec<SomeObject> = ...;const input: unknown = ...;const decoded = Codec.decode(someCodec, input);codecEncodecodecEncode(this: void, input: T): unknownReturns the encoded input@exampleinterface SomeObject { foo: string}const someCodec: Codec<SomeObject> = ...;const someObject: SomeObject = { foo: "bar" }const encoded = Codec.decode(someCodec, someObject);codecSchemacodecSchema(this: void): JSONValueReturns the JSONSchema corresponding to the decoded type@exampleconst someCodec: Codec<unknown> = ...;const jsonSchema = Codec.schema(someCodec);
Returns the decoded
input
,Result.Ok
orResult.Error()