@tinkoff/dippy
Advanced tools
Comparing version 0.8.5 to 0.8.6
import type { RecordProvide } from './Container.h'; | ||
import type { Provider, ProviderDeps, ProvideDepsIterator } from './Provider'; | ||
import type { ExtractDependencyType, OptionalTokenDependency, TokenInterface } from './createToken/createToken'; | ||
import type { BaseTokenInterface, MultiTokenInterface, OptionalTokenDependency } from './createToken/createToken'; | ||
/** | ||
@@ -16,6 +16,4 @@ * Маркер, который указывает, что значение еще не создано. Для проверки по ссылке. | ||
constructor(additionalProviders?: Provider[], fallback?: Container); | ||
get<T extends TokenInterface<unknown>>(token: T): ExtractDependencyType<T>; | ||
get<T extends OptionalTokenDependency<unknown>>(obj: T): ExtractDependencyType<T['token']> | null; | ||
get<T>(obj: { | ||
token: T; | ||
token: BaseTokenInterface<T>; | ||
optional: true; | ||
@@ -25,3 +23,3 @@ multi?: false; | ||
get<T>(obj: { | ||
token: T; | ||
token: BaseTokenInterface<T>; | ||
optional?: false; | ||
@@ -31,11 +29,14 @@ multi?: false; | ||
get<T>(obj: { | ||
token: T; | ||
token: MultiTokenInterface<T>; | ||
optional: true; | ||
multi: true; | ||
multi?: true; | ||
}): T[] | null; | ||
get<T>(obj: { | ||
token: T; | ||
token: MultiTokenInterface<T>; | ||
optional?: false; | ||
multi: true; | ||
multi?: true; | ||
}): T[]; | ||
get<T>(token: BaseTokenInterface<T>): T; | ||
get<T>(token: MultiTokenInterface<T>): T[]; | ||
get<T>(obj: OptionalTokenDependency<T>): T | null; | ||
get<T>(token: T): T; | ||
@@ -42,0 +43,0 @@ getOfDeps<T extends ProviderDeps>(deps: T): ProvideDepsIterator<T>; |
@@ -45,5 +45,8 @@ import type { TokenType, TokenOptions } from './createToken.h'; | ||
export declare type ExtractTokenType<Token extends TokenInterface<unknown>> = Token extends TokenInterface<infer Type> ? Type : unknown; | ||
export declare type ExtractDependencyType<Token extends TokenInterface<unknown>> = [Token] extends [ | ||
MultiTokenInterface<infer Type> | ||
] ? Type[] : Token extends BaseTokenInterface<infer Type> ? Type : unknown; | ||
declare const secret: unique symbol; | ||
declare type Secret = typeof secret; | ||
declare type Not<T extends boolean> = T extends true ? false : true; | ||
declare type IsNever<T> = [T] extends [never] ? true : false; | ||
declare type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false; | ||
export declare type ExtractDependencyType<Token extends TokenInterface<unknown>> = IsAny<Token> extends true ? any : [Token] extends [MultiTokenInterface<infer Type>] ? Type[] : Token extends BaseTokenInterface<infer Type> ? Type : unknown; | ||
export declare type OptionalTokenDependency<Type> = { | ||
@@ -50,0 +53,0 @@ token: TokenInterface<Type>; |
{ | ||
"name": "@tinkoff/dippy", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"initialVersion": "0.7.27", | ||
@@ -5,0 +5,0 @@ "description": "", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62934
27
1359