Specifies a name for the decorated class, property, method, or parameter.
@Name( name: string)Specifies a name for the decorated class, property, method, or parameter.
stringSpecifies a name for the decorated class, property, method, or parameter.
Names are used to identify the decorated element and can be used for serialization, validation, and other metadata-driven operations.
This decorator sets the
nameproperty on the associatedMetadataDescriptor.
@Name('Product')
class Product {
name: string;
price: number;
}
class Product {
@Name('skuCode')
sku: string;
}
class ProductService {
@Name('createProduct')
create(): void {
// ...
}
}
class ProductService {
create(@Name('product') product: Product): void {
// ...
}
}
