question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make VNode generic type param optional

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
marvinhagemeistercommented, May 20, 2018

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 🎉

1reaction
andrewigginscommented, Apr 29, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found