What's the proper way to use TypeScript and React together, now that they have extracted the PropTypes in a separate project with version 15.5?
Everything runs fine after upgrading from 15.4 to 15.5, except that now I get a this warning in the console: "Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead." How do I make it disappear?
I have tried doing the following steps, but it doesn't remove the console warning.
- Add the
prop-typesand@types/prop-typespackages. - Import PropTypes everywhere that I import React,
import * as PropTypes from "proptypes". Also tried withrequire("prop-types"). - Turn off
noUnusedLocals, to avoid that the compiler complains about PropTypes not being used.
But. Since I'm using TypeScript, the compiler is verifying the PropTypes at compile time, so I don't need to do the same at run time, and thus I shouldn't get the warning at all, right? I am hoping that maybe I can add or change a setting somewhere in the build configuration, that would make React compile without PropTypes.
PropTypesin your code, I guess that one of your dependencies (maybemobx?) still uses them and this is why you get that warning. - Sebastian Sebald