Basically just a class to wrap a symbol and a Type so you can get inference through with your types.
e.g.
const token ExampleToken = new Token<IExample>("example") // Internally just has a Symbol("example")
interface IExample {
run(): void;
}
@Service()
class A implements Iexample {
public run(): void {
console.log("A");
}
}
// Service collection setup.
const serviceCollection = new ServiceCollection();
serviceCollection.addTransient(ExampleToken, A); // IExample is inferred as T from Token<T>
const services = serviceCollection.get(ExampleToken); // sevices is inferred as IExample
Basically just a class to wrap a symbol and a Type so you can get inference through with your types.
e.g.