renderMenuItemChildren's type is too generic
See original GitHub issueThe renderMenuItemChildren
property’s type is (option: Option, ...) => JSX.Element
, with Option
defined as string | Record<string, any>
. This means that implementors of renderMenuItemChildren
need to handle both a string
and a Record<string, any>
(by casting onto the right type).
However, the actual type of “Option” should be inferred from the type of the options
parameters.
Pull request forthcoming.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Developers - renderMenuItemChildren's type is too generic -
renderMenuItemChildren's type is too generic. ... The renderMenuItemChildren property's type is (option: Option, ...) => JSX.Element , with Option defined ...
Read more >react-bootstrap-typeahead TypeScript- Ref - getInstance does ...
As you saw, the Typeahead class is itself generic, but the generic type doesn't matter for what you are trying to do, so...
Read more >Incident Response - Hybrid Analysis
... type "Composite Document File V2 Document Cannot read section info" "9f5df6b0f1a4b9a60d0074c369314e1a_1_.js" has type "ASCII text with very long lines"
Read more >Java Generics FAQs - Generic And Parameterized Types
In addition to concrete instantiation there so-called wildcard instantiations . They do not have concrete types as type arguments, but so-called ...
Read more >[Solved]-React redux instantiate non-component class-Reactjs
Type 'null' is not assignable to type 'SetStateAction<string>' · Trying to add a live website URL in ReactJs · 'this' undefined in renderMenuItemChildren...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is not possible, when you use Strict in tsconfig.json. You would get an error
What I have done to “fix” this issue is made a wrapper for
Typeahead
component, which I use instead of the original. Would be great if this came directly instead of doing this wrapping, but this covers our usecase nowTypeahead
accept a genericTypedTypes
and changed component types to custom TypedTypesThis way I can use
Typeahead
as followsand as you can see, IDE knows about the types correctly