// typeorm type userFilter = MyParameters<User.find>
const foo = (arg1: string, arg2: number): void => { } type MyParameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? P : never; type FunctionParamsType = MyParameters<typeof foo> // [arg1: string, arg2: number]
With TypeScript’s infer and mapped types, you can extract hidden types to make type-safe helpers for ORMs instead of using any. This helps create safer, smarter filter params. #TypeScript #infer #MappedTypes #TypeSafety #ORM #DevTips