diff --git a/src/result.ts b/src/result.ts
index 798b2656..7819ec9d 100644
--- a/src/result.ts
+++ b/src/result.ts
@@ -30,7 +30,13 @@ export type Failure = {
/**
* A key indicating the location at which validation failed.
*/
- key: string;
+ key?: string;
+
+ /**
+ * The original value passed through so data inspection can be done after failure.
+ * value is `any` here because its argument in `validate` is `any` type.
+ */
+ valueInvalidated: any;
};
/**
diff --git a/src/runtype.ts b/src/runtype.ts
index 17ead6c3..43e1479e 100644
--- a/src/runtype.ts
+++ b/src/runtype.ts
@@ -117,7 +117,7 @@ export function create(check: (x: {}) => Static, A: any):
check(value);
return { success: true, value };
} catch ({ message, key }) {
- return { success: false, message, key };
+ return { success: false, message, key, valueInvalidated: value };
}
}