Commit ae3dfba6 authored by Jiwon Kwon's avatar Jiwon Kwon
Browse files

Use intersection or union both

parent e5a14ec8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import type {
  FederationOptions,
  InboxListenerSetters,
  ObjectCallbackSetters,
  ParamKeyPathInter,
  ParamsKeyPath,
} from "./federation.ts";
import type {
@@ -1213,7 +1214,7 @@ export class FederationBuilderImpl<TContextData>
    name: string | symbol,
    ...args: [
      ConstructorWithTypeId<TObject>,
      ParamsKeyPath<TParams>,
      ParamsKeyPath<TParams> | ParamKeyPathInter<TParams>,
      CustomCollectionDispatcher<
        TObject,
        TParams,
@@ -1240,7 +1241,7 @@ export class FederationBuilderImpl<TContextData>
    name: string | symbol,
    ...args: [
      ConstructorWithTypeId<TObject>,
      ParamsKeyPath<TParams>,
      ParamsKeyPath<TParams> | ParamKeyPathInter<TParams>,
      CustomCollectionDispatcher<
        TObject,
        TParams,
@@ -1266,7 +1267,7 @@ export class FederationBuilderImpl<TContextData>
    name: string | symbol,
    collectionType: "collection" | "orderedCollection",
    itemType: ConstructorWithTypeId<TObject>,
    path: ParamsKeyPath<TParams>,
    path: ParamsKeyPath<TParams> | ParamKeyPathInter<TParams>,
    dispatcher: CustomCollectionDispatcher<
      TObject,
      TParams,
+5 −2
Original line number Diff line number Diff line
@@ -477,7 +477,7 @@ export interface Federatable<TContextData> {
  >(
    name: string | symbol,
    itemType: ConstructorWithTypeId<TObject>,
    path: ParamsKeyPath<TParams>,
    path: ParamsKeyPath<TParams> | ParamKeyPathInter<TParams>,
    dispatcher: CustomCollectionDispatcher<
      TObject,
      TParams,
@@ -510,7 +510,7 @@ export interface Federatable<TContextData> {
  >(
    name: string | symbol,
    itemType: ConstructorWithTypeId<TObject>,
    path: ParamsKeyPath<TParams>,
    path: ParamsKeyPath<TParams> | ParamKeyPathInter<TParams>,
    dispatcher: CustomCollectionDispatcher<
      TObject,
      TParams,
@@ -1140,6 +1140,9 @@ export type ParamsKeyPath<Params extends Record<string, string>> =
  & ParamPath<Extract<keyof Params, string>>
  & string;

export type ParamKeyPathInter<Params extends Record<string, string>> =
  & ParamsPath<Extract<keyof Params, string>>
  & string;
/**
 * Represents a path with multiple parameters.
 * All permutations of the parameters are included in the union type.