Interface ValueRequestDecorator<T, P>
interface ValueRequestDecorator<
T extends RequestType
| undefined,
P extends Place,
> {
"[token]": T extends RequestType
? Given<Answer<T>, P, true>
: Given<unknown, P, false>;
<
X extends unknown,
K extends string | symbol | undefined,
I extends number,
>(
target: X,
key: K,
index: T extends RequestType
? [Answer<T>] extends [ParameterOf<X, K, I>]
? I
: "the parameter's type does not accept what the request gives"
: ReadFromMetadata<ParameterOf<X, K, I>> extends true
? I
: "write the request's type: the metadata cannot say this parameter's",
): void;
}
T extends RequestType
| undefined,
P extends Place,
> {
"[token]": T extends RequestType
? Given<Answer<T>, P, true>
: Given<unknown, P, false>;
<
X extends unknown,
K extends string | symbol | undefined,
I extends number,
>(
target: X,
key: K,
index: T extends RequestType
? [Answer<T>] extends [ParameterOf<X, K, I>]
? I
: "the parameter's type does not accept what the request gives"
: ReadFromMetadata<ParameterOf<X, K, I>> extends true
? I
: "write the request's type: the metadata cannot say this parameter's",
): void;
}
Type Parameters
- T extends RequestType | undefined
- P extends Place
-
ValueRequestDecorator<
X extends unknown,
K extends string | symbol | undefined,
I extends number,
>(
target: X,
key: K,
index: T extends RequestType
? [Answer<T>] extends [ParameterOf<X, K, I>]
? I
: "the parameter's type does not accept what the request gives"
: ReadFromMetadata<ParameterOf<X, K, I>> extends true
? I
: "write the request's type: the metadata cannot say this parameter's",
): voidMarks the parameter at position
indexof the constructor oftarget, whenkeyisundefined, or of its methodkey.Type Parameters
- X extends unknown
- K extends string | symbol | undefined
- I extends number
Parameters
- target: X
- key: K
- index: T extends RequestType
? [Answer<T>] extends [ParameterOf<X, K, I>]
? I
: "the parameter's type does not accept what the request gives"
: ReadFromMetadata<ParameterOf<X, K, I>> extends true
? I
: "write the request's type: the metadata cannot say this parameter's"
Returns void
A decorator that marks a parameter with a request for a value, whose type is
T, or, whenTisundefined, the parameter's own type, read from the metadata the compiler records. It compiles only on a parameter in one of the placesPnames, whose declared type accepts what the request gives, as Answer says; with no type written, only on one whose type the metadata can say, as ReadFromMetadata says.