-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow JSDoc comments to temporarily overwrite certain CLI options #204
Comments
The original idea is that the second have of |
@ViSaturn Is there another use-case for this? The idea of being able to change options on a per-type basis sounds potentially worthwhile, but debug mode seems like an unlikely thing to use it for since you'd be turning it on and off frequently during debugging, and having it on for all types doesn't seem to have obvious downsides, so making it a file modification seems more cumbersome than helpful. Looking through the other CLI options I don't see much in the way of good candidates to make into per-type options. If you have an idea for how exactly an option benefits from this I'd love to hear it. My instinct is that EDIT: Just saw #202. That's an interesting idea. Will comment there. |
Mainly just this would pair well with #202, it's also nice to have if in the future more CLI options are added. |
Sudden thought. Would the shortcircuit option be a good candidate for this? Short-circuiting is something that it might make sense to turn on for only certain type guards. For example, if you want to use most of your guards, but one in particular has significant performance impact and you're willing to risk it. type SimpleType = { ... }
/**
* @see {isSuperComplicatedType} ts-auto-guard:type-guard
* @see {process.env.NODE_ENV === 'production'} ts-auto-guard:shortcircuit
*/
type SuperComplicatedType = {
...
} The format could use some discussion. There might be a better way of providing multiple options to one type. |
Yeah, that would be. Although the use of the Unless someone is looking for this feature I wouldn't bother, but I agree it's a candidate. |
It would be nice if we could have JSDoc comments that could temporarily overwrite certain options provided by src/cli.ts for the type that the JSDoc comment is for.
Like in
src/cli.ts
you could have:Then you could have:
or something similar to the above
I would be willing to open a PR for this, I'm just looking for some thoughts on this first.
The text was updated successfully, but these errors were encountered: