# registerValue Function

Module
import { registerValue } from "@tsed/di"
Source/packages/di/src/registries/ProviderRegistry.ts

# Overview

const registerValue: (provider: any | IProvider<any>, value?: any) => void;

# Description

Add a new value in the ProviderRegistry.

# Example with symbol definition

import {registerValue, InjectorService} from "@tsed/common";

const MyValue = Symbol.from("MyValue")

registerValue(MyValue, "myValue");

@Service()
export class OtherService {
     constructor(@Inject(MyValue) myValue: string){
         console.log(myValue); /// "myValue"
     }
}
1
2
3
4
5
6
7
8
9
10
11
12