Skip to content

Commit 8df7a81

Browse files
committed
fix
1 parent f238905 commit 8df7a81

File tree

5 files changed

+41
-43
lines changed

5 files changed

+41
-43
lines changed

packages/di/injection-js/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"lint": "pnpm eslint '{src,test}/**/*.ts'"
5858
},
5959
"files": [
60-
"types.d.ts",
6160
"README.md",
6261
"dist"
6362
],

packages/di/injection-js/src/class-ctor-reflector.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ import 'reflect-metadata';
22
import type { Type } from '@suites/types.common';
33
import type { ClassInjectable, InjectableIdentifier } from '@suites/types.di';
44
import { UndefinedDependency, UndefinedDependencyError } from '@suites/types.di';
5-
import type { ParameterDecorator } from './types';
6-
import { isInjectDecorator } from './types';
5+
import type { InjectDecorator } from './interfaces';
76

87
export 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.

packages/di/injection-js/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ const InjectionJSDIAdapter: DependencyInjectionAdapter = DependenciesAdapter(
77
ClassCtorReflector()
88
);
99

10-
export { IdentifierMetadata } from './types';
10+
export { IdentifierMetadata } from './interfaces';
1111
export const adapter = InjectionJSDIAdapter;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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;
Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,4 @@
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-
424
export type IdentifierMetadata = never;

0 commit comments

Comments
 (0)