message: core-api: refine api types and add ApiFactoryHolder
diff: @@ -22,7 +22,7 @@ export type ApiRefType<T> = T extends ApiRef<infer U> ? U : never;
  export type TypesToApiRefs<T> = { [key in keyof T]: ApiRef<T[key]> };
  -export type ApiRefsToTypes<T extends { [key in any]: ApiRef<unknown> }> = {
  +export type ApiRefsToTypes<T extends { [key in string]: ApiRef<unknown> }> = {
  [key in keyof T]: ApiRefType<T[key]>;
  };
  @@ -30,10 +30,24 @@ export type ApiHolder = {
  get<T>(api: ApiRef<T>): T | undefined;
  };
  -export type ApiFactory<Api, Impl, Deps> = {
  +export type ApiFactory<
  + Api,
  + Impl,
  + Deps extends { [name in string]: unknown }
  +> = {
  implements: ApiRef<Api>;
  deps: TypesToApiRefs<Deps>;
  factory(deps: Deps): Impl extends Api ? Impl : never;
  };
  -export type AnyApiFactory = ApiFactory<unknown, unknown, unknown>;
  +export type AnyApiFactory = ApiFactory<
  + unknown,
  + unknown,
  + { [key in string]: unknown }
  +>;
  +
  +export type ApiFactoryHolder = {
  + get<T>(
  + api: ApiRef<T>,
  + ): ApiFactory<T, T, { [key in string]: unknown }> | undefined;
  +};
  