Open
Conversation
Owner
|
@sean-adams thank you for sending this PR. What does your TypeScript setup look like? Can you supply a reproducible example? We don't see this issue on any of the multiple projects this library is used on. It's a long time since the types were added but I remember that the default props were properly inferred. I believe this was the recommended setup at the time. For example, I think you would agree the optional chaining is not actually needed at runtime, since those props have defaults. If there is now an issue with this setup, it would be great if we could avoid the code changes that are not actually needed. Perhaps by extending the PropTypes with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
All component props are either not required and/or have reasonable defaults in
defaultProps, but Typescript will still complain if you don't provide them because they are not marked as optional inWebcamProps.Achieving this did require optional chaining on
onUserMediaandonUserMediaErroras well as coercingimageSmoothingto a boolean.