diff --git a/src/lib/react/ReactMacro.hx b/src/lib/react/ReactMacro.hx index 58bbac1..3dd5202 100644 --- a/src/lib/react/ReactMacro.hx +++ b/src/lib/react/ReactMacro.hx @@ -475,7 +475,10 @@ class ReactMacro } // Support "import as" - function deepFollow(t:Type) return TypeTools.map(Context.follow(t), deepFollow); + function deepFollow(t:Type) { + if (t == null) return null; + return TypeTools.map(Context.follow(t), deepFollow); + } var t = deepFollow(Context.typeof(macro { var __pseudo = $target; diff --git a/test/src/ReactMacroTest.hx b/test/src/ReactMacroTest.hx index ba423f9..b2cae71 100644 --- a/test/src/ReactMacroTest.hx +++ b/test/src/ReactMacroTest.hx @@ -14,6 +14,9 @@ class CompBasic extends ReactComponent {} @:ignoreEmptyRender class CompBasicProps extends ReactComponentOfProps<{a:Int}> {} +@:ignoreEmptyRender +class CompRenderFunctionProps extends ReactComponentOfProps<{?render:()->ReactElement}> {} + typedef RenderProps = { @:optional var children:Int->ReactFragment; } @@ -409,6 +412,16 @@ class ReactMacroTest } } + @Test + public function render_function_props() { + function fn() return jsx('<>'); + var e = jsx(''); + assertHasProps( + e.props, + ['render'], [fn] + ); + } + @Test public function DOM_with_children_should_be_array() {