Improve flags types to acknowledge isMultiple
and isRequired
options
#154
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes two things in the types of flags:
isMultiple
flag is still reported to be a non-array.isRequired
anddefault
is missing. This PR adds|undefined
in those cases + does so in the case whereisRequired
is a function, as it's kind of hard to figure out what that function will return.As a separate commit this PR also mirrors the Typescript config from
tsd
+ extends it slightly. It does this for two reasons:tsconfig.json
in the project tools like VS Code can automatically configure itself correctly and provide correct feedback. Without thetsconfig.json
it complained about some of the definition tests.|undefined
one needs to havestrictNullChecks
set, else Typescript will just ignore anyundefined
added in the types.I also added in
noImplicitAny
andnoUnusedLocals
in thetsconfig.json
as both of those are helpful and good practice as well.Somewhat breaking:
The addition of
|undefined
to all types that are missing bothisRequired
anddefault
can cause some complaints in the code for those who havestrictNullChecks
set totrue
. For everyone else it will cause no change.These complaints are correct though, but might cause some headaches for eg. those without lock-files, where it can have their CI fail.