Skip to content

Commit

Permalink
feat: create type helper to infer token
Browse files Browse the repository at this point in the history
  • Loading branch information
jrel committed Jun 22, 2023
1 parent 47aad1e commit f0082c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export * from './error/service-not-found.error';
export { Handler } from './interfaces/handler.interface';
export { ServiceMetadata } from './interfaces/service-metadata.interface';
export { ServiceOptions } from './interfaces/service-options.interface';
export { TokenInfer } from './types/token-infer.type';
export { TokenInferMany } from './types/token-infer-many.type';
export { Constructable } from './types/constructable.type';
export { ServiceIdentifier } from './types/service-identifier.type';

Expand Down
3 changes: 3 additions & 0 deletions src/types/token-infer-many.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Token } from '../token.class';

export type TokenInferMany<T> = T extends Token<infer U> ? U[] : never;
3 changes: 3 additions & 0 deletions src/types/token-infer.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Token } from '../token.class';

export type TokenInfer<T> = T extends Token<infer U> ? U : never;

0 comments on commit f0082c1

Please sign in to comment.