From 99465b8f06cb612e0f1d21aefc1786166b5d09d4 Mon Sep 17 00:00:00 2001 From: Patrick Roza Date: Mon, 30 Mar 2020 11:40:49 +0200 Subject: [PATCH] Adjust decode signature to be a function instead of method. --- src/index.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2f17b9e80..89aa5ac8f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -121,9 +121,7 @@ export class Type implements Decoder, Encoder readonly validate: Validate, /** converts a value of type A to a value of type O */ readonly encode: Encode - ) { - this.decode = this.decode.bind(this) - } + ) {} /** * @since 1.0.0 @@ -156,9 +154,7 @@ export class Type implements Decoder, Encoder * a version of `validate` with a default context * @since 1.0.0 */ - decode(i: I): Validation { - return this.validate(i, [{ key: '', type: this, actual: i }]) - } + readonly decode = (i: I): Validation => this.validate(i, [{ key: '', type: this, actual: i }]) } /**