Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
refactor(set generic to "Function" in Reflect.getMetadata<T>):
Browse files Browse the repository at this point in the history
  • Loading branch information
elderapo committed Feb 11, 2019
1 parent 22cda94 commit b931103
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ProtobufLiteMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ export class ProtobufLiteMetadata {
? Object.assign({}, defaultProtobufLitePropertyOptions, decoratorOptions)
: defaultProtobufLitePropertyOptions;

let type: Function = Reflect.getMetadata(
"design:type",
targetProperty,
propertyKey
) as Function;
let type = Reflect.getMetadata<Function>("design:type", targetProperty, propertyKey);
let typeFromDecoratorOptions =
decoratorOptions && decoratorOptions.type ? decoratorOptions.type() : null;

Expand Down Expand Up @@ -115,6 +111,11 @@ export class ProtobufLiteMetadata {
}
}

/* istanbul ignore next line */
if (typeof type === "undefined") {
throw new Error(`"type" cannot be undefined!`);
}

let isCodecUsed: boolean = false;

const CodecConstructable = decoratorOptions.codec || InternalCodecs.lookup(type);
Expand Down

0 comments on commit b931103

Please sign in to comment.