You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I can't claim to fully grasp local JSX modules nor how they relate to Typescript but I love the Crank project and so wanted to help “unstuck” this issue. Is this commit from the Preact project any help? preactjs/preact@f24669f
@steinitz It sure is interesting! Thanks for the heads up. I still can’t seem to figure out how to get it working. Preact is using a d.ts file, which may or may not be an important difference?
Crank currently defines the JSX module globally, but it would be nice to have it work locally.
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#locally-scoped-jsx-namespaces
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.
The text was updated successfully, but these errors were encountered: