I'm trying to grasp the inner workings of Angular/NestJs dependency injection. It's intriguing how the type of parameters gets lost when a Typescript class is constructed. For example:
type Dependency1 = {};
type Dependency2 = {};
class X {
constructor(dependency: Dependency1){}
}
is transformed into
"use strict";
class X {
constructor(dependency) { }
}
I'm curious about how the Angular Injector manages to replace the 'dependency' parameter with the correct instance of the Dependency class.