4 ms·
Sorry if this is a well known term but what is a "proptype hint" in this context? I can't seem to find any references for '"proptype hint" "javascript"' or any
by EE84M3i 8y ago
Sorry if this is a well known term but what is a "proptype hint" in this context? I can't seem to find any references for '"proptype hint" "javascript"' or any variations that come to mind on Google.
Edit - changed previous sentence to "proptype hint". I originally erroneously read the parent as saying "prototype hint" which I couldn't find results for, but even after correcting my reading error my question still stands.
- MBCook 8y agoI believe they’re referring to the PropTypes Library that grew out of React. It’s extremely limited in scope compared to something like TypeScript, but it does give you some benefit. https://www.npmjs.com/package/prop-types https://www.npmjs.com/package/prop-types
- acemarke 8y ago`PropTypes` are a library for runtime type checking of props for React components. It was originally part of the React core, but split out into a separate library with React 16. PropTypes are used for a combination of debugging during development ("you accidentally passed a string instead of a number", or "you forgot to include a required prop"), as well as documentation for a component. React devs have traditionally used PropTypes to act as readable documentation of a component's expected props, and there are tools that can extract PropTypes usages and generate documentation files. However, with the rise of TS and Flow as static type systems, the need for a runtime-based type checker has gone down, especially since people using TS/Flow have probably already declared types for a given component's props.
- shadowmint 8y agogithub.com/facebook/prop-types is the 2nd google search result for this term, and is what I was referring to, although the first result (devhints.io/react#property-validation) is arguably a better summary. Ie. ‘lite’ type checking, used in react. (did you perhaps see the results for ‘javascript prop type hint’ as a google autocorrect suggestion or something? This is a well known term, but I’m pretty amazed two seconds of google didn’t discover what it was...)
- rounce 8y agoI read it and thought you were referring to something related to some proptype based code completion. The use of 'hinting' threw me off completely, especially when you're talking about checking & validating.
- EE84M3i 8y agoYes I found the prop-types library, but it doesn't include the word "hint" and I couldn't find any documentation that did. I assumed there this was an obscure term of art you were refering to.