tsargs
tsargs copied to clipboard
Is there a way to pick the first argument of a function, but keeping the generic?
https://codesandbox.io/s/currying-thunder-ulqj6?file=/src/index.ts
Basically I'd like to keep the generic def but I don't seem to figure out how to
import { ESLintUtils } from "@typescript-eslint/experimental-utils";
import { Arg1 } from "tsargs";
type RuleCreator = ReturnType<typeof ESLintUtils.RuleCreator>;
// FirstArg defines "meta" as CreateRuleMeta<string> instead of CreateRuleMeta<TMessageIds>
type FirstArg = Arg1<RuleCreator>;
// FirstParam defines "meta" as CreateRuleMeta<string> instead of CreateRuleMeta<TMessageIds>
type FirstParam = Parameters<RuleCreator>[0];