TypeScript Version: 3.4.0-dev.20190226
Search Terms:
JSX element constructor function
Code
import * as React from "react";
function Foobaz() {
return "Foobaz";
}
<Foobaz />;
Expected behavior:
Code compiles. This is a basic functional component that always returns a string, one of the valid things that React will render.
Actual behavior:
test.tsx:6:1 - error TS2605: JSX element type 'string' is not a constructor function for JSX elements.
I have the horrible feeling that I'm doing something incredibly stupid, but I can't see what.
Playground Link:
Playground does not support tsx.
Other Information:
tsconfig.json:
{
"compilerOptions": {
"jsx": "react"
}
}
package.json deps:
"devDependencies": {
"@types/react": "^16.8.5",
"react": "^16.8.3",
"typescript": "^3.4.0-dev.20190226"
}
Related Issues:
The phrase "JSX element type
See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20544 and related issues
Many thanks. At least there's another way to search for that issue now.
Most helpful comment
Many thanks. At least there's another way to search for that issue now.