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
IMHO, one of the strong benefit of using TypeScript for shell scripting is to get more static checks.
However, currently dax is using (strings: TemplateStringsArray, ...exprs: any[]): CommandBuilder type (source) for its primary API, which is $. Because of any in the type, we cannot detect incorrect arguments passed such as undefined or random incompatible objects.
import$from'dax-sh'constmyobj1={'hello': 'world'}constmyobj2=undefined// type check passes for the following, which is not desired.await$`echo ${myobj1}${myobj2}`
Proposed solution
I propose to stop using any in (strings: TemplateStringsArray, ...exprs: any[]): CommandBuilder by precisely model all the possible arguments.
Ok thanks, so the only way to emit error for the above case is to stop supporting objects with toString()....
I think this is actually a good change but it is a breaking change 😢
IMHO, one of the strong benefit of using TypeScript for shell scripting is to get more static checks.
However, currently dax is using
(strings: TemplateStringsArray, ...exprs: any[]): CommandBuilder
type (source) for its primary API, which is$
. Because ofany
in the type, we cannot detect incorrect arguments passed such asundefined
or random incompatible objects.Proposed solution
I propose to stop using
any
in(strings: TemplateStringsArray, ...exprs: any[]): CommandBuilder
by precisely model all the possible arguments.Related issues
await
is not detected by eslint-typescript and I proposed a fix there (fix(eslint-plugin): [no-floating-promises] handle TaggedTemplateExpression typescript-eslint/typescript-eslint#8758)The text was updated successfully, but these errors were encountered: