Make VNode generic type param optional
See original GitHub issueI suggest we make the VNode generic parameter optional by providing a default type for it.
Adding a generic parameter to the VNode interface breaks the types of many preact libraries that reference or extend VNode. Until many of these libraries update their types to provide a value for the VNode type parameter, I suggest we make it optional. Making it optional unblocks Preact TypeScript users to adopt 8.2.8+ without having to wait for all other libraries to catch up.
Below are some of the libraries that I’ve found that would need updating. I’ll update this list with PRs to take advantage of the type parameter once they are opened. Post a comment here if you open one.
Libraries that need updating to provide a type param to VNode
:
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Make VNode generic type param optional · Issue #1081 - GitHub
I suggest we make the VNode generic parameter optional by providing a default type for it. Adding a generic parameter to the VNode...
Read more >How can I make a generic type optional? - Stack Overflow
The requestData is optional. I want to be able to call logData without having to specify the S type when I don't send...
Read more >Generically Typed Vue Components with Composition API
To refresh your memory, generics enable your functional units (functions and classes) to operate on a dynamic type that is determined when it...
Read more >Optional generic types in TypeScript - Garbage Value
To make a generic type optional, you have to assign the void as the default value.
Read more >Render Function APIs | Vue.js
h() # ... Creates virtual DOM nodes (vnodes). ... Types are simplified for readability. ... The first argument can either be a string...
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 fixed in master. The generic parameter vor
VNode
is marked as optional. That way we don’t need to update all other libraries depending on preact 🎉FYI, I’m working through fixing issues that arise while trying to convert the preact-cli default template to TypeScript. The goal is to enable the default template to be written in TypeScript strict mode without any errors. My repo is at andrewiggins/preact-default-ts