The former doesn't work, but I am guessing could be an easy fix.
The latter doesn't contain JSX, so assigning propTypes to the provider doesn't work. An easy fix can be added IF we only account for propTypes assigned in the same file React.createContext() is used, which it normally should be, accounting for most of the cases.