Skip to content

Commit 358a086

Browse files
chore(all): update types for d.ts files
1 parent 0d67d4b commit 358a086

12 files changed

+203
-64
lines changed

dist/amd/aurelia-framework.d.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare module 'aurelia-framework' {
1515
* @param {Aurelia} aurelia An instance of Aurelia.
1616
*/
1717
export class Plugins {
18-
constructor(aurelia: any);
18+
constructor(aurelia: Aurelia);
1919

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

3131
/**
@@ -38,7 +38,11 @@ declare module 'aurelia-framework' {
3838
* @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.
3939
*/
4040
export class Aurelia {
41-
constructor(loader: any, container: any, resources: any);
41+
loader: Loader;
42+
container: Container;
43+
resources: ResourceRegistry;
44+
use: Plugins;
45+
constructor(loader?: Loader, container?: Container, resources?: ResourceRegistry);
4246

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

5357
/**
5458
* Adds a singleton to the framework's dependency injection container.
@@ -58,7 +62,17 @@ declare module 'aurelia-framework' {
5862
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
5963
* @return {Aurelia} Returns the current Aurelia instance.
6064
*/
61-
withSingleton(type: any, implementation: any): any;
65+
withSingleton(type: any, implementation?: Function): Aurelia;
66+
67+
/**
68+
* Adds a transient to the framework's dependency injection container.
69+
*
70+
* @method withTransient
71+
* @param {Class} type The object type of the dependency that the framework will inject.
72+
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
73+
* @return {Aurelia} Returns the current Aurelia instance.
74+
*/
75+
withTransient(type: any, implementation?: Function): Aurelia;
6276

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

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

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

101115
/**

dist/amd/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-de
154154
return this;
155155
};
156156

157+
Aurelia.prototype.withTransient = function withTransient(type, implementation) {
158+
this.container.registerTransient(type, implementation);
159+
return this;
160+
};
161+
157162
Aurelia.prototype.globalizeResources = function globalizeResources(resources) {
158163
var toAdd = Array.isArray(resources) ? resources : arguments,
159164
i,

dist/commonjs/aurelia-framework.d.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare module 'aurelia-framework' {
1515
* @param {Aurelia} aurelia An instance of Aurelia.
1616
*/
1717
export class Plugins {
18-
constructor(aurelia: any);
18+
constructor(aurelia: Aurelia);
1919

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

3131
/**
@@ -38,7 +38,11 @@ declare module 'aurelia-framework' {
3838
* @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.
3939
*/
4040
export class Aurelia {
41-
constructor(loader: any, container: any, resources: any);
41+
loader: Loader;
42+
container: Container;
43+
resources: ResourceRegistry;
44+
use: Plugins;
45+
constructor(loader?: Loader, container?: Container, resources?: ResourceRegistry);
4246

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

5357
/**
5458
* Adds a singleton to the framework's dependency injection container.
@@ -58,7 +62,17 @@ declare module 'aurelia-framework' {
5862
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
5963
* @return {Aurelia} Returns the current Aurelia instance.
6064
*/
61-
withSingleton(type: any, implementation: any): any;
65+
withSingleton(type: any, implementation?: Function): Aurelia;
66+
67+
/**
68+
* Adds a transient to the framework's dependency injection container.
69+
*
70+
* @method withTransient
71+
* @param {Class} type The object type of the dependency that the framework will inject.
72+
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
73+
* @return {Aurelia} Returns the current Aurelia instance.
74+
*/
75+
withTransient(type: any, implementation?: Function): Aurelia;
6276

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

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

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

101115
/**

dist/commonjs/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ var Aurelia = (function () {
169169
return this;
170170
};
171171

172+
Aurelia.prototype.withTransient = function withTransient(type, implementation) {
173+
this.container.registerTransient(type, implementation);
174+
return this;
175+
};
176+
172177
Aurelia.prototype.globalizeResources = function globalizeResources(resources) {
173178
var toAdd = Array.isArray(resources) ? resources : arguments,
174179
i,

dist/es6/aurelia-framework.d.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare module 'aurelia-framework' {
1515
* @param {Aurelia} aurelia An instance of Aurelia.
1616
*/
1717
export class Plugins {
18-
constructor(aurelia: any);
18+
constructor(aurelia: Aurelia);
1919

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

3131
/**
@@ -38,7 +38,11 @@ declare module 'aurelia-framework' {
3838
* @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.
3939
*/
4040
export class Aurelia {
41-
constructor(loader: any, container: any, resources: any);
41+
loader: Loader;
42+
container: Container;
43+
resources: ResourceRegistry;
44+
use: Plugins;
45+
constructor(loader?: Loader, container?: Container, resources?: ResourceRegistry);
4246

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

5357
/**
5458
* Adds a singleton to the framework's dependency injection container.
@@ -58,7 +62,17 @@ declare module 'aurelia-framework' {
5862
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
5963
* @return {Aurelia} Returns the current Aurelia instance.
6064
*/
61-
withSingleton(type: any, implementation: any): any;
65+
withSingleton(type: any, implementation?: Function): Aurelia;
66+
67+
/**
68+
* Adds a transient to the framework's dependency injection container.
69+
*
70+
* @method withTransient
71+
* @param {Class} type The object type of the dependency that the framework will inject.
72+
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
73+
* @return {Aurelia} Returns the current Aurelia instance.
74+
*/
75+
withTransient(type: any, implementation?: Function): Aurelia;
6276

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

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

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

101115
/**

dist/es6/index.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function loadPlugin(aurelia, loader, info){
3333
* @param {Aurelia} aurelia An instance of Aurelia.
3434
*/
3535
export class Plugins {
36-
constructor(aurelia){
36+
constructor(aurelia:Aurelia){
3737
this.aurelia = aurelia;
3838
this.info = [];
3939
this.processed = false;
@@ -47,7 +47,7 @@ export class Plugins {
4747
* @param {config} config The configuration for the specified module.
4848
* @return {Plugins} Returns the current Plugins instance.
4949
*/
50-
plugin(moduleId, config){
50+
plugin(moduleId:string, config:any):Plugins{
5151
var plugin = {moduleId:moduleId, config:config || {}};
5252

5353
if(this.processed){
@@ -136,7 +136,12 @@ function loadResources(container, resourcesToLoad, appResources){
136136
* @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.
137137
*/
138138
export class Aurelia {
139-
constructor(loader, container, resources){
139+
loader:Loader;
140+
container:Container;
141+
resources:ResourceRegistry;
142+
use:Plugins;
143+
144+
constructor(loader?:Loader, container?:Container, resources?:ResourceRegistry){
140145
this.loader = loader || new window.AureliaLoader();
141146
this.container = container || new Container();
142147
this.resources = resources || new ResourceRegistry();
@@ -158,7 +163,7 @@ export class Aurelia {
158163
* @param {Object} instance The existing instance of the dependency that the framework will inject.
159164
* @return {Aurelia} Returns the current Aurelia instance.
160165
*/
161-
withInstance(type, instance){
166+
withInstance(type:any, instance:any):Aurelia{
162167
this.container.registerInstance(type, instance);
163168
return this;
164169
}
@@ -171,19 +176,32 @@ export class Aurelia {
171176
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
172177
* @return {Aurelia} Returns the current Aurelia instance.
173178
*/
174-
withSingleton(type, implementation){
179+
withSingleton(type:any, implementation?:Function):Aurelia{
175180
this.container.registerSingleton(type, implementation);
176181
return this;
177182
}
178183

184+
/**
185+
* Adds a transient to the framework's dependency injection container.
186+
*
187+
* @method withTransient
188+
* @param {Class} type The object type of the dependency that the framework will inject.
189+
* @param {Object} implementation The constructor function of the dependency that the framework will inject.
190+
* @return {Aurelia} Returns the current Aurelia instance.
191+
*/
192+
withTransient(type:any, implementation?:Function):Aurelia{
193+
this.container.registerTransient(type, implementation);
194+
return this;
195+
}
196+
179197
/**
180198
* Adds globally available view resources to be imported into the Aurelia framework.
181199
*
182200
* @method globalizeResources
183201
* @param {Object|Array} resources The relative module id to the resource. (Relative to the plugin's installer.)
184202
* @return {Aurelia} Returns the current Aurelia instance.
185203
*/
186-
globalizeResources(resources){
204+
globalizeResources(resources:string|string[]):Aurelia{
187205
var toAdd = Array.isArray(resources) ? resources : arguments,
188206
i, ii, resource, pluginPath = this.currentPluginId || '', path,
189207
internalPlugin = pluginPath.startsWith('./');
@@ -212,7 +230,7 @@ export class Aurelia {
212230
* @param {String} newName The new name.
213231
* @return {Aurelia} Returns the current Aurelia instance.
214232
*/
215-
renameGlobalResource(resourcePath, newName){
233+
renameGlobalResource(resourcePath:string, newName:string):Aurelia{
216234
this.resourcesToLoad[resourcePath] = newName;
217235
return this;
218236
}
@@ -261,7 +279,7 @@ export class Aurelia {
261279
* @param {string|Object} applicationHost The DOM object that Aurelia will attach to.
262280
* @return {Aurelia} Returns the current Aurelia instance.
263281
*/
264-
setRoot(root='app', applicationHost=null){
282+
setRoot(root:string='app', applicationHost=null){
265283
var compositionEngine, instruction = {};
266284

267285
applicationHost = applicationHost || this.host;

0 commit comments

Comments
 (0)