diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts index 044df149bf..bc877bdea0 100644 --- a/meteor/meteor-tests.ts +++ b/meteor/meteor-tests.ts @@ -644,7 +644,7 @@ var loginOpts: Meteor.LoginWithExternalServiceOptions = { profile: "asdfasdf", email: "asdf@ASDf.com" }; -Meteor.loginWithMeteorDeveloperAccount(loginOpts, function(error, result) {}); +Meteor.loginWithMeteorDeveloperAccount(loginOpts, function(error: Meteor.Error) {}); Accounts.emailTemplates.siteName = "AwesomeSite"; Accounts.emailTemplates.from = "AwesomeSite Admin "; diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index fb0ff4819f..f7ac5828a3 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -2,6 +2,16 @@ // Project: http://www.meteor.com/ // Definitions by: Dave Allen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Meteor definitions for TypeScript + * author - Olivier Refalo - orefalo@yahoo.com + * author - David Allen - dave@fullflavedave.com + * + * Thanks to Sam Hatoum for the base code for auto-generating this file. + * + * supports Meteor 1.3 + */ + /** * These are the common (for client and server) modules and interfaces that can't be automatically generated from the Meteor data.js file @@ -15,7 +25,7 @@ interface JSONable { } interface EJSON extends EJSONable {} -declare module Match { +declare namespace Match { var Any: any; var String: any; var Integer: any; @@ -29,7 +39,7 @@ declare module Match { function Where(condition: any): any; } -declare module Meteor { +declare namespace Meteor { interface UserEmail { address:string; verified:boolean; @@ -57,7 +67,7 @@ declare module Meteor { } } -declare module DDP { +declare namespace DDP { interface DDPStatic { subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle; call(method: string, ...parameters: any[]):void; @@ -79,7 +89,7 @@ declare module DDP { } } -declare module Mongo { +declare namespace Mongo { interface Selector { [key: string]:any; } @@ -91,7 +101,7 @@ declare module Mongo { } } -declare module HTTP { +declare namespace HTTP { interface HTTPRequest { content?:string; @@ -118,7 +128,7 @@ declare module HTTP { function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; } -declare module Random { +declare namespace Random { function id(numberOfChars?: number): string; function secret(numberOfChars?: number): string; function fraction():number; @@ -127,7 +137,7 @@ declare module Random { function choice(str:string):string; // @param str, @return a random char in str } -declare module Accounts { +declare namespace Accounts { function loginServicesConfigured(): boolean; function onPageLoadLogin(func: Function): void; @@ -136,7 +146,7 @@ declare module Accounts { * These are the client modules and interfaces that can't be automatically generated from the Meteor data.js file */ -declare module Meteor { +declare namespace Meteor { /** Start definitions for Template **/ export interface Event { type:string; @@ -186,7 +196,7 @@ declare module Meteor { } } -declare module Blaze { +declare namespace Blaze { interface View { name: string; parentView: Blaze.View; @@ -210,7 +220,7 @@ declare module Blaze { } } -declare module BrowserPolicy { +declare namespace BrowserPolicy { interface framing { disallow():void; @@ -251,7 +261,7 @@ declare module BrowserPolicy { * These are the server modules and interfaces that can't be automatically generated from the Meteor data.js file */ -declare module Meteor { +declare namespace Meteor { interface EmailFields { from?: () => string; subject?: (user: Meteor.User) => string; @@ -287,7 +297,7 @@ declare module Meteor { } } -declare module Mongo { +declare namespace Mongo { interface AllowDenyOptions { insert?: (userId: string, doc: any) => boolean; update?: (userId: string, doc: any, fieldNames: string[], modifier: any) => boolean; @@ -297,7 +307,7 @@ declare module Mongo { } } -declare module Accounts { +declare namespace Accounts { interface IValidateLoginAttemptCbOpts { type?: string; allowed?: boolean; @@ -362,20 +372,20 @@ interface ITinytestAssertions { _stringEqual(actual: string, expected: string, msg?: string): void; } -declare module Tinytest { +declare namespace Tinytest { function add(description : string , func : (test : ITinytestAssertions) => void) : void; function addAsync(description : string , func : (test : ITinytestAssertions) => void) : void; } // Kept in for backwards compatibility -declare module Meteor { +declare namespace Meteor { interface Tinytest { add(description : string , func : (test : ITinytestAssertions) => void) : void; addAsync(description : string , func : (test : ITinytestAssertions) => void) : void; } } -declare module Accounts { +declare namespace Accounts { function addEmail(userId: string, newEmail: string, verified?: boolean): void; function changePassword(oldPassword: string, newPassword: string, callback?: Function): void; function createUser(options: { @@ -430,7 +440,7 @@ declare module Accounts { function validateNewUser(func: Function): boolean; } -declare module App { +declare namespace App { function accessRule(pattern: string, options?: { type?: string; launchExternal?: boolean; @@ -450,12 +460,12 @@ declare module App { function setPreference(name: string, value: string, platform?: string): void; } -declare module Assets { +declare namespace Assets { function getBinary(assetPath: string, asyncCallback?: Function): EJSON; function getText(assetPath: string, asyncCallback?: Function): string; } -declare module Blaze { +declare namespace Blaze { function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; function Let(bindings: Function, contentFunc: Function): Blaze.View; @@ -509,20 +519,20 @@ declare module Blaze { function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string; } -declare module Cordova { +declare namespace Cordova { function depends(dependencies:{[id:string]:string}): void; } -declare module DDP { +declare namespace DDP { function connect(url: string): DDP.DDPStatic; } -declare module DDPCommon { +declare namespace DDPCommon { function MethodInvocation(options: { }): any; } -declare module EJSON { +declare namespace EJSON { var CustomType: CustomTypeStatic; interface CustomTypeStatic { new(): CustomType; @@ -550,11 +560,11 @@ declare module EJSON { function toJSONValue(val: EJSON): JSONable; } -declare module Match { +declare namespace Match { function test(value: any, pattern: any): boolean; } -declare module Meteor { +declare namespace Meteor { var Error: ErrorStatic; interface ErrorStatic { new(error: string | number, reason?: string, details?: string): Error; @@ -611,7 +621,7 @@ declare module Meteor { function wrapAsync(func: Function, context?: Object): any; } -declare module Mongo { +declare namespace Mongo { var Collection: CollectionStatic; interface CollectionStatic { new(name: string, options?: { @@ -689,12 +699,12 @@ declare module Mongo { } -declare module Npm { +declare namespace Npm { function depends(dependencies:{[id:string]:string}): void; function require(name: string): any; } -declare module Package { +declare namespace Package { function describe(options: { summary?: string; version?: string; @@ -715,7 +725,7 @@ declare module Package { }): void; } -declare module Tracker { +declare namespace Tracker { function Computation(): void; interface Computation { firstRun: boolean; @@ -748,14 +758,14 @@ declare module Tracker { function onInvalidate(callback: Function): void; } -declare module Session { +declare namespace Session { function equals(key: string, value: string | number | boolean | any /** Null **/ | any /** Undefined **/): boolean; function get(key: string): any; function set(key: string, value: EJSONable | any /** Undefined **/): void; function setDefault(key: string, value: EJSONable | any /** Undefined **/): void; } -declare module HTTP { +declare namespace HTTP { function call(method: string, url: string, options?: { content?: string; data?: Object; @@ -775,7 +785,7 @@ declare module HTTP { function put(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; } -declare module Email { +declare namespace Email { function send(options: { from?: string; to?: string | string[];