-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
TypeScript: git.reset() doesn't allow string arg for reset mode #575
Comments
Hi, when using TypeScript it is currently necessary to either use the If you would prefer to use a string without type information, you can use an array of strings (overload 3 in your issue detail) to pass any supported strings to the underlying // to use the enum directly
import simpleGit, {ResetMode} from 'simple-git';
simpleGit().reset(ResetMode.HARD); // to use strings without type information
import simpleGit, {ResetMode} from 'simple-git';
simpleGit().reset(['--hard']); // to use javascript
const simpleGit = require('simple-git');
// with a string literal
simpleGit().reset('hard');
// or with the constant
simpleGit().reset(simpleGit.ResetMode.HARD); |
From your downstream PR, it looks as though |
Thanks for looking! We've made that change, it's it's working nicely 👍 (It's really just the TypeScript ignore I was hoping to maybe get rid of 😅 -- but it's of course not so bad to keep it around a little longer.) |
This issue has been automatically closed due to a lack of response. If your problem persists please open a new issue including any additional detail requested from this issue. For more detail on the issues/pull requests see ISSUES_AND_PULL_REQUESTS |
When attempting to compile a script that uses
simple-git
with TypeScript, I'm getting the following error for a line that containsawait simpleGit.reset( 'hard' )
:Reading typedefs and unit tests, it seems like I need a type assertion to
ResetMode
:However, this isn't clearly reflected in the docs:
(Highlight mine.)
I'm not familiar enough yet with TypeScript, but is there any way to allow passing these strings directly (without the type assertion)? Otherwise, it'd be great to document that it's required when using TS.
The text was updated successfully, but these errors were encountered: