diff --git a/meteor-publish-composite/meteor-publish-composite-tests.ts b/meteor-publish-composite/meteor-publish-composite-tests.ts
new file mode 100644
index 0000000000..ad84c0f3ae
--- /dev/null
+++ b/meteor-publish-composite/meteor-publish-composite-tests.ts
@@ -0,0 +1,60 @@
+///
+///
+
+import User = Meteor.User;
+interface IPost { _id : string, authorId : string };
+interface IComment { authorId : string };
+var Posts : Mongo.Collection = new Mongo.Collection('Posts');
+var Comments : Mongo.Collection = new Mongo.Collection('Comments');
+
+// Server
+Meteor.publishComposite('topTenPosts', {
+ find: function() : Mongo.Cursor {
+ // Find top ten highest scoring posts
+ return Posts.find({}, { sort: { score: -1 }, limit: 10 });
+ },
+ children: [
+ {
+ find: function(post) {
+ // Find post author. Even though we only want to return
+ // one record here, we use "find" instead of "findOne"
+ // since this function should return a cursor.
+ return Meteor.users.find(
+ { _id: post.authorId },
+ { limit: 1, fields: { profile: 1 } });
+ }
+ },
+ {
+ find: function(post) {
+ // Find top two comments on post
+ return Comments.find(
+ { postId: post._id },
+ { sort: { score: -1 }, limit: 2 });
+ },
+ children: [
+ {
+ find: function(comment, post) {
+ // Find user that authored comment.
+ return Meteor.users.find(
+ { _id: comment.authorId },
+ { limit: 1, fields: { profile: 1 } });
+ }
+ }
+ ]
+ }
+ ]
+});
+
+// Server
+Meteor.publishComposite('postsByUser', function(userId, limit) {
+ return {
+ find: function() {
+ // Find posts made by user. Note arguments for callback function
+ // being used in query.
+ return Posts.find({ authorId: userId }, { limit: limit });
+ },
+ children: [
+ // This section will be similar to that of the previous example.
+ ]
+ }
+});
diff --git a/meteor-publish-composite/meteor-publish-composite.d.ts b/meteor-publish-composite/meteor-publish-composite.d.ts
new file mode 100644
index 0000000000..6b7c0308cc
--- /dev/null
+++ b/meteor-publish-composite/meteor-publish-composite.d.ts
@@ -0,0 +1,39 @@
+// Type definitions for meteor-publish-composite
+// Project: https://github.com/englue/meteor-publish-composite
+// Definitions by: Robert Van Gorkom
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare interface IPublishCompositeConfigN {
+ children? : IPublishCompositeConfigN[];
+ find(...args : any[]) : Mongo.Cursor;
+}
+
+declare interface IPublishCompositeConfig4 {
+ children? : IPublishCompositeConfigN[];
+ find(arg1 : InLevel1, arg2 : InLevel2, arg3 : InLevel3, arg4 : InLevel4) : Mongo.Cursor;
+}
+
+declare interface IPublishCompositeConfig3 {
+ children? : IPublishCompositeConfig4[];
+ find(arg1 : InLevel1, arg2 : InLevel2, arg3 : InLevel3) : Mongo.Cursor;
+}
+
+declare interface IPublishCompositeConfig2 {
+ children? : IPublishCompositeConfig3[];
+ find(arg1 : InLevel1, arg2 : InLevel2) : Mongo.Cursor;
+}
+
+declare interface IPublishCompositeConfig1 {
+ children? : IPublishCompositeConfig2[];
+ find(arg1 : InLevel1) : Mongo.Cursor;
+}
+
+declare interface IPublishCompositeConfig {
+ children? : IPublishCompositeConfig1[];
+ find() : Mongo.Cursor;
+}
+
+declare module Meteor {
+ function publishComposite(name : string, config : IPublishCompositeConfig) : void;
+ function publishComposite(name : string, configFunc : (...args : any[]) => IPublishCompositeConfig) : void;
+}