diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/codec.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/codec.ts b/src/util/codec.ts index e18a5e74c..09fa9f953 100644 --- a/src/util/codec.ts +++ b/src/util/codec.ts @@ -106,6 +106,12 @@ class ObjectCodecBuilder<OutputType, PartialOutputType> { path: [`(${objectDisplayName})`], }; } + if (typeof x !== "object") { + throw new DecodingError( + `expected object for ${objectDisplayName} at ${renderContext( + c, + )} but got ${typeof x}`) + } const obj: any = {}; for (const prop of propList) { const propRawVal = x[prop.name]; |