amisa-paths
Version:
nothing special
29 lines (23 loc) • 869 B
text/typescript
import { Accounting } from "./Accounting";
import { BaseCode } from "./BaseCode";
export class Paths {
historiesController: string;
BaseCode: BaseCode;
Accounting: Accounting;
constructor() {
this.historiesController = 'histories';
this.Accounting = new Accounting();
this.BaseCode = new BaseCode();
}
public static getValue = <
P1 extends keyof Paths,
P extends Paths[P1],
P2 extends keyof P>(paths: Paths, p1: P1, p2: P2): P[P2] => {
const pp = paths[p1] as P;
return pp[p2];
};
}
// type KeysOfType<T, U> = { [P in keyof T]: T[P] extends U ? P : never }[keyof T];
// type PickByType<T, U> = Pick<T, KeysOfType<T, U>>;
// const a = <P1 extends keyof PickByType<IPaths, Text>, P extends IPaths[P1], P2 extends keyof P>(f: P1, g: P2) => {
// }