File tree Expand file tree Collapse file tree 5 files changed +41
-43
lines changed
Expand file tree Collapse file tree 5 files changed +41
-43
lines changed Original file line number Diff line number Diff line change 5757 "lint" : " pnpm eslint '{src,test}/**/*.ts'"
5858 },
5959 "files" : [
60- " types.d.ts" ,
6160 " README.md" ,
6261 " dist"
6362 ],
Original file line number Diff line number Diff line change @@ -2,11 +2,18 @@ import 'reflect-metadata';
22import type { Type } from '@suites/types.common' ;
33import type { ClassInjectable , InjectableIdentifier } from '@suites/types.di' ;
44import { UndefinedDependency , UndefinedDependencyError } from '@suites/types.di' ;
5- import type { ParameterDecorator } from './types' ;
6- import { isInjectDecorator } from './types' ;
5+ import type { InjectDecorator } from './interfaces' ;
76
87export type ClassCtorReflector = ReturnType < typeof ClassCtorReflector > ;
98
9+ function isInjectDecorator ( decorator : unknown ) : decorator is InjectDecorator {
10+ return (
11+ typeof decorator === 'object' &&
12+ decorator !== null &&
13+ 'token' in decorator &&
14+ decorator . token !== undefined
15+ ) ;
16+ }
1017/**
1118 * Creates a constructor reflector that extracts injection-js metadata
1219 * from decorated classes using reflect-metadata.
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ const InjectionJSDIAdapter: DependencyInjectionAdapter = DependenciesAdapter(
77 ClassCtorReflector ( )
88) ;
99
10- export { IdentifierMetadata } from './types ' ;
10+ export { IdentifierMetadata } from './interfaces ' ;
1111export const adapter = InjectionJSDIAdapter ;
Original file line number Diff line number Diff line change 1+ import type { Type } from '@suites/types.common' ;
2+
3+ /**
4+ * Represents decorator metadata objects stored by injection-js.
5+ * These are annotation instances created by makeParamDecorator.
6+ */
7+ export interface InjectionJsDecorator {
8+ /** ngMetadataName identifies the decorator type (e.g., 'Inject', 'Optional') */
9+ ngMetadataName ?: string ;
10+ /** toString method for decorator representation */
11+ toString ?: ( ) => string ;
12+ }
13+
14+ /**
15+ * Metadata for @Inject(token) decorator
16+ */
17+ export interface InjectDecorator extends InjectionJsDecorator {
18+ token : unknown ;
19+ }
20+
21+ /**
22+ * Union type for parameter decorators array items.
23+ * Can be:
24+ * - An annotation instance (object with metadata from @Inject, @Optional, etc.)
25+ * - A Type constructor (class reference when used without parentheses)
26+ * - null (for parameters without decorators, used as padding)
27+ */
28+ export type ParameterDecorator = InjectionJsDecorator | Type | null ;
29+
30+ export type IdentifierMetadata = never ;
Original file line number Diff line number Diff line change 1- import type { Type } from '@suites/types.common' ;
2-
31/**
4- * Represents decorator metadata objects stored by injection-js.
5- * These are annotation instances created by makeParamDecorator.
2+ * injection-js metadata type
63 */
7- export interface InjectionJsDecorator {
8- /** ngMetadataName identifies the decorator type (e.g., 'Inject', 'Optional') */
9- ngMetadataName ?: string ;
10- /** toString method for decorator representation */
11- toString ?: ( ) => string ;
12- }
13-
14- /**
15- * Metadata for @Inject(token) decorator
16- */
17- export interface InjectDecorator extends InjectionJsDecorator {
18- token : unknown ;
19- }
20-
21- /**
22- * Type guard to check if a decorator is an @Inject decorator
23- */
24- export function isInjectDecorator ( decorator : unknown ) : decorator is InjectDecorator {
25- return (
26- typeof decorator === 'object' &&
27- decorator !== null &&
28- 'token' in decorator &&
29- ( decorator as InjectDecorator ) . token !== undefined
30- ) ;
31- }
32-
33- /**
34- * Union type for parameter decorators array items.
35- * Can be:
36- * - An annotation instance (object with metadata from @Inject, @Optional, etc.)
37- * - A Type constructor (class reference when used without parentheses)
38- * - null (for parameters without decorators, used as padding)
39- */
40- export type ParameterDecorator = InjectionJsDecorator | Type | null ;
41-
424export type IdentifierMetadata = never ;
You can’t perform that action at this time.
0 commit comments