From 70c065d64c330196d371941d9294a55da6e3aa37 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jun 2017 09:54:59 +0200 Subject: Add this context to instance model functions --- server/models/pod/pod-interface.ts | 2 +- server/models/pod/pod.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/models/pod') diff --git a/server/models/pod/pod-interface.ts b/server/models/pod/pod-interface.ts index 01ccda64c..d88847c45 100644 --- a/server/models/pod/pod-interface.ts +++ b/server/models/pod/pod-interface.ts @@ -4,7 +4,7 @@ import * as Sequelize from 'sequelize' import { Pod as FormatedPod } from '../../../shared/models/pod.model' export namespace PodMethods { - export type ToFormatedJSON = () => FormatedPod + export type ToFormatedJSON = (this: PodInstance) => FormatedPod export type CountAllCallback = (err: Error, total: number) => void export type CountAll = (callback) => void diff --git a/server/models/pod/pod.ts b/server/models/pod/pod.ts index 4c6e63024..4fe7fda1c 100644 --- a/server/models/pod/pod.ts +++ b/server/models/pod/pod.ts @@ -96,12 +96,12 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da // ------------------------------ METHODS ------------------------------ -toFormatedJSON = function () { +toFormatedJSON = function (this: PodInstance) { const json = { id: this.id, host: this.host, email: this.email, - score: this.score, + score: this.score as number, createdAt: this.createdAt } -- cgit v1.2.3