Closed
Description
TypeScript Version: 4.1.2
Search Terms:
no interface JSX.IntrinsicElements exists
Code
This works:
namespace JSX {
export interface IntrinsicElements {
div: {[k: string]: any}
}
}
const d = <div /> // <-- no error
type test = JSX.IntrinsicElements // <-- no error
But this does not work:
import type {JSX} from 'solid-js'
const d = <div /> // Error: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
// But JSX is in scope, just that JSX expressions do not see it.
// As an example, the following non-JSX code works fine:
type test = JSX.IntrinsicElements // <-- no error
Expected behavior:
It should see the definition of JSX.IntrinsicElements
which is clearly present due to the import
statement.
Actual behavior:
The JSX definition in the second example (import
ed) appears to be invisible to TS.
As you can see from both examples, only a locally-defined JSX
works, but not one that is import
ed.