Skip to main content
Version: Next 🚧

[F] validateDecoratorParamType

function validateDecoratorParamType<K>(
program,
target,
value,
expectedType): value is InferredTypeSpecValue<K>

Validate a decorator parameter has the correct type.

Type Parameters

Type Parameter
K extends | "Boolean" | "Decorator" | "Enum" | "EnumMember" | "FunctionParameter" | "Function" | "Interface" | "Intrinsic" | "Model" | "ModelProperty" | "Namespace" | "Number" | "Object" | "Operation" | "Projection" | "Scalar" | "ScalarConstructor" | "String" | "StringTemplate" | "StringTemplateSpan" | "TemplateParameter" | "Tuple" | "Union" | "UnionVariant"

Parameters

ParameterTypeDescription
programProgramProgram
targetTypeDecorator target
valueTypeSpecValueValue of the parameter.
expectedTypeK | K[]Expected type or list of expected type

Returns

value is InferredTypeSpecValue<K>

true if the value is of one of the type in the list of expected types. If not emit a diagnostic.

Deprecated

use

See

createDecoratorDefinition#validate instead.