Skip to content

Commit

Permalink
chore(all): update types for d.ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jul 8, 2015
1 parent 0d67d4b commit 358a086
Show file tree
Hide file tree
Showing 12 changed files with 203 additions and 64 deletions.
30 changes: 22 additions & 8 deletions dist/amd/aurelia-framework.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare module 'aurelia-framework' {
* @param {Aurelia} aurelia An instance of Aurelia.
*/
export class Plugins {
constructor(aurelia: any);
constructor(aurelia: Aurelia);

/**
* Configures a plugin before Aurelia starts.
Expand All @@ -25,7 +25,7 @@ declare module 'aurelia-framework' {
* @param {config} config The configuration for the specified module.
* @return {Plugins} Returns the current Plugins instance.
*/
plugin(moduleId: any, config: any): any;
plugin(moduleId: string, config: any): Plugins;
}

/**
Expand All @@ -38,7 +38,11 @@ declare module 'aurelia-framework' {
* @param {ResourceRegistry} resources The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.
*/
export class Aurelia {
constructor(loader: any, container: any, resources: any);
loader: Loader;
container: Container;
resources: ResourceRegistry;
use: Plugins;
constructor(loader?: Loader, container?: Container, resources?: ResourceRegistry);

/**
* Adds an existing object to the framework's dependency injection container.
Expand All @@ -48,7 +52,7 @@ declare module 'aurelia-framework' {
* @param {Object} instance The existing instance of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withInstance(type: any, instance: any): any;
withInstance(type: any, instance: any): Aurelia;

/**
* Adds a singleton to the framework's dependency injection container.
Expand All @@ -58,7 +62,17 @@ declare module 'aurelia-framework' {
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withSingleton(type: any, implementation: any): any;
withSingleton(type: any, implementation?: Function): Aurelia;

/**
* Adds a transient to the framework's dependency injection container.
*
* @method withTransient
* @param {Class} type The object type of the dependency that the framework will inject.
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withTransient(type: any, implementation?: Function): Aurelia;

/**
* Adds globally available view resources to be imported into the Aurelia framework.
Expand All @@ -67,7 +81,7 @@ declare module 'aurelia-framework' {
* @param {Object|Array} resources The relative module id to the resource. (Relative to the plugin's installer.)
* @return {Aurelia} Returns the current Aurelia instance.
*/
globalizeResources(resources: any): any;
globalizeResources(resources: string | string[]): Aurelia;

/**
* Renames a global resource that was imported.
Expand All @@ -77,7 +91,7 @@ declare module 'aurelia-framework' {
* @param {String} newName The new name.
* @return {Aurelia} Returns the current Aurelia instance.
*/
renameGlobalResource(resourcePath: any, newName: any): any;
renameGlobalResource(resourcePath: string, newName: string): Aurelia;

/**
* Loads plugins, then resources, and then starts the Aurelia instance.
Expand All @@ -95,7 +109,7 @@ declare module 'aurelia-framework' {
* @param {string|Object} applicationHost The DOM object that Aurelia will attach to.
* @return {Aurelia} Returns the current Aurelia instance.
*/
setRoot(root?: any, applicationHost?: any): any;
setRoot(root?: string, applicationHost?: any): any;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
return this;
};

Aurelia.prototype.withTransient = function withTransient(type, implementation) {
this.container.registerTransient(type, implementation);
return this;
};

Aurelia.prototype.globalizeResources = function globalizeResources(resources) {
var toAdd = Array.isArray(resources) ? resources : arguments,
i,
Expand Down
30 changes: 22 additions & 8 deletions dist/commonjs/aurelia-framework.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare module 'aurelia-framework' {
* @param {Aurelia} aurelia An instance of Aurelia.
*/
export class Plugins {
constructor(aurelia: any);
constructor(aurelia: Aurelia);

/**
* Configures a plugin before Aurelia starts.
Expand All @@ -25,7 +25,7 @@ declare module 'aurelia-framework' {
* @param {config} config The configuration for the specified module.
* @return {Plugins} Returns the current Plugins instance.
*/
plugin(moduleId: any, config: any): any;
plugin(moduleId: string, config: any): Plugins;
}

/**
Expand All @@ -38,7 +38,11 @@ declare module 'aurelia-framework' {
* @param {ResourceRegistry} resources The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.
*/
export class Aurelia {
constructor(loader: any, container: any, resources: any);
loader: Loader;
container: Container;
resources: ResourceRegistry;
use: Plugins;
constructor(loader?: Loader, container?: Container, resources?: ResourceRegistry);

/**
* Adds an existing object to the framework's dependency injection container.
Expand All @@ -48,7 +52,7 @@ declare module 'aurelia-framework' {
* @param {Object} instance The existing instance of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withInstance(type: any, instance: any): any;
withInstance(type: any, instance: any): Aurelia;

/**
* Adds a singleton to the framework's dependency injection container.
Expand All @@ -58,7 +62,17 @@ declare module 'aurelia-framework' {
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withSingleton(type: any, implementation: any): any;
withSingleton(type: any, implementation?: Function): Aurelia;

/**
* Adds a transient to the framework's dependency injection container.
*
* @method withTransient
* @param {Class} type The object type of the dependency that the framework will inject.
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withTransient(type: any, implementation?: Function): Aurelia;

/**
* Adds globally available view resources to be imported into the Aurelia framework.
Expand All @@ -67,7 +81,7 @@ declare module 'aurelia-framework' {
* @param {Object|Array} resources The relative module id to the resource. (Relative to the plugin's installer.)
* @return {Aurelia} Returns the current Aurelia instance.
*/
globalizeResources(resources: any): any;
globalizeResources(resources: string | string[]): Aurelia;

/**
* Renames a global resource that was imported.
Expand All @@ -77,7 +91,7 @@ declare module 'aurelia-framework' {
* @param {String} newName The new name.
* @return {Aurelia} Returns the current Aurelia instance.
*/
renameGlobalResource(resourcePath: any, newName: any): any;
renameGlobalResource(resourcePath: string, newName: string): Aurelia;

/**
* Loads plugins, then resources, and then starts the Aurelia instance.
Expand All @@ -95,7 +109,7 @@ declare module 'aurelia-framework' {
* @param {string|Object} applicationHost The DOM object that Aurelia will attach to.
* @return {Aurelia} Returns the current Aurelia instance.
*/
setRoot(root?: any, applicationHost?: any): any;
setRoot(root?: string, applicationHost?: any): any;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ var Aurelia = (function () {
return this;
};

Aurelia.prototype.withTransient = function withTransient(type, implementation) {
this.container.registerTransient(type, implementation);
return this;
};

Aurelia.prototype.globalizeResources = function globalizeResources(resources) {
var toAdd = Array.isArray(resources) ? resources : arguments,
i,
Expand Down
30 changes: 22 additions & 8 deletions dist/es6/aurelia-framework.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare module 'aurelia-framework' {
* @param {Aurelia} aurelia An instance of Aurelia.
*/
export class Plugins {
constructor(aurelia: any);
constructor(aurelia: Aurelia);

/**
* Configures a plugin before Aurelia starts.
Expand All @@ -25,7 +25,7 @@ declare module 'aurelia-framework' {
* @param {config} config The configuration for the specified module.
* @return {Plugins} Returns the current Plugins instance.
*/
plugin(moduleId: any, config: any): any;
plugin(moduleId: string, config: any): Plugins;
}

/**
Expand All @@ -38,7 +38,11 @@ declare module 'aurelia-framework' {
* @param {ResourceRegistry} resources The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.
*/
export class Aurelia {
constructor(loader: any, container: any, resources: any);
loader: Loader;
container: Container;
resources: ResourceRegistry;
use: Plugins;
constructor(loader?: Loader, container?: Container, resources?: ResourceRegistry);

/**
* Adds an existing object to the framework's dependency injection container.
Expand All @@ -48,7 +52,7 @@ declare module 'aurelia-framework' {
* @param {Object} instance The existing instance of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withInstance(type: any, instance: any): any;
withInstance(type: any, instance: any): Aurelia;

/**
* Adds a singleton to the framework's dependency injection container.
Expand All @@ -58,7 +62,17 @@ declare module 'aurelia-framework' {
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withSingleton(type: any, implementation: any): any;
withSingleton(type: any, implementation?: Function): Aurelia;

/**
* Adds a transient to the framework's dependency injection container.
*
* @method withTransient
* @param {Class} type The object type of the dependency that the framework will inject.
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withTransient(type: any, implementation?: Function): Aurelia;

/**
* Adds globally available view resources to be imported into the Aurelia framework.
Expand All @@ -67,7 +81,7 @@ declare module 'aurelia-framework' {
* @param {Object|Array} resources The relative module id to the resource. (Relative to the plugin's installer.)
* @return {Aurelia} Returns the current Aurelia instance.
*/
globalizeResources(resources: any): any;
globalizeResources(resources: string | string[]): Aurelia;

/**
* Renames a global resource that was imported.
Expand All @@ -77,7 +91,7 @@ declare module 'aurelia-framework' {
* @param {String} newName The new name.
* @return {Aurelia} Returns the current Aurelia instance.
*/
renameGlobalResource(resourcePath: any, newName: any): any;
renameGlobalResource(resourcePath: string, newName: string): Aurelia;

/**
* Loads plugins, then resources, and then starts the Aurelia instance.
Expand All @@ -95,7 +109,7 @@ declare module 'aurelia-framework' {
* @param {string|Object} applicationHost The DOM object that Aurelia will attach to.
* @return {Aurelia} Returns the current Aurelia instance.
*/
setRoot(root?: any, applicationHost?: any): any;
setRoot(root?: string, applicationHost?: any): any;
}

/**
Expand Down
34 changes: 26 additions & 8 deletions dist/es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function loadPlugin(aurelia, loader, info){
* @param {Aurelia} aurelia An instance of Aurelia.
*/
export class Plugins {
constructor(aurelia){
constructor(aurelia:Aurelia){
this.aurelia = aurelia;
this.info = [];
this.processed = false;
Expand All @@ -47,7 +47,7 @@ export class Plugins {
* @param {config} config The configuration for the specified module.
* @return {Plugins} Returns the current Plugins instance.
*/
plugin(moduleId, config){
plugin(moduleId:string, config:any):Plugins{
var plugin = {moduleId:moduleId, config:config || {}};

if(this.processed){
Expand Down Expand Up @@ -136,7 +136,12 @@ function loadResources(container, resourcesToLoad, appResources){
* @param {ResourceRegistry} resources The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.
*/
export class Aurelia {
constructor(loader, container, resources){
loader:Loader;
container:Container;
resources:ResourceRegistry;
use:Plugins;

constructor(loader?:Loader, container?:Container, resources?:ResourceRegistry){
this.loader = loader || new window.AureliaLoader();
this.container = container || new Container();
this.resources = resources || new ResourceRegistry();
Expand All @@ -158,7 +163,7 @@ export class Aurelia {
* @param {Object} instance The existing instance of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withInstance(type, instance){
withInstance(type:any, instance:any):Aurelia{
this.container.registerInstance(type, instance);
return this;
}
Expand All @@ -171,19 +176,32 @@ export class Aurelia {
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withSingleton(type, implementation){
withSingleton(type:any, implementation?:Function):Aurelia{
this.container.registerSingleton(type, implementation);
return this;
}

/**
* Adds a transient to the framework's dependency injection container.
*
* @method withTransient
* @param {Class} type The object type of the dependency that the framework will inject.
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
* @return {Aurelia} Returns the current Aurelia instance.
*/
withTransient(type:any, implementation?:Function):Aurelia{
this.container.registerTransient(type, implementation);
return this;
}

/**
* Adds globally available view resources to be imported into the Aurelia framework.
*
* @method globalizeResources
* @param {Object|Array} resources The relative module id to the resource. (Relative to the plugin's installer.)
* @return {Aurelia} Returns the current Aurelia instance.
*/
globalizeResources(resources){
globalizeResources(resources:string|string[]):Aurelia{
var toAdd = Array.isArray(resources) ? resources : arguments,
i, ii, resource, pluginPath = this.currentPluginId || '', path,
internalPlugin = pluginPath.startsWith('./');
Expand Down Expand Up @@ -212,7 +230,7 @@ export class Aurelia {
* @param {String} newName The new name.
* @return {Aurelia} Returns the current Aurelia instance.
*/
renameGlobalResource(resourcePath, newName){
renameGlobalResource(resourcePath:string, newName:string):Aurelia{
this.resourcesToLoad[resourcePath] = newName;
return this;
}
Expand Down Expand Up @@ -261,7 +279,7 @@ export class Aurelia {
* @param {string|Object} applicationHost The DOM object that Aurelia will attach to.
* @return {Aurelia} Returns the current Aurelia instance.
*/
setRoot(root='app', applicationHost=null){
setRoot(root:string='app', applicationHost=null){
var compositionEngine, instruction = {};

applicationHost = applicationHost || this.host;
Expand Down
Loading

0 comments on commit 358a086

Please sign in to comment.