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
Options appear as regular public class fields but do not function as such during class instance construction.
classDefaultCommandextendsCommand{staticpaths=[Command.Default];s=Option.String('-s',{required: true,});uppercase=this.s.toUpperCase();// TypeError: this.s.toUpperCase is not a functionasyncexecute(){}}
This behavior is understandable given the way options are declared, but still might take the user by surprise. Especially when it fails silently (optional property usage, for example).
The text was updated successfully, but these errors were encountered:
Indeed; we could avoid that by making Option.String & friends return a Proxy that would "buffer" all manipulations, but it'd be quite overkill imo. I'm not sure what else we can do 🤔
Hmm, could options return the actual value and register themselves for command routing as a side-effect? It would require to delay command construction until after cli.run is called though 🤔
Options appear as regular public class fields but do not function as such during class instance construction.
https://stackblitz.com/edit/node-gbmupy?file=cli.ts
This behavior is understandable given the way options are declared, but still might take the user by surprise. Especially when it fails silently (optional property usage, for example).
The text was updated successfully, but these errors were encountered: