Skip to content

Commit 717e8d4

Browse files
author
Anatoly Ostrovsky
committed
Type and style improvements
1 parent 1d96c5e commit 717e8d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+456
-386
lines changed

@types/animations/runner/animate-runner.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export class AnimateRunner {
3636
* @private
3737
*/
3838
private _promise;
39-
_tick: (fn: any) => void;
39+
/** @type {(fn: VoidFunction) => void} */
40+
_tick: (fn: VoidFunction) => void;
4041
/**
4142
* Sets or replaces the current host.
4243
* @param {AnimationHost} host

@types/core/compile/attributes.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ export class Attributes {
2424
* @param {ng.ExceptionHandlerService} $exceptionHandler
2525
* @param {*} $sce
2626
* @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
27-
* @param {Object} [attributesToCopy]
27+
* @param {Object & Record<string, any>} [attributesToCopy]
2828
*/
2929
constructor(
3030
$animate: ng.AnimateService,
3131
$exceptionHandler: ng.ExceptionHandlerService,
3232
$sce: any,
3333
nodeRef?: import("../../shared/noderef.js").NodeRef,
34-
attributesToCopy?: any,
34+
attributesToCopy?: any & Record<string, any>,
3535
);
3636
_$animate: import("../../animations/interface.ts").AnimateService;
3737
_$exceptionHandler: import("../../services/exception/interface.ts").ExceptionHandler;
@@ -41,10 +41,10 @@ export class Attributes {
4141
* to do reverse lookup from normalized name back to actual name.
4242
*/
4343
$attr: {};
44-
/** @type {import("../../shared/noderef.js").NodeRef} */
45-
_nodeRef: import("../../shared/noderef.js").NodeRef;
46-
/** @type {Node|Element} */
47-
get $$element(): Node | Element;
44+
/** @type {import("../../shared/noderef.js").NodeRef | undefined} */
45+
_nodeRef: import("../../shared/noderef.js").NodeRef | undefined;
46+
/** @ignore @returns {Node|Element} */
47+
_element(): Node | Element;
4848
/**
4949
* Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or
5050
* `data-`) to its normalized, camelCase form.

@types/core/compile/compile.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ export class CompileProvider {
135135
$animate: ng.AnimateService,
136136
) => (
137137
compileNode: string | Element | Node | ChildNode | NodeList,
138-
transcludeFn?: import("./inteface.ts").TranscludeFn,
138+
transcludeFn?: import("./interface.ts").TranscludeFn,
139139
maxPriority?: number,
140140
ignoreDirective?: string,
141141
previousCompileContext?: any,
142-
) => import("./inteface.ts").PublicLinkFn)
142+
) => import("./interface.ts").PublicLinkFn)
143143
)[];
144144
}

@types/core/controller/interface.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type ControllerService = (
2-
expression: string | Function | any[],
2+
expression: string | Function | ng.AnnotatedFactory<any>,
33
locals?: Record<string, any>,
44
later?: boolean,
55
ident?: string,

@types/core/di/di.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
/**
2-
* @param {Function} fn
3-
* @returns {string}
4-
*/
5-
export function stringifyFn(fn: Function): string;
6-
/**
7-
* @param {Function} fn
8-
* @returns {Array<any>}
9-
*/
10-
export function extractArgs(fn: Function): Array<any>;
111
/**
122
* @param {Function} func
133
* @returns {boolean}

@types/core/di/inteface.d.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

@types/core/di/interface.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { InjectorService, ProviderInjector } from "./internal-injector.js";
2+
export interface StorageLike {
3+
getItem(key: string): string | null;
4+
setItem(key: string, value: string): void;
5+
removeItem(key: string): void;
6+
}
7+
export interface PersistentStoreConfig {
8+
backend?: StorageLike;
9+
serialize?: (value: unknown) => string;
10+
deserialize?: (value: string) => unknown;
11+
cookie?: Record<string, unknown>;
12+
}
13+
export interface ProviderCache {
14+
[key: string]: any;
15+
$provide: {
16+
provider: Function;
17+
factory: Function;
18+
service: Function;
19+
value: Function;
20+
constant: Function;
21+
store: Function;
22+
decorator: Function;
23+
};
24+
$injectorProvider?: {
25+
$get: () => InjectorService;
26+
};
27+
$injector?: ProviderInjector;
28+
}

@types/core/di/internal-injector.d.ts

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
*/
44
export class ProviderInjector extends AbstractInjector {
55
/**
6-
* @param {Object} cache
6+
* @param {import('./interface.ts').ProviderCache} cache
77
* @param {boolean} strictDi - Indicates if strict dependency injection is enforced.
88
*/
9-
constructor(cache: any, strictDi: boolean);
9+
constructor(cache: import("./interface.ts").ProviderCache, strictDi: boolean);
10+
_cache: import("./interface.ts").ProviderCache;
1011
/**
1112
* Factory method for creating services.
1213
* @param {string} caller - The name of the caller requesting the service.
@@ -23,8 +24,12 @@ export class InjectorService extends AbstractInjector {
2324
* @param {boolean} strictDi - Indicates if strict dependency injection is enforced.
2425
*/
2526
constructor(providerInjector: ProviderInjector, strictDi: boolean);
26-
/** @type {ProviderInjector} */
27-
providerInjector: ProviderInjector;
27+
/** @type {(mods: Array<Function | string | ng.AnnotatedFactory<any>>) => void} */
28+
loadNewModules: (
29+
mods: Array<Function | string | ng.AnnotatedFactory<any>>,
30+
) => void;
31+
/** @private @type {ProviderInjector} */
32+
private _providerInjector;
2833
/**
2934
*
3035
* @param {string} name
@@ -40,13 +45,13 @@ declare class AbstractInjector {
4045
/**
4146
* @type {Object<String, Function>}
4247
*/
43-
cache: any;
48+
_cache: any;
4449
/** @type {boolean} */
4550
strictDi: boolean;
4651
/** @type {string[]} */
47-
path: string[];
52+
_path: string[];
4853
/** @type {Object.<string, ng.NgModule>} */
49-
modules: {
54+
_modules: {
5055
[x: string]: import("./ng-module/ng-module.js").NgModule;
5156
};
5257
/**
@@ -59,38 +64,42 @@ declare class AbstractInjector {
5964
/**
6065
* Get the injection arguments for a function.
6166
*
62-
* @param {Function|Array} fn
63-
* @param {Object} locals
64-
* @param {string} serviceName
67+
* @param {Function|ng.AnnotatedFactory<any>} fn
68+
* @param {Object & Record<string, any>} [locals]
69+
* @param {string} [serviceName]
6570
* @returns
6671
*/
67-
injectionArgs(fn: Function | any[], locals: any, serviceName: string): any[];
72+
_injectionArgs(
73+
fn: Function | ng.AnnotatedFactory<any>,
74+
locals?: any & Record<string, any>,
75+
serviceName?: string,
76+
): any[];
6877
/**
6978
* Invoke a function with optional context and locals.
7079
*
71-
* @param {Function|String|Array<any>} fn
80+
* @param {Function|String|ng.AnnotatedFactory<any>} fn
7281
* @param {*} [self]
7382
* @param {Object} [locals]
7483
* @param {string} [serviceName]
7584
* @returns {*}
7685
*/
7786
invoke(
78-
fn: Function | string | Array<any>,
87+
fn: Function | string | ng.AnnotatedFactory<any>,
7988
self?: any,
8089
locals?: any,
8190
serviceName?: string,
8291
): any;
8392
/**
8493
* Instantiate a type constructor with optional locals.
85-
* @param {Function|Array} type
94+
* @param {Function|ng.AnnotatedFactory<any>} type
8695
* @param {*} [locals]
8796
* @param {string} [serviceName]
8897
*/
89-
instantiate(type: Function | any[], locals?: any, serviceName?: string): any;
90-
/**
91-
* @abstract
92-
*/
93-
loadNewModules(): void;
98+
instantiate(
99+
type: Function | ng.AnnotatedFactory<any>,
100+
locals?: any,
101+
serviceName?: string,
102+
): any;
94103
/**
95104
* @abstract
96105
* @param {string} _serviceName

@types/core/di/ng-module/ng-module.d.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,27 @@ export class NgModule {
2323
public name: string;
2424
/**
2525
* Array of module names that this module depends on.
26+
* @ignore
2627
* @type {string[]}
2728
*/
2829
_requires: string[];
2930
/**
3031
* Holds a collection of tasks, required to instantiate an angular component
32+
* @ignore
3133
* @type {!Array<Array<*>>}
3234
*/
3335
_invokeQueue: Array<Array<any>>;
34-
/** @type {!Array<Array<*>>} */
36+
/**
37+
* @ignore
38+
* @type {!Array<Array<*>>}
39+
*/
3540
_configBlocks: Array<Array<any>>;
36-
/** @type {!Array.<ng.Injectable<any>>} */
41+
/** @ignore @type {!Array.<ng.Injectable<any>>} */
3742
_runBlocks: Array<ng.Injectable<any>>;
38-
_services: any[];
39-
_restDefinitions: any[];
43+
/** @ignore @type {!Array.<ng.Injectable<any>>} */
44+
_services: Array<ng.Injectable<any>>;
45+
/** @ignore @type {!Array.<ng.RestDefinition<any>>} */
46+
_restDefinitions: Array<ng.RestDefinition<any>>;
4047
/**
4148
* @param {string} name
4249
* @param {any} object - Allows undefined

0 commit comments

Comments
 (0)