Initial checklist
Problem
I'm using TypeScript with "moduleResolution": "Node16" and JSX, and I want to have explicit return types. Currently I do this:
import type { Root, Element } from "hast";
const Foo = (): Root | Element => <div />;
Instead, I'd like to be able to do this:
const Foo = (): JSX.Element => <div />;
I know it's an alias of HResult, which can be imported from lib/core, but it isn't idiomatic, and lib/core currently isn't exposed, so it doesn't work in this module resolution mode.
Solution
@types/react puts JSX in declare global. Could hastscript do that too?
Alternatives
Export lib/core.
Initial checklist
Problem
I'm using TypeScript with
"moduleResolution": "Node16"and JSX, and I want to have explicit return types. Currently I do this:Instead, I'd like to be able to do this:
I know it's an alias of
HResult, which can be imported fromlib/core, but it isn't idiomatic, andlib/corecurrently isn't exposed, so it doesn't work in this module resolution mode.Solution
@types/reactputs JSX indeclare global. Couldhastscriptdo that too?Alternatives
Export
lib/core.