PropType.oneOf suggestion from array variable
I appreciate that when you start writing a string for a PropType.oneOf prop that it suggests auto-completion based on the "enum" choices. However, I tried giving an array of string as a variable to the validator but I do not get that auto-completion feature. Is there a way to have it or is it just not possible?
Please sign in to leave a comment.
What does your code look like? Completion works for me when using arrays:
That's because you hard code the array. I'm talking of the case where the array is either a variable or imported from another file
Ir this is a variable, then it should be possible to implement this (please vote for https://youtrack.jetbrains.com/issue/WEB-53745)
If the array is loaded from a file in runtime, this can hardly be done using static code analysis
so it should technically still be possible if the array is exported hard coded from another file for multiple utilisation accross files?
that would be nice as I have an array of possible color name for props that I would like to use for many components so it is obviously better to have it at one place and not redefine it all the time, as well as removing/adding/editing