-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Crank currently defines the JSX module globally, but it would be nice to have it work locally.
JSX type checking is driven by definitions in a JSX namespace, for instance JSX.Element for the type of a JSX element, and JSX.IntrinsicElements for built-in elements. Before TypeScript 2.8 the JSX namespace was expected to be in the global namespace, and thus only allowing one to be defined in a project. Starting with TypeScript 2.8 the JSX namespace will be looked under the jsxNamespace (e.g. React) allowing for multiple jsx factories in one compilation. For backward compatibility the global JSX namespace is used as a fallback if none was defined on the factory function. Combined with the per-file @jsx pragma, each file can have a different JSX factory.
Apparently you can do local JSX modules, rather than the global one. I couldn’t figure out how to get it working, because I couldn’t find any examples which don’t use the old namespace syntax.