Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { ITransfer } from '../Interfaces/itransfer'
- import { injectable } from "inversify";
- import "reflect-metadata"
- export interface ITransfer {
- amount: number
- global_index:number
- toHMSET():string[]
- }
- @injectable()
- export class ConreteTransfer implements ITransfer {
- private amount:number
- private global_index:number
- public toHMSET() : string[] {
- return ['hmset', `transfer:${this.global_index}`, 'amount', `${this.amount}`]
- }
- }
- export const containerModules = new ContainerModule((bind) => {
- bind<ITransfer>(TYPES.Transfer).to(ConcreteTransfer)
- })
- @injectable()
- export class example {
- public RecordIncomingTransfers(transfers:Array<ITransfer>) : void {
- let commands:string[][] = new Array<Array<string>>()
- for (var i = transfers.length - 1; i >= 0; i--) {
- commands.push(transfers[i].toHMSET()) //TypeError: transfers[i].toHMSET is not a function
- }
- console.log(commands)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement