Problems with Ref
type declaration make explicit typing impossible
#1209
Labels
Ref
type declaration make explicit typing impossible
#1209
Observed Behaviour
This fails to typecheck:
Following the
Ref
type declaration in inferno/src/core/VNodes.ts, we see:This has three problems:
T
, the parameter should be(node?: T | null)
. The same is technically true for HTML elements, as it will be passing the element's concrete instance to the callback in all cases.void
, whenany
would be more appropriate. Note that the React typings already handle this correctly (DefinitelyTyped).null
andundefined
cases. This doesn't seem to match with real-world behavior.Expected Current Behaviour
Inferno should have the correct type information exposed for the
ref
property. This is the largest hurdle I've encountered while attempting to resolve #686; most of the HTML typings can be used as-is from the React typings on DefinitelyTyped, and the code needed to use VNode etc. isn't that much.I believe the correct type for a
ref
attribute would be:Inferno Metadata
macOS 10.12, inferno 3.9.0
The text was updated successfully, but these errors were encountered: