You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The second parameter of MiddlewareFunction is not documented.
Type YargsInstance doesn’t seem to be accessible.
The callback return type is void, but the API user can actually decide between modifying the original args (args.foo = 'bar'; return) and letting Yargs do the merging (const changes = {}; changes.foo = 'bar'; return changes).
The text was updated successfully, but these errors were encountered:
It’s currently not that easy to write middlewares in TypeScript, because the actual API and exported types seem to be out of sync.
This is a legitimate Yargs middleware:
Which can be verified by looking directly at the API code.
yargs/lib/middleware.ts
Lines 111 to 114 in e517318
However, this is the corresponding type definition I am consuming:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3a6d407361cc6025d136ae5eb3c3e3e24ada5009/types/yargs/v16/index.d.ts#L838
The problems with that:
MiddlewareFunction
is not documented.YargsInstance
doesn’t seem to be accessible.void
, but the API user can actually decide between modifying the originalargs
(args.foo = 'bar'; return
) and letting Yargs do the merging (const changes = {}; changes.foo = 'bar'; return changes
).The text was updated successfully, but these errors were encountered: