I noticed that node-git-describe recently got built-in (i.e. directly provided by the package) TypeScript definitions, that is such a nice added feature!! 👍
While it helped me better use the library in several occasions, there is one specific situation at least where it seems to me that the types miss a use case: for the match option, I used to pass false boolean value to prevent any match from happening (no --match option used on git-describe command).
Using match: undefined makes the TS error go away, but does not work with the JS code, because the default value is still used in that case (expected behavior of lodash.defaults)
At least when using match: null I can get the initial behavior, but this does not pass the current types.
Therefore it seems to me that it is an expected behavior to be able to specify null or false to the match option, when we want to disable the --match option of git-describe command, hence it should be added in the types?
Hi,
I noticed that node-git-describe recently got built-in (i.e. directly provided by the package) TypeScript definitions, that is such a nice added feature!! 👍
While it helped me better use the library in several occasions, there is one specific situation at least where it seems to me that the types miss a use case: for the
match
option, I used to passfalse
boolean value to prevent any match from happening (no--match
option used ongit-describe
command).The current types accepts only a
string
value, which, in strict mode, does not even acceptnull
. https://github.com/tvdstaaij/node-git-describe/blob/91dc7f184f6410b7cc6adc0bd203f0bc6bf0efcd/index.d.ts#L20Then if I pass any string value, it will replace the default value (which matches anything looking like a version) https://github.com/tvdstaaij/node-git-describe/blob/91dc7f184f6410b7cc6adc0bd203f0bc6bf0efcd/lib/git-describe.js#L29 I can use the
"*"
wildcard, but this still tries to match a tag.Whereas I used to pass it
false
to prevent any match attempt, which is correctly handled in that case in the JS code: https://github.com/tvdstaaij/node-git-describe/blob/91dc7f184f6410b7cc6adc0bd203f0bc6bf0efcd/lib/git-describe.js#L60-L61Using
match: undefined
makes the TS error go away, but does not work with the JS code, because the default value is still used in that case (expected behavior of lodash.defaults)At least when using
match: null
I can get the initial behavior, but this does not pass the current types.Therefore it seems to me that it is an expected behavior to be able to specify
null
orfalse
to thematch
option, when we want to disable the--match
option ofgit-describe
command, hence it should be added in the types?