From 24e05c755b45b7e2ba2ec60a37dd00c327ada8e5 Mon Sep 17 00:00:00 2001 From: Deadly0 Date: Wed, 6 Feb 2019 20:27:24 +0300 Subject: [PATCH] More detailed typing for Meteor.methods(), fixed User model. --- types/meteor/globals/meteor.d.ts | 12 ++++++++++-- types/meteor/meteor.d.ts | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/types/meteor/globals/meteor.d.ts b/types/meteor/globals/meteor.d.ts index 7a90b0611e..63f60df310 100644 --- a/types/meteor/globals/meteor.d.ts +++ b/types/meteor/globals/meteor.d.ts @@ -25,7 +25,7 @@ declare module Meteor { _id?: string; username?: string; emails?: UserEmail[]; - createdAt?: number; + createdAt?: Date; profile?: any; services?: any; } @@ -49,7 +49,15 @@ declare module Meteor { /** Error **/ /** Method **/ - function methods(methods: Object): void; + interface MethodThisType { + isSimulation: boolean; + userId: string | null; + connection: Connection | null; + setUserId(userId: string): void; + unblock(): void; + } + + function methods(methods: {[key: string]: (this: MethodThisType, ...args: any[]) => any}): void; function call(name: string, ...args: any[]): any; diff --git a/types/meteor/meteor.d.ts b/types/meteor/meteor.d.ts index ca08c31c98..141b1f7e61 100644 --- a/types/meteor/meteor.d.ts +++ b/types/meteor/meteor.d.ts @@ -26,7 +26,7 @@ declare module "meteor/meteor" { _id?: string; username?: string; emails?: UserEmail[]; - createdAt?: number; + createdAt?: Date; profile?: any; services?: any; } @@ -50,7 +50,15 @@ declare module "meteor/meteor" { /** Error **/ /** Method **/ - function methods(methods: Object): void; + interface MethodThisType { + isSimulation: boolean; + userId: string | null; + connection: Connection | null; + setUserId(userId: string): void; + unblock(): void; + } + + function methods(methods: {[key: string]: (this: MethodThisType, ...args: any[]) => any}): void; function call(name: string, ...args: any[]): any;