The new ParamsFrom TS utility can finally help dynamically determine the param types of an Action's run method! This only works on Action classes that statically define the inputs, e.g. NOT in a constructor. Here's a screenshot of things working:
Note that params.value is properly a string, and we get an error that params.foo is undefined.
Here's the magic:
export type ParamsFrom<A extends Action | Task> = {
[Input in keyof A["inputs"]]: A["inputs"][Input]["formatter"] extends (
...ags: any[]
) => any
? ReturnType<A["inputs"][Input]["formatter"]>
: string;
};
What's nice about this approach is that we don't need to change any of Actionhero's internals, but we should start writing all of our Actions and Tasks with static definitions.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps actionhero from 28.0.1 to 28.1.2.
Release notes
Sourced from actionhero's releases.
... (truncated)
Commits
0c550b1
28.1.21646232
CLI inputs gainformatter
andvalidator
(#2062)57555cf
28.1.11610a24
remove TS_JEST from test cli env (#2061)87f2c7a
Flag typescript=true ifTS_JEST
is present (#2060)5fb7a41
28.1.0793bd51
ParamsFrom
utility to determine types of params from Action Inputs (#2059)2e4b1a5
Bump@types/ioredis
from 4.28.3 to 4.28.5 (#2055)8d197ae
Bump node-resque from 9.1.2 to 9.1.3 (#2056)f678218
Bump ts-jest from 27.1.1 to 27.1.2 (#2057)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)