From d3a2d074709fc7df48e9e6da530f0f036d928c4d Mon Sep 17 00:00:00 2001 From: Dave Allen Date: Fri, 3 Apr 2015 10:40:49 -0700 Subject: [PATCH] Updated for Meteor version 1.1.0.1 --- meteor/README.md | 38 +- meteor/meteor-tests.ts | 132 +++-- meteor/meteor.d.ts | 1184 ++++++++++++++++++++++------------------ 3 files changed, 740 insertions(+), 614 deletions(-) diff --git a/meteor/README.md b/meteor/README.md index ae8178f2ce43cc..8f93e1816ef148 100644 --- a/meteor/README.md +++ b/meteor/README.md @@ -1,6 +1,6 @@ # Meteor Type Definitions -These are the definitions for version 1.0.3.1 of Meteor. +These are the definitions for version 1.1.0.1 of Meteor. Although these definitions can be downloaded separately for use, the recommended way to use these definitions in a Meteor application is by installing the [typescript-libs](https://atmospherejs.com/meteortypescript/typescript-libs) Meteor smart package from atmosphere. The smart package contains TypeScript @@ -16,25 +16,21 @@ to generate the official [Meteor docs] (http://docs.meteor.com/). ## Usage -1. If you are using the smart package, add a symbolic link to the definitions from within some directory within your project (e.g. ".typescript" or "lib"). The -definitions can be found somewhere deep within `/.meteor/...`. The following will probably work: +1. Add a symbolic link to the definitions from within some directory within your project (e.g. ".typescript" or "lib"). The definitions can be found somewhere +deep within `/.meteor/...`. The following will probably work: $ ln -s ../.meteor/local/build/programs/server/assets/packages/meteortypescript_typescript-libs/definitions package_defs - If the definitions can't be found within the .meteor directory, you will have to manually pull down the definitions from github and add them to your project: - If you are just using the *meteor.d.ts* file from this source, you can just add the file to any directory in your project (e.g. ".typescript" or "lib"). - 2. Install the [Typescript compiler for Meteor](https://github.com/meteor-typescript/meteor-typescript-compiler) or an [IDE which can transpile TypeScript to JavaScript](#transpiling-typescript). 3. From the typescript files, add references. Reference the definition files with a single line: /// (substitute path in your project) - Or you can reference definition files individually: - + /// (substitue path in your project) /// /// @@ -46,26 +42,28 @@ definitions can be found somewhere deep within `/.meteor/...`. ### References -Try to stay away from referencing *file.ts*, rather generate a *file.d.ts* using `tsc --reference file.ts`, and reference it in your file. Compilation will -be much faster and code cleaner - it's always better to split definition from implemention. +Meteor code can run on the client and the server, for this reason you should try to stay away from referencing *file.ts* directly: you may get unexpected results. +Rather generate a *file.d.ts* using `tsc --reference file.ts`, and reference it in your file. + +Compilation will be much faster and code cleaner - it's always better to split definition from implementation anyways. ### Templates -When specifying template *helpers*, *events*, and functions for *created*, *rendered*, and *destroyed*, you will need to use a "bracket notation" instead of the "dot notation": +With the exception of the **body** and **head** templates, Meteor's Template dot notation cannot be used (ie. *Template.mytemplate*). Thanks to Typescript static typing checks, you will need to used the *bracket notation* to access the Template. - Template['myTemplateName']['helpers']({ + + Template['myTemplateName'].helpers({ foo: function () { return Session.get("foo"); } }); - Template['myTemplateName']['rendered'] = function ( ) { ... } - -This is because TypeScript enforces typing and it will throw an error saying "myTemplateName" does not exist when using the dot notation. + Template['myTemplateName'].rendered = function ( ) { ... } + -### Accessing a Form field +### Form fields -Trying to read a form field value? use `(evt.target).value`. +Form fields typically need to be casted to . For instance to read a form field value, use `(evt.target).value`. ### Global variables @@ -77,7 +75,7 @@ Preface any global variable declarations with a TypeScript "declare var" stateme ### Collections -The majority of extra work required to use TypeScript with Meteor is creating and maintaining the collection interfaces. However, doing so also provides the +The majority of extra work required to use TypeScript with Meteor is creating and maintaining the collection interfaces. However, doing so also provides the additional benefit of succinctly documenting collection schema definitions (that are actually enforced). To define collections, you will need to create an interface representing the collection and then declare a Collection type variable with that interface type (as a generic): @@ -113,7 +111,7 @@ for all of you custom definitions. e.g. contents of ".typescript/custom_defs/cu /// /// /// - + ## Transpiling TypeScript @@ -132,4 +130,4 @@ Then, within WebStorm, go to Preferences -> File Watchers -> "+" symbol and add Last option, is to compile code from the command line. With node and the typescript compiler installed: - $ tsc *.ts \ No newline at end of file + $ tsc *.ts diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts index e4c5b906673fa6..ec2ad3b8175ebd 100644 --- a/meteor/meteor-tests.ts +++ b/meteor/meteor-tests.ts @@ -8,21 +8,15 @@ /*********************************** Begin setup for tests ******************************/ - -// A developer must declare a var Template like this in a separate file to use this TypeScript type definition file -//interface ITemplate { -// adminDashboard: Meteor.Template; -// chat: Meteor.Template; -//} -//declare var Template: ITemplate; - var Rooms = new Mongo.Collection('rooms'); var Messages = new Mongo.Collection('messages'); -var Monkeys = new Mongo.Collection('monkeys'); -var x = new Mongo.Collection('x'); -var y = new Mongo.Collection('y'); - -var check = function(str1, str2) {}; +interface MonkeyDAO { + _id: string; + name: string; +} +var Monkeys = new Mongo.Collection('monkeys'); +//var x = new Mongo.Collection('x'); +//var y = new Mongo.Collection('y'); /********************************** End setup for tests *********************************/ @@ -98,8 +92,8 @@ Tracker.autorun(function () { }); console.log("Current room has " + - Counts.find(Session.get("roomId")).count + - " messages."); +Counts.find(Session.get("roomId")).count + +" messages."); /** * From Publish and Subscribe, Meteor.subscribe section @@ -124,7 +118,7 @@ Meteor.methods({ var you_want_to_throw_an_error = true; if (you_want_to_throw_an_error) - throw new Meteor.Error("404", "Can't find my pants"); + throw new Meteor.Error("404", "Can't find my pants"); return "some return value"; }, @@ -146,15 +140,15 @@ var result = Meteor.call('foo', 1, 2); // DA: I added the "var" keyword in there interface ChatroomsDAO { - _id?: string; + _id?: string; } interface MessagesDAO { - _id?: string; + _id?: string; } var Chatrooms = new Mongo.Collection("chatrooms"); Messages = new Mongo.Collection("messages"); -var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch(); +var myMessages = Messages.find({userId: Session.get('myUserId')}).fetch(); Messages.insert({text: "Hello, world!"}); @@ -171,10 +165,10 @@ Posts.insert({title: "Hello world", body: "First post"}); * since there is already a Collection constructor with a different signature * var Scratchpad = new Mongo.Collection; -for (var i = 0; i < 10; i++) - Scratchpad.insert({number: i * 2}); -assert(Scratchpad.find({number: {$lt: 9}}).count() === 5); -**/ + for (var i = 0; i < 10; i++) + Scratchpad.insert({number: i * 2}); + assert(Scratchpad.find({number: {$lt: 9}}).count() === 5); + **/ var Animal = function (doc) { // _.extend(this, doc); @@ -185,11 +179,16 @@ Animal.prototype = { makeNoise: function () { console.log(this.sound); } -} +}; +interface AnimalDAO { + _id: string; + makeNoise: () => void; +} + // Define a Collection that uses Animal as its document -var Animals = new Mongo.Collection("Animals", { +var Animals = new Mongo.Collection("Animals", { transform: function (doc) { return new Animal(doc); } }); @@ -225,8 +224,8 @@ Template['adminDashboard'].events({ Meteor.methods({ declareWinners: function () { Players.update({score: {$gt: 10}}, - {$addToSet: {badges: "Winner"}}, - {multi: true}); + {$addToSet: {badges: "Winner"}}, + {multi: true}); } }); @@ -348,7 +347,7 @@ Session.equals("key", value); */ Meteor.publish("userData", function () { return Meteor.users.find({_id: this.userId}, - {fields: {'other': 1, 'things': 1}}); + {fields: {'other': 1, 'things': 1}}); }); Meteor.users.deny({update: function () { return true; }}); @@ -412,8 +411,8 @@ Accounts.emailTemplates.enrollAccount.subject = function (user) { }; Accounts.emailTemplates.enrollAccount.text = function (user, url) { return "You have been selected to participate in building a better future!" - + " To activate your account, simply click the link below:\n\n" - + url; + + " To activate your account, simply click the link below:\n\n" + + url; }; /** @@ -424,6 +423,36 @@ Template['adminDashboard'].helpers({ return Session.get("foo"); } }); +Template['newTemplate'].helpers({ + helperName: function () { + } +}); + +Template['newTemplate'].created = function () { + +}; + +Template['newTemplate'].rendered = function () { + +}; + +Template['newTemplate'].destroyed = function () { + +}; + +Template['newTemplate'].events({ + 'click .something': function (event) { + } +}); + +Template.registerHelper('testHelper', function() { + return 'tester'; +}); + +var instance = Template.instance(); +var data = Template.currentData(); +var data = Template.parentData(1); +var body = Template.body; /** * From Match section @@ -481,10 +510,9 @@ Tracker.autorun(function (c) { * From Deps, Deps.Computation */ if (Tracker.active) { - Tracker.onInvalidate(function () { - x.destroy(); - y.finalize(); - }); + Tracker.onInvalidate(function () { + console.log('invalidated'); + }); } /** @@ -494,15 +522,15 @@ var weather = "sunny"; var weatherDep = new Tracker.Dependency; var getWeather = function () { - weatherDep.depend(); - return weather; + weatherDep.depend(); + return weather; }; var setWeather = function (w) { - weather = w; - // (could add logic here to only call changed() - // if the new value is different from the old) - weatherDep.changed(); + weather = w; + // (could add logic here to only call changed() + // if the new value is different from the old) + weatherDep.changed(); }; /** @@ -512,7 +540,7 @@ Meteor.methods({checkTwitter: function (userId) { check(userId, String); this.unblock(); var result = HTTP.call("GET", "http://api.twitter.com/xyz", - {params: {user: userId}}); + {params: {user: userId}}); if (result.statusCode === 200) return true return false; @@ -520,12 +548,12 @@ Meteor.methods({checkTwitter: function (userId) { HTTP.call("POST", "http://api.twitter.com/xyz", - {data: {some: "json", stuff: 1}}, - function (error, result) { - if (result.statusCode === 200) { - Session.set("twizzled", true); - } - }); + {data: {some: "json", stuff: 1}}, + function (error, result) { + if (result.statusCode === 200) { + Session.set("twizzled", true); + } + }); /** * From Email, Email.send section @@ -542,9 +570,9 @@ Meteor.methods({ // In your client code: asynchronously send an email Meteor.call('sendEmail', - 'alice@example.com', - 'Hello from Meteor!', - 'This is a test of Email.send.'); + 'alice@example.com', + 'Hello from Meteor!', + 'This is a test of Email.send.'); var testTemplate = new Blaze.Template(); var testView = new Blaze.View(); @@ -562,8 +590,8 @@ Blaze.toHTMLWithData(testTemplate, function() {}); Blaze.toHTMLWithData(testView, {test: 1}); Blaze.toHTMLWithData(testView, function() {}); -var reactiveVar1 = new ReactiveVar('test value'); -var reactiveVar2 = new ReactiveVar('test value', function(oldVal) { return true; }); +var reactiveVar1 = new ReactiveVar('test value'); +var reactiveVar2 = new ReactiveVar('test value', function(oldVal) { return true; }); var varValue: string = reactiveVar1.get(); reactiveVar1.set('new value'); \ No newline at end of file diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index e645470966f756..4118fbe062e1d6 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Meteor 1.0.3.1 +// Type definitions for Meteor 1.1.0.1 // Project: http://www.meteor.com/ // Definitions by: Dave Allen // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -7,344 +7,419 @@ * These are the modules and interfaces that can't be automatically generated from the Meteor data.js file */ -interface EJSON extends JSON {} -interface TemplateStatic { - new(): Template; - [templateName: string]: Meteor.TemplatePage; +interface EJSONable { + [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSON.CustomType; +} +interface JSONable { + [key: string]: number | string | boolean | Object | number[] | string[] | Object[]; } +interface EJSON extends EJSONable {} declare module Match { - var Any; - var String; - var Integer; - var Boolean; - var undefined; - //function null(); // not allowed in TypeScript - var Object; - function Optional(pattern):boolean; - function ObjectIncluding(dico):boolean; - function OneOf(...patterns); - function Where(condition); + var Any; + var String; + var Integer; + var Boolean; + var undefined; + //function null(); // not allowed in TypeScript + var Object; + function Optional(pattern):boolean; + function ObjectIncluding(dico):boolean; + function OneOf(...patterns); + function Where(condition); } declare module Meteor { - //interface EJSONObject extends Object {} - - /** Start definitions for Template **/ - // DA: "Template" needs to support these functions: - // Template..rendered - // Template..created - // Template..destroyed - // Template..helpers - // Template..events - // and - // Template.currentData - // Template.parentData, etc. - - interface Event { - type:string; - target:HTMLElement; - currentTarget:HTMLElement; - which: number; - stopPropagation():void; - stopImmediatePropagation():void; - preventDefault():void; - isPropagationStopped():boolean; - isImmediatePropagationStopped():boolean; - isDefaultPrevented():boolean; - } - - interface EventHandlerFunction extends Function { - (event?:Meteor.Event):any; - } - - interface EventMap { - [id:string]:Meteor.EventHandlerFunction; - } - - interface TemplatePage { - rendered: Function; - created: Function; - destroyed: Function; - events(eventMap:Meteor.EventMap): void; - helpers(helpers:{[id:string]: any}): void; - } - /** End definitions for Template **/ - - interface LoginWithExternalServiceOptions { - requestPermissions?: string[]; - requestOfflineToken?: Boolean; - forceApprovalPrompt?: Boolean; - userEmail?: string; - loginStyle?: string; - } - - function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; - - interface UserEmail { - address:string; - verified:boolean; - } - - interface User { - _id?:string; - username?:string; - emails?:Meteor.UserEmail[]; - createdAt?: number; - profile?: any; - services?: any; - } - - interface SubscriptionHandle { - stop(): void; - ready(): boolean; - } - - interface Tinytest { - add(name:string, func:Function); - addAsync(name:string, func:Function); - } - - enum StatusEnum { - connected, - connecting, - failed, - waiting, - offline - } - - interface LiveQueryHandle { - stop(): void; - } - - interface EmailFields { - subject?: Function; - text?: Function; - } - - interface EmailTemplates { - from: string; - siteName: string; - resetPassword: Meteor.EmailFields; - enrollAccount: Meteor.EmailFields; - verifyEmail: Meteor.EmailFields; - } - - interface Error { - error: number; - reason?: string; - details?: string; - } - - interface Connection { - id: string; - close: Function; - onClose: Function; - clientAddress: string; - httpHeaders: Object; - } + /** Start definitions for Template **/ + interface Event { + type:string; + target:HTMLElement; + currentTarget:HTMLElement; + which: number; + stopPropagation():void; + stopImmediatePropagation():void; + preventDefault():void; + isPropagationStopped():boolean; + isImmediatePropagationStopped():boolean; + isDefaultPrevented():boolean; + } + + interface EventHandlerFunction extends Function { + (event?:Meteor.Event):void; + } + + interface EventMap { + [id:string]:Meteor.EventHandlerFunction; + } + /** End definitions for Template **/ + + interface LoginWithExternalServiceOptions { + requestPermissions?: string[]; + requestOfflineToken?: Boolean; + forceApprovalPrompt?: Boolean; + userEmail?: string; + loginStyle?: string; + } + + function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void; + + interface UserEmail { + address:string; + verified:boolean; + } + + interface User { + _id?:string; + username?:string; + emails?:Meteor.UserEmail[]; + createdAt?: number; + profile?: any; + services?: any; + } + + interface SubscriptionHandle { + stop(): void; + ready(): boolean; + } + + interface Tinytest { + add(name:string, func:Function); + addAsync(name:string, func:Function); + } + + enum StatusEnum { + connected, + connecting, + failed, + waiting, + offline + } + + interface LiveQueryHandle { + stop(): void; + } + + interface EmailFields { + subject?: Function; + text?: Function; + } + + interface EmailTemplates { + from: string; + siteName: string; + resetPassword: Meteor.EmailFields; + enrollAccount: Meteor.EmailFields; + verifyEmail: Meteor.EmailFields; + } + + interface Error { + error: number; + reason?: string; + details?: string; + } + + interface Connection { + id: string; + close: Function; + onClose: Function; + clientAddress: string; + httpHeaders: Object; + } } declare module Mongo { - interface Selector extends Object {} - interface Modifier {} - interface SortSpecifier {} - interface FieldSpecifier { - [id: string]: Number; - } - enum IdGenerationEnum { - STRING, - MONGO - } - interface AllowDenyOptions { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; - fetch?: string[]; - transform?: Function; - } + interface Selector extends Object {} + interface Modifier {} + interface SortSpecifier {} + interface FieldSpecifier { + [id: string]: Number; + } + enum IdGenerationEnum { + STRING, + MONGO + } + interface AllowDenyOptions { + insert?: (userId:string, doc) => boolean; + update?: (userId, doc, fieldNames, modifier) => boolean; + remove?: (userId, doc) => boolean; + fetch?: string[]; + transform?: Function; + } } declare module HTTP { - interface HTTPRequest { - content?:string; - data?:any; - query?:string; - params?:{[id:string]:string}; - auth?:string; - headers?:{[id:string]:string}; - timeout?:number; - followRedirects?:boolean; - } - - interface HTTPResponse { - statusCode:number; - content:string; - // response is not always json - data:any; - headers:{[id:string]:string}; - } + + interface HTTPRequest { + content?:string; + data?:any; + query?:string; + params?:{[id:string]:string}; + auth?:string; + headers?:{[id:string]:string}; + timeout?:number; + followRedirects?:boolean; + } + + interface HTTPResponse { + statusCode?:number; + headers?:{[id:string]: string}; + content?:string; + data?:any; + } + + function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?:Function):HTTP.HTTPResponse; + function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse; + } declare module Email { - interface EmailMessage { - from: string; - to: any; // string or string[] - cc?: any; // string or string[] - bcc?: any; // string or string[] - replyTo?: any; // string or string[] - subject: string; - text?: string; - html?: string; - headers?: {[id: string]: string}; - } + interface EmailMessage { + from: string; + to: any; // string or string[] + cc?: any; // string or string[] + bcc?: any; // string or string[] + replyTo?: any; // string or string[] + subject: string; + text?: string; + html?: string; + headers?: {[id: string]: string}; + } } declare module DDP { - interface DDPStatic { - subscribe(name, ...rest); - call(method:string, ...parameters):void; - apply(method:string, ...parameters):void; - methods(IMeteorMethodsDictionary); - status():DDPStatus; - reconnect(); - disconnect(); - onReconnect(); - } - - interface DDPStatus { - connected: boolean; - status: Meteor.StatusEnum; - retryCount: number; - //To turn this into an interval until the next reconnection, use retryTime - (new Date()).getTime() - retryTime?: number; - reason?: string; - } + interface DDPStatic { + subscribe(name, ...rest); + call(method:string, ...parameters):void; + apply(method:string, ...parameters):void; + methods(IMeteorMethodsDictionary); + status():DDPStatus; + reconnect(); + disconnect(); + onReconnect(); + } + + interface DDPStatus { + connected: boolean; + status: Meteor.StatusEnum; + retryCount: number; + //To turn this into an interval until the next reconnection, use retryTime - (new Date()).getTime() + retryTime?: number; + reason?: string; + } } declare module Random { - function id(numberOfChars?: number): string; - function secret(numberOfChars?: number): string; - function fraction():number; - function hexString(numberOfDigits:number):string; // @param numberOfDigits, @returns a random hex string of the given length - function choice(array:any[]):string; // @param array, @return a random element in array - function choice(str:string):string; // @param str, @return a random char in str + function id(numberOfChars?: number): string; + function secret(numberOfChars?: number): string; + function fraction():number; + function hexString(numberOfDigits:number):string; // @param numberOfDigits, @returns a random hex string of the given length + function choice(array:any[]):string; // @param array, @return a random element in array + function choice(str:string):string; // @param str, @return a random char in str } declare module Blaze { - interface View { - name: string; - parentView: Blaze.View; - isCreated: boolean; - isRendered: boolean; - isDestroyed: boolean; - renderCount: number; - autorun(runFunc: Function): void; - onViewCreated(func: Function): void; - onViewReady(func: Function): void; - onViewDestroyed(func: Function): void; - firstNode(): Node; - lastNode(): Node; - template: Blaze.Template; - templateInstance(): any; - } - interface Template { - viewName: string; - renderFunction: Function; - constructView(): Blaze.View; - } + interface View { + name: string; + parentView: Blaze.View; + isCreated: boolean; + isRendered: boolean; + isDestroyed: boolean; + renderCount: number; + autorun(runFunc: Function): void; + onViewCreated(func: Function): void; + onViewReady(func: Function): void; + onViewDestroyed(func: Function): void; + firstNode(): Node; + lastNode(): Node; + template: Blaze.Template; + templateInstance(): any; + } + interface Template { + viewName: string; + renderFunction: Function; + constructView(): Blaze.View; + } } +declare module BrowserPolicy { + + interface framing { + disallow():void; + restrictToOrigin(origin:string):void; + allowAll():void; + } + interface content { + allowEval():void; + allowInlineStyles():void; + allowInlineScripts():void; + allowSameOriginForAll():void; + allowDataUrlForAll():void; + allowOriginForAll(origin:string):void; + allowImageOrigin(origin:string):void; + allowFrameOrigin(origin:string):void; + allowContentTypeSniffing():void; + allowAllContentOrigin():void; + allowAllContentDataUrl():void; + allowAllContentSameOrigin():void; + + disallowAll():void; + disallowInlineStyles():void; + disallowEval():void; + disallowInlineScripts():void; + disallowFont():void; + disallowObject():void; + disallowAllContent():void; + //TODO: add the basic content types + // allowOrigin(origin) + // allowDataUrl() + // allowSameOrigin() + // disallow() + } +} + +declare module Tracker { + export var ComputationFunction: (computation: Tracker.Computation) => void; + +} + +declare var IterationCallback: (doc: T, index: number, cursor: Mongo.Cursor) => void; + /** * These modules and interfaces are automatically generated from the Meteor api.js file */ declare module Accounts { - var ui: { - config(options: { - requestPermissions?: Object; - requestOfflineToken?: Object; - forceApprovalPrompt?: Object; - passwordSignupFields?: string; - }): void; - }; - var emailTemplates: Meteor.EmailTemplates; + function changePassword(oldPassword: string, newPassword: string, callback?: Function): void; function config(options: { - sendVerificationEmail?: boolean; - forbidClientAccountCreation?: Boolean; - restrictCreationByEmailDomain?: string | Function; - loginExpirationInDays?: number; - oauthSecretKey?: string; - }): void; - function validateLoginAttempt(func: Function): {stop: Function}; - function onLogin(func: Function): {stop: Function}; - function onLoginFailure(func: Function): {stop: Function}; + sendVerificationEmail?: boolean; + forbidClientAccountCreation?: boolean; + restrictCreationByEmailDomain?: string | Function; + loginExpirationInDays?: number; + oauthSecretKey?: string; + }): void; + function createUser(options: { + username?: string; + email?: string; + password?: string; + profile?: Object; + }, callback?: Function): string; + var emailTemplates: Meteor.EmailTemplates; + function forgotPassword(options: { + email?: string; + }, callback?: Function): void; function onCreateUser(func: Function): void; - function validateNewUser(func: Function): void; - function onResetPasswordLink(callback: Function): void; function onEmailVerificationLink(callback: Function): void; function onEnrollmentLink(callback: Function): void; - function createUser(options: { - username?: string; - email?: string; - password?: string; - profile?: Object; - }, callback?: Function): string; - function changePassword(oldPassword: string, newPassword: string, callback?: Function): void; - function forgotPassword(options: { - email?: string; - }, callback?: Function): void; + function onLogin(func: Function): {stop: Function}; + function onLoginFailure(func: Function): {stop: Function}; + function onResetPasswordLink(callback: Function): void; function resetPassword(token: string, newPassword: string, callback?: Function): void; - function verifyEmail(token: string, callback?: Function): void; - function setPassword(userId: string, newPassword: string): void; - function sendResetPasswordEmail(userId: string, email?: string): void; function sendEnrollmentEmail(userId: string, email?: string): void; + function sendResetPasswordEmail(userId: string, email?: string): void; function sendVerificationEmail(userId: string, email?: string): void; + function setPassword(userId: string, newPassword: string, options?: { + logout?: Object; + }): void; + var ui: { + config(options: { + requestPermissions?: Object; + requestOfflineToken?: Object; + forceApprovalPrompt?: Object; + passwordSignupFields?: string; + }): void; + }; + function validateLoginAttempt(func: Function): {stop: Function}; + function validateNewUser(func: Function): void; + function verifyEmail(token: string, callback?: Function): void; +} + +declare module App { + function accessRule(domainRule: string, options?: { + launchExternal?: boolean; + }); /** TODO: add return value **/ +function configurePlugin(pluginName: string, config: Object): void; + function icons(icons: Object): void; + function info(options: { + id?: string; + version?: string; + name?: string; + description?: string; + author?: string; + email?: string; + website?: string; + }): void; + function launchScreens(launchScreens: Object): void; + function setPreference(name: string, value: string): void; +} + +declare module Assets { + function getBinary(assetPath: string, asyncCallback?: Function): EJSON; + function getText(assetPath: string, asyncCallback?: Function): string; } declare module Blaze { - var currentView: Blaze.View; - function With(data: Object | Function, contentFunc: Function): Blaze.View; - function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; - function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; - function isTemplate(value: any): boolean; - function render(templateOrView: Template | Blaze.View, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; - function renderWithData(templateOrView: Template | Blaze.View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; - function remove(renderedView: Blaze.View): void; - function toHTML(templateOrView: Template | Blaze.View): string; - function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string; - function getData(elementOrView?: HTMLElement | Blaze.View): Object; - function getView(element?: HTMLElement): Blaze.View; - function Template(viewName?: string, renderFunction?: Function): void; - interface Template{ + function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; + var Template: TemplateStatic; + interface TemplateStatic { + new(viewName?: string, renderFunction?: Function): Template; + // It should be [templateName: string]: TemplateInstance but this is not possible -- user will need to cast to TemplateInstance + [templateName: string]: any | Template; // added "any" to make it work + head: Template; + find(selector:string):Blaze.Template; + findAll(selector:string):Blaze.Template[]; + $:any; + } + interface Template { } - function TemplateInstance(view: Blaze.View): void; - interface TemplateInstance{ + var TemplateInstance: TemplateInstanceStatic; + interface TemplateInstanceStatic { + new(view: Blaze.View): TemplateInstance; + } + interface TemplateInstance { + $(selector: string): any; + autorun(runFunc: Function): Object; data: Object; - view: Object; + find(selector?: string): Blaze.TemplateInstance; + findAll(selector: string): Blaze.TemplateInstance[]; firstNode: Object; lastNode: Object; - $(selector: string): Node[]; - findAll(selector: string): HTMLElement[]; - find(selector?: string): HTMLElement; - autorun(runFunc: Function): Object; + subscribe(name: string, ...args): Meteor.SubscriptionHandle; + subscriptionsReady(): boolean; + view: Object; } - function View(name?: string, renderFunction?: Function): void; - interface View{ + function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): Blaze.View; + var View: ViewStatic; + interface ViewStatic { + new(name?: string, renderFunction?: Function): View; + } + interface View { } + function With(data: Object | Function, contentFunc: Function): Blaze.View; + var currentView: Blaze.View; + function getData(elementOrView?: HTMLElement | Blaze.View): Object; + function getView(element?: HTMLElement): Blaze.View; + function isTemplate(value: any): boolean; + function remove(renderedView: Blaze.View): void; + function render(templateOrView: Template | Blaze.View, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; + function renderWithData(templateOrView: Template | Blaze.View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: Blaze.View): Blaze.View; + function toHTML(templateOrView: Template | Blaze.View): string; + function toHTMLWithData(templateOrView: Template | Blaze.View, data: Object | Function): string; } -declare module Match { - function test(value: any, pattern: any): boolean; +declare module Cordova { + function depends(dependencies:{[id:string]:string}): void; } declare module DDP { @@ -352,330 +427,355 @@ declare module DDP { } declare module EJSON { - var newBinary: any; - function addType(name: string, factory: Function): void; - function toJSONValue(val: EJSON): JSON; - function fromJSONValue(val: JSON): any; - function stringify(val: EJSON, options?: { - indent?: boolean | number | string; - canonical?: Boolean; - }): string; - function parse(str: string): EJSON; - function isBinary(x: Object): boolean; - function equals(a: EJSON, b: EJSON, options?: { - keyOrderSensitive?: boolean; - }): boolean; - function clone(val:T): T; - function CustomType(): void; - interface CustomType{ - typeName(): string; - toJSONValue(): JSON; + var CustomType: CustomTypeStatic; + interface CustomTypeStatic { + new(): CustomType; + } + interface CustomType { clone(): EJSON.CustomType; equals(other: Object): boolean; + toJSONValue(): JSON; + typeName(): string; } + function addType(name: string, factory: (val: EJSONable) => JSONable): void; + function clone(val:T): T; + function equals(a: EJSON, b: EJSON, options?: { + keyOrderSensitive?: boolean; + }): boolean; + function fromJSONValue(val: JSON): any; + function isBinary(x: Object): boolean; + var newBinary: any; + function parse(str: string): EJSON; + function stringify(val: EJSON, options?: { + indent?: boolean | number | string; + canonical?: boolean; + }): string; + function toJSONValue(val: EJSON): JSON; +} + +declare module Match { + function test(value: any, pattern: any): boolean; } declare module Meteor { - var users: Mongo.Collection; + var Error: ErrorStatic; + interface ErrorStatic { + new(error: string, reason?: string, details?: string): Error; + } + interface Error { + } + + function absoluteUrl(path?: string, options?: { + secure?: boolean; + replaceLocalhost?: boolean; + rootUrl?: string; + }): string; + function apply(name: string, args: EJSONable[], options?: { + wait?: boolean; + onResultReceived?: Function; + }, asyncCallback?: Function): any; + function call(name: string, ...args): any; + function clearInterval(id: number): void; + function clearTimeout(id: number): void; + function disconnect(): void; var isClient: boolean; - var isServer: boolean; - var settings: {[id:string]: any}; var isCordova: boolean; - var release: string; - function userId(): string; + var isServer: boolean; function loggingIn(): boolean; - function user(): Meteor.User; - function logout(callback?: Function): void; - function logoutOtherClients(callback?: Function): void; function loginWith(options?: { - requestPermissions?: string[]; - requestOfflineToken?: boolean; - forceApprovalPrompt?: Boolean; - userEmail?: string; - loginStyle?: string; - }, callback?: Function): void; + requestPermissions?: string[]; + requestOfflineToken?: boolean; + forceApprovalPrompt?: boolean; + userEmail?: string; + loginStyle?: string; + }, callback?: Function): void; function loginWithPassword(user: Object | string, password: string, callback?: Function): void; - function subscribe(name: string, ...args): SubscriptionHandle; - function call(name: string, ...args): void; - function apply(name: string, args: EJSON[], options?: { - wait?: boolean; - onResultReceived?: Function; - }, asyncCallback?: Function): void; - function status(): Meteor.StatusEnum; - function reconnect(): void; - function disconnect(): void; + function logout(callback?: Function): void; + function logoutOtherClients(callback?: Function): void; + function methods(methods: Object): void; function onConnection(callback: Function): void; function publish(name: string, func: Function): void; - function methods(methods: Object): void; - function wrapAsync(func: Function, context?: Object): any; - function startup(func: Function): void; - function setTimeout(func: Function, delay: number): number; + function reconnect(): void; + var release: string; function setInterval(func: Function, delay: number): number; - function clearInterval(id: number): void; - function clearTimeout(id: number): void; - function absoluteUrl(path?: string, options?: { - secure?: boolean; - replaceLocalhost?: Boolean; - rootUrl?: string; - }): string; - function Error(error: string, reason?: string, details?: string): void; - interface Error{ - } - + function setTimeout(func: Function, delay: number): number; + var settings: {[id:string]: any}; + function startup(func: Function): void; + function status(): Meteor.StatusEnum; + function subscribe(name: string, ...args): Meteor.SubscriptionHandle; + function user(): Meteor.User; + function userId(): string; + var users: Mongo.Collection; + function wrapAsync(func: Function, context?: Object): any; } declare module Mongo { - function Collection(name: string, options?: { - connection?: Object; - idGeneration?: string; - transform?: Function; - }): void; - interface Collection{ - insert(doc: Object, callback?: Function): string; - update(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { - multi?: boolean; - upsert?: Boolean; - }, callback?: Function): number; + var Collection: CollectionStatic; + interface CollectionStatic { + new(name: string, options?: { + connection?: Object; + idGeneration?: string; + transform?: Function; + }): Collection; + } + interface Collection { + allow(options: { + insert?: (userId:string, doc) => boolean; + update?: (userId, doc, fieldNames, modifier) => boolean; + remove?: (userId, doc) => boolean; + fetch?: string[]; + transform?: Function; + }): boolean; + deny(options: { + insert?: (userId:string, doc) => boolean; + update?: (userId, doc, fieldNames, modifier) => boolean; + remove?: (userId, doc) => boolean; + fetch?: string[]; + transform?: Function; + }): boolean; find(selector?: Mongo.Selector, options?: { - sort?: Mongo.SortSpecifier; - skip?: number; - limit?: number; - fields?: Mongo.FieldSpecifier; - reactive?: boolean; - transform?: Function; - }): Mongo.Cursor; + sort?: Mongo.SortSpecifier; + skip?: number; + limit?: number; + fields?: Mongo.FieldSpecifier; + reactive?: boolean; + transform?: Function; + }): Mongo.Cursor; findOne(selector?: Mongo.Selector, options?: { - sort?: Mongo.SortSpecifier; - skip?: number; - fields?: Mongo.FieldSpecifier; - reactive?: boolean; - transform?: Function; - }): T; + sort?: Mongo.SortSpecifier; + skip?: number; + fields?: Mongo.FieldSpecifier; + reactive?: boolean; + transform?: Function; + }): T; + insert(doc: Object, callback?: Function): string; remove(selector: Mongo.Selector, callback?: Function): void; + update(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { + multi?: boolean; + upsert?: boolean; + }, callback?: Function): number; upsert(selector: Mongo.Selector, modifier: Mongo.Modifier, options?: { - multi?: boolean; - }, callback?: Function): {numberAffected?: number; insertedId?: string;}; - allow(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; - fetch?: string[]; - transform?: Function; - }): boolean; - deny(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; - fetch?: string[]; - transform?: Function; - }): boolean; + multi?: boolean; + }, callback?: Function): {numberAffected?: number; insertedId?: string;}; + _ensureIndex(indexName: string, options?: {[key: string]: any}): void; } - function ObjectID(hexString: string): void; - interface ObjectID{ + var Cursor: CursorStatic; + interface CursorStatic { + new(): Cursor; } - - function Cursor(): void; - interface Cursor{ - forEach(callback: Function, thisArg?: any): void; - map(callback: Function, thisArg?: any): void; - fetch(): Array; + interface Cursor { count(): number; + fetch(): Array; + forEach(callback: (doc: T, index: number, cursor: Mongo.Cursor) => void, thisArg?: any): void; + map(callback: (doc: T, index: number, cursor: Mongo.Cursor) => void, thisArg?: any): Array; observe(callbacks: Object): Meteor.LiveQueryHandle; observeChanges(callbacks: Object): Meteor.LiveQueryHandle; } -} - -declare module Tracker { - var active: boolean; - var currentComputation: Tracker.Computation; - function Computation(): void; - interface Computation{ - stopped: boolean; - invalidated: boolean; - firstRun: boolean; - onInvalidate(callback: Function): void; - invalidate(): void; - stop(): void; + var ObjectID: ObjectIDStatic; + interface ObjectIDStatic { + new(hexString: string): ObjectID; } - - function flush(): void; - function autorun(runFunc: Function): Tracker.Computation; - function nonreactive(func: Function): void; - function onInvalidate(callback: Function): void; - function afterFlush(callback: Function): void; - function Dependency(): void; - interface Dependency{ - depend(fromComputation?: Tracker.Computation): boolean - changed(): void; - hasDependents(): boolean + interface ObjectID { } } -declare module Assets { - function getText(assetPath: string, asyncCallback?: Function): string; - function getBinary(assetPath: string, asyncCallback?: Function): EJSON; -} - -declare module App { - function info(options: { - id?: string; - version?: string; - name?: string; - description?: string; - author?: string; - email?: string; - website?: string; - }): void; - function setPreference(name: string, value: string): void; - function configurePlugin(pluginName: string, config: Object): void; - function icons(icons: Object): void; - function launchScreens(launchScreens: Object): void; +declare module Npm { + function depends(dependencies:{[id:string]:string}): void; + function require(name: string): any; } declare module Package { function describe(options: { - summary?: string; - version?: string; - name?: string; - git?: string; - documentation?: string; - }): void; - function onUse(func: Function): void; + summary?: string; + version?: string; + name?: string; + git?: string; + documentation?: string; + }): void; function onTest(func: Function): void; + function onUse(func: Function): void; function registerBuildPlugin(options?: { - name?: string; - use?: string | string[]; - sources?: string[]; - npmDependencies?: Object; - }): void; + name?: string; + use?: string | string[]; + sources?: string[]; + npmDependencies?: Object; + }): void; } -declare module Npm { - function depends(dependencies:{[id:string]:string}): void; - function require(name: string): void; -} +declare module Tracker { + function Computation(): void; + interface Computation { + firstRun: boolean; + invalidate(): void; + invalidated: boolean; + onInvalidate(callback: Function): void; + stop(): void; + stopped: boolean; + } -declare module Cordova { - function depends(dependencies:{[id:string]:string}): void; + var Dependency: DependencyStatic; + interface DependencyStatic { + new(): Dependency; + } + interface Dependency { + changed(): void; + depend(fromComputation?: Tracker.Computation): boolean; + hasDependents(): boolean; + } + + var active: boolean; + function afterFlush(callback: Function): void; + function autorun(runFunc: (computation: Tracker.Computation) => void, options?: { + onError?: Function; + }): Tracker.Computation; + var currentComputation: Tracker.Computation; + function flush(): void; + function nonreactive(func: Function): void; + function onInvalidate(callback: Function): void; } declare module Session { - function set(key: string, value: EJSON | any /** Undefined **/): void; - function setDefault(key: string, value: EJSON | any /** Undefined **/): void; - function get(key: string): any; 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 { function call(method: string, url: string, options?: { - content?: string; - data?: Object; - query?: string; - params?: Object; - auth?: string; - headers?: Object; - timeout?: number; - followRedirects?: boolean; - }, asyncCallback?: Function): HTTP.HTTPResponse; + content?: string; + data?: Object; + query?: string; + params?: Object; + auth?: string; + headers?: Object; + timeout?: number; + followRedirects?: boolean; + npmRequestOptions?: Object; + }, asyncCallback?: Function): HTTP.HTTPResponse; + function del(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; function get(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; function post(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; function put(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; - function del(url: string, callOptions?: Object, asyncCallback?: Function): HTTP.HTTPResponse; } declare module Email { function send(options: { - from?: string; - to?: string | string[]; - cc?: string | string[]; - bcc?: string | string[]; - replyTo?: string | string[]; - subject?: string; - text?: string; - html?: string; - headers?: Object; - }): void; -} - -declare function Subscription(): void; -interface Subscription{ - connection: Meteor.Connection; - userId: string; - error(error: Error): void; - stop(): void; - onStop(func: Function): void; - added(collection: string, id: string, fields: Object): void; - changed(collection: string, id: string, fields: Object): void; - removed(collection: string, id: string): void; - ready(): void; + from?: string; + to?: string | string[]; + cc?: string | string[]; + bcc?: string | string[]; + replyTo?: string | string[]; + subject?: string; + text?: string; + html?: string; + headers?: Object; + attachments?: Object[]; + }): void; } -declare function ReactiveVar(initialValue: T, equalsFunc?: Function): void; -interface ReactiveVar{ +declare var CompileStep: CompileStepStatic; +interface CompileStepStatic { + new(): CompileStep; +} +interface CompileStep { + addAsset(options: { + }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ + addHtml(options: { + section?: string; + data?: string; + }); /** TODO: add return value **/ + addJavaScript(options: { + path?: string; + data?: string; + sourcePath?: string; + }); /** TODO: add return value **/ + addStylesheet(options: { + }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ + arch; /** TODO: add return value **/ + declaredExports; /** TODO: add return value **/ + error(options: { + }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ + fileOptions; /** TODO: add return value **/ + fullInputPath; /** TODO: add return value **/ + inputPath; /** TODO: add return value **/ + inputSize; /** TODO: add return value **/ + packageName; /** TODO: add return value **/ + pathForSourceMap; /** TODO: add return value **/ + read(n?: number): any; + rootOutputPath; /** TODO: add return value **/ +} + +declare var PackageAPI: PackageAPIStatic; +interface PackageAPIStatic { + new(): PackageAPI; +} +interface PackageAPI { + addFiles(filename: string | string[], architecture?: string): void; + export(exportedObject: string, architecture?: string): void; + imply(packageSpecs: string | string[]): void; + use(packageNames: string | string[], architecture?: string, options?: { + weak?: boolean; + unordered?: boolean; + }): void; + versionsFrom(meteorRelease: string | string[]): void; +} + +declare var ReactiveVar: ReactiveVarStatic; +interface ReactiveVarStatic { + new(initialValue: T, equalsFunc?: Function): ReactiveVar; +} +interface ReactiveVar { get(): T; set(newValue: T): void; } +declare var Subscription: SubscriptionStatic; +interface SubscriptionStatic { + new(): Subscription; +} +interface Subscription { + added(collection: string, id: string, fields: Object): void; + changed(collection: string, id: string, fields: Object): void; + connection: Meteor.Connection; + error(error: Error): void; + onStop(func: Function): void; + ready(): void; + removed(collection: string, id: string): void; + stop(): void; + userId: string; +} + declare var Template: TemplateStatic; -// TemplateStatic interface should be defined separately at top with static methods -interface Template{ - onCreated: Function; - onRendered: Function; - onDestroyed: Function; - created: Function; - rendered: Function; - destroyed: Function; - body: TemplateStatic; - helpers(helpers:{[id:string]: any}): void; - events(eventMap: {[actions: string]: Function}): void; - instance(): Blaze.TemplateInstance; +interface TemplateStatic { + new(): Template; + // It should be [templateName: string]: TemplateInstance but this is not possible -- user will need to cast to TemplateInstance + [templateName: string]: any | Template; // added "any" to make it work + head: Template; + find(selector:string):Blaze.Template; + findAll(selector:string):Blaze.Template[]; + $:any; + body: Template; currentData(): {}; + instance(): Blaze.TemplateInstance; parentData(numLevels?: number): {}; registerHelper(name: string, helperFunction: Function): void; } - -declare function CompileStep(): void; -interface CompileStep{ - inputSize; /** TODO: add return value **/ - inputPath; /** TODO: add return value **/ - fullInputPath; /** TODO: add return value **/ - pathForSourceMap; /** TODO: add return value **/ - packageName; /** TODO: add return value **/ - rootOutputPath; /** TODO: add return value **/ - arch; /** TODO: add return value **/ - fileOptions; /** TODO: add return value **/ - declaredExports; /** TODO: add return value **/ - read(n?: number); /** TODO: add return value **/ - addHtml(options: { - section?: string; - data?: string; - }); /** TODO: add return value **/ - addStylesheet(options: { - }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ - addJavaScript(options: { - path?: string; - data?: string; - sourcePath?: string; - }); /** TODO: add return value **/ - addAsset(options: { - }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ - error(options: { - }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ -} - -declare function PackageAPI(): void; -interface PackageAPI{ - use(packageNames: string | string[], architecture?: string, options?: { - weak?: boolean; - unordered?: Boolean; - }): void; - imply(packageSpecs: string | string[]): void; - addFiles(filename: string | string[], architecture?: string): void; - versionsFrom(meteorRelease: string | string[]): void; - export(exportedObject: string, architecture?: string): void; +interface Template { + created: Function; + destroyed: Function; + events(eventMap: {[actions: string]: Function}): void; + helpers(helpers:{[id:string]: any}): void; + onCreated: Function; + onDestroyed: Function; + onRendered: Function; + rendered: Function; } +declare function MethodInvocation(options: { +}); /** TODO: add return value **/ +declare function check(value: any, pattern: any): void;