What does contextTypes from the library prop-types do?

Viewed 50
AppEnvironments.contextTypes = {
    access: PropTypes.any
}

Fixing it requires:

Static ContextTypes : { access:PropTypes.Requireable<any> }

Removing the fix above gives me: Property 'ContextTypes' does not exist on type 'typeof AppEnvironments'. Did you mean 'ContextType'?

Type '{ access:PropTypes.Requireable<any> }' is not assignable to type 'Context<any>'

This is what I get when I change ContextTypes to ContextType, so I am not sure what is the problem. Any clue? Aslso, why would you add:

AppEnvironments.contextTypes = {
    access: PropTypes.any
}

PropTypes comes from this library: https://www.npmjs.com/package/prop-types

It doesn't tell you how to use ContextType and what it is used for, but it seems that the library doesn't work well with Typescript.

0 Answers
Related