core-api: update ApiFactory type to correctly infer API type and disallow mismatched implementations

This commit is contained in:
Patrik Oldsberg
2020-12-04 13:50:37 +01:00
parent 4266967979
commit b6557c0988
5 changed files with 54 additions and 18 deletions
+5 -3
View File
@@ -56,9 +56,11 @@ class DevAppBuilder {
/**
* Register an API factory to add to the app
*/
registerApi<Api, Deps extends { [name in string]: unknown }>(
factory: ApiFactory<Api, Deps>,
): DevAppBuilder {
registerApi<
Api,
Impl extends Api,
Deps extends { [name in string]: unknown }
>(factory: ApiFactory<Api, Impl, Deps>): DevAppBuilder {
this.apis.push(factory);
return this;
}