aboutsummaryrefslogtreecommitdiff
path: root/src/util/codec.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-14 18:46:42 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-14 18:46:42 +0100
commita4a9b16153428953cb882f2d6037c3bcec68ee17 (patch)
tree4169bbc0f05b66215d3f2c704e8c3573a6e58c2f /src/util/codec.ts
parent690bbfcfd85ac63749c69eb6e29a7cc734b38d2c (diff)
downloadwallet-core-a4a9b16153428953cb882f2d6037c3bcec68ee17.tar.xz
type safety
Diffstat (limited to 'src/util/codec.ts')
-rw-r--r--src/util/codec.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/codec.ts b/src/util/codec.ts
index a6fe74905..9f4dc295f 100644
--- a/src/util/codec.ts
+++ b/src/util/codec.ts
@@ -94,10 +94,10 @@ class ObjectCodecBuilder<T, TC> {
* @param objectDisplayName name of the object that this codec operates on,
* used in error messages.
*/
- build<R extends (TC & T)>(objectDisplayName: string): Codec<R> {
+ build(objectDisplayName: string): Codec<TC> {
const propList = this.propList;
return {
- decode(x: any, c?: Context): R {
+ decode(x: any, c?: Context): TC {
if (!c) {
c = {
path: [`(${objectDisplayName})`],
@@ -112,7 +112,7 @@ class ObjectCodecBuilder<T, TC> {
);
obj[prop.name] = propVal;
}
- return obj as R;
+ return obj as TC;
},
};
}