Skip to content

Commit cee98f1

Browse files
committed
Type fixes
1 parent e0e71dc commit cee98f1

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

+184
-215
lines changed

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
make check
12
make types
23
make pretty
34
git add ./

@types/directive/class/class.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const ngClassDirective: import("../../interface.ts").DirectiveFactory;
2-
export const ngClassOddDirective: import("../../interface.ts").DirectiveFactory;
3-
export const ngClassEvenDirective: import("../../interface.ts").DirectiveFactory;
1+
export const ngClassDirective: ng.DirectiveFactory;
2+
export const ngClassOddDirective: ng.DirectiveFactory;
3+
export const ngClassEvenDirective: ng.DirectiveFactory;

@types/directive/events/events.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ export function createWindowEventDirective(
2929
eventName: string,
3030
): ng.Directive;
3131
/**
32-
* @type {Record<string, ng.DirectiveFactory>}
32+
* @type {Record<string, ng.Injectable<any>>}
3333
*/
34-
export const ngEventDirectives: Record<string, ng.DirectiveFactory>;
34+
export const ngEventDirectives: Record<string, ng.Injectable<any>>;

@types/directive/model-options/model-options.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
/**
2+
* @returns {ng.Directive}
3+
*/
4+
export function ngModelOptionsDirective(): ng.Directive;
15
export const defaultModelOptions: ModelOptions;
2-
export function ngModelOptionsDirective(): import("../../interface.ts").Directive;
36
export type ModelOptionsConfig = {
47
/**
58
* - A string specifying which events the input should be bound to. Multiple events can be set using a space-delimited list. The special event 'default' matches the default events belonging to the control.

@types/directive/model/model.d.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,17 @@ export class NgModelController {
7272
$modelValue: any;
7373
/** @type {any} */
7474
$$rawModelValue: any;
75-
$validators: {};
76-
$asyncValidators: {};
77-
$parsers: any[];
78-
$formatters: any[];
79-
$viewChangeListeners: any[];
75+
/** @type {any} */
76+
$validators: any;
77+
/** @type {any} */
78+
$asyncValidators: any;
79+
/** @type {Array<any>} */
80+
$parsers: Array<any>;
81+
/** @type {Array<any>} */
82+
$formatters: Array<any>;
83+
/** @type {Array<any>} */
84+
$viewChangeListeners: Array<any>;
85+
/** @type {boolean} */
8086
$untouched: boolean;
8187
/** @type {boolean} */
8288
$touched: boolean;

@types/filters/interface.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ export type FilterFn = (input: any, ...args: any[]) => any;
55
/**
66
* A filter factory function that returns a FilterFn.
77
*/
8-
export type FilterFactory = (...args: any[]) => FilterFn;
8+
export type FilterFactory = (...args: any[]) => FilterFn & {
9+
$$moduleName: string;
10+
};
911
/**
1012
* A filter service for retrieving filters functions
1113
*/

@types/interface.d.ts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export * from "./filters/interface.ts";
1919
export * from "./core/filter/filter.js";
2020
import { Attributes } from "./core/compile/attributes.js";
2121
import { Scope } from "./core/scope/scope.js";
22+
import { NgModelController } from "./directive/model/model.js";
2223
/**
2324
* Configuration options for the AngularTS bootstrap process.
2425
*
@@ -452,39 +453,6 @@ export interface NgModelOptions {
452453
/** Whether to remove trailing :00 seconds */
453454
timeStripZeroSeconds?: boolean;
454455
}
455-
/**
456-
* Controller API for ngModel directive.
457-
*/
458-
export interface NgModelController {
459-
/** Updates the view when the model changes */
460-
$render(): void;
461-
/** Sets the validity state of the control */
462-
$setValidity(validationErrorKey: string, isValid: boolean): void;
463-
/** Updates the model value */
464-
$setViewValue(value: any, trigger?: string): void;
465-
/** Marks the control as pristine */
466-
$setPristine(): void;
467-
/** Marks the control as dirty */
468-
$setDirty(): void;
469-
/** Re-validates the model */
470-
$validate(): void;
471-
/** Marks the control as touched */
472-
$setTouched(): void;
473-
/** Marks the control as untouched */
474-
$setUntouched(): void;
475-
/** Rolls back to previous view value */
476-
$rollbackViewValue(): void;
477-
/** Commits the current view value to the model */
478-
$commitViewValue(): void;
479-
/** Processes view-to-model transformations */
480-
$processModelValue(): void;
481-
/** Determines if value is considered empty */
482-
$isEmpty(value: any): boolean;
483-
/** Overrides the model options dynamically */
484-
$overrideModelOptions(options: NgModelOptions): void;
485-
/** Current value shown in the view */
486-
$viewValue: any;
487-
}
488456
export interface RootElementService extends Element {}
489457
/**
490458
* The minimal local definitions required by $controller(ctrl, locals) calls.

@types/namespace.d.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
import {
4141
Directive as TDirective,
4242
DirectiveFactory as TDirectiveFactory,
43+
AnnotatedDirectiveFactory as TAnnotatedDirectiveFactory,
4344
Component as TComponent,
4445
Controller as TController,
4546
ControllerConstructor as TControllerConstructor,
@@ -84,9 +85,11 @@ import {
8485
} from "./services/rest/interface.ts";
8586
import { RestService as TRestService } from "./services/rest/rest.js";
8687
import { ServiceProvider as TServiceProvider } from "./interface.ts";
88+
import { NgModelController as TNgModelController } from "./directive/model/model.js";
8789
declare global {
8890
interface Function {
8991
$inject?: readonly string[] | undefined;
92+
$$moduleName?: string | undefined;
9093
}
9194
interface Window {
9295
angular: TAngular;
@@ -95,17 +98,23 @@ declare global {
9598
type Angular = TAngular;
9699
type Attributes = TAttributes & Record<string, any>;
97100
type Directive<TController = any> = TDirective<TController>;
98-
type DirectiveFactory = TDirectiveFactory;
99-
type Component = TComponent;
101+
type DirectiveFactory = TDirectiveFactory & Function;
102+
type AnnotatedDirectiveFactory = TAnnotatedDirectiveFactory;
103+
type Component = TComponent & Record<string, any>;
100104
type Controller = TController;
101105
type Scope = TScope & Record<string, any>;
102106
type NgModule = TNgModule;
103107
type PubSubProvider = TPubSubProvider;
104108
type CompositeLinkFn = TCompositeLinkFn;
105-
type PublicLinkFn = TPublicLinkFn;
109+
type PublicLinkFn = TPublicLinkFn & {
110+
pre: any;
111+
post: any;
112+
};
106113
type NodeLinkFn = TNodeLinkFn;
107114
type NodeLinkFnCtx = TNodeLinkFnCtx;
108-
type TranscludeFn = TTranscludeFn;
115+
type TranscludeFn = TTranscludeFn & {
116+
$$slots: any;
117+
};
109118
type BoundTranscludeFn = TBoundTranscludeFn;
110119
type LinkFnMapping = TLinkFnMapping;
111120
type AnchorScrollProvider = TAnchorScrollProvider;
@@ -121,7 +130,9 @@ declare global {
121130
type CookieService = TCookieService;
122131
type ExceptionHandlerService = TExceptionHandler;
123132
type FilterFn = TFilterFn;
124-
type FilterFactory = TFilterFactory;
133+
type FilterFactory = TFilterFactory & {
134+
$$moduleName: string;
135+
};
125136
type FilterService = TFilterService;
126137
type HttpParamSerializerSerService = THttpParamSerializer;
127138
type HttpService = THttpService;
@@ -150,7 +161,9 @@ declare global {
150161
T extends
151162
| ((...args: any[]) => any)
152163
| (abstract new (...args: any[]) => any),
153-
> = TInjectable<T>;
164+
> = TInjectable<T> & {
165+
$$moduleName: string;
166+
};
154167
type StorageBackend = TStorageBackend;
155168
type StorageType = TStorageType;
156169
type StreamConnectionConfig = TStreamConnectionConfig;
@@ -162,5 +175,6 @@ declare global {
162175
type EntityClass<T> = TEntityClass<T>;
163176
type ServiceProvider = TServiceProvider;
164177
type Expression = TExpression;
178+
type NgModelController = TNgModelController;
165179
}
166180
}

@types/services/anchor-scroll/anchor-scroll.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class AnchorScrollProvider {
1414
| string
1515
| ((
1616
$location: import("../../services/location/location.js").Location,
17-
$rootScope: import("../../core/scope/scope.js").Scope,
17+
$rootScope: ng.Scope,
1818
) => AnchorScrollFunction)
1919
)[];
2020
}

@types/services/exception/interface.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
*
44
* @param {Error} exception - The exception associated with the error.
55
*/
6-
export type ExceptionHandler = (exception: Error) => void;
6+
export type ExceptionHandler = (exception: Error) => never;

0 commit comments

Comments
 (0)