Repository: TypeScript
Issue: Support non-constructor JSX factory functions
Labels: Suggestion,Awaiting More Feedback

**TypeScript Version:**  3.3.3  to 3.8.3

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**
jsx factory function constructor component ElementClass 

**Expected behavior:**
I'm trying to pass a factory function instead of a class component as a JSX element constructor function. It should be possible according to the Handbook, as described [here](https://www.typescriptlang.org/docs/handbook/jsx.html). See the example under the `Type checking -> class component` section (I can't deep-link with hash/anchor because the server isn't properly configured :( ). I should get no errors with the code provided below.

**Actual behavior:**
I get the following error:
```
JSX element type '{ render: () => { custom: string; }; }' is not a constructor function for JSX elements.
  Property 'custom' is missing in type '{ render: () => { custom: string; }; }' but required in type 'Element'.(2605)
```
From what I can tell, this used to work, but the behavior broke somewhere between v3.1.6 and v3.3.3 (as tried in the Playground). I'm guessing there was some change that altered detection between React function components and class components and that change introduced this bug. I'm not even sure if React runtime even allows factory functions, but my use case is a custom library and I'm not using React at all. This error is the same regardless of using React or not.

Also, with the exact example from the Handbook, because the JSX.Element is not specified explicitly, there is no error, even when there should be one. See [Playground Link for Handbook example](https://www.typescriptlang.org/play/index.html?jsx=1&ts=3.3.3#code/CYUwxgNghgTiAEA7KBbEBnADlMCBSAygBrwDeAUPPAJaIAuIMAZjggKIQhr0DC066MpSrw4iUDABc8KIgCeAbmEBfcqvKQoA+AFk5PAPYpMBxCHpCqYiQAoAlGVWqmAV0Rg61U7rkAxHHQGMH5uHl6I9paiIHQuMIhk0eKM0pEAvAB8jvBO5OQAPHqGxqbmdPAA9BkKlRXwBgDWBXr+HkEh7p7eVTUVdY15mtoAcgZ0AIIAalAQ1MDFJmYWpM6hXQmjE9OzwK2Bwb5r4ZEUVjFxCStK6vmbUzNzC6UWPbXwjDBBBXfbc3vth064Uq1TeHy+QA)

<!-- Did you find other bugs that looked similar? -->
**Related Issues:**
https://github.com/microsoft/TypeScript/issues/5740
https://github.com/microsoft/TypeScript/issues/5478

**Code**
```ts
declare namespace JSX {
  interface Element {
    custom: string;
  }
  interface ElementClass {
    render: () => Element;
  }
}

class MyComponent {
  render() {
    return {
      custom: "2"
    };
  }
}
function MyFactoryFunction() {
  return { render: () => { return { custom: "2" }; } }
}
function MyFunctionComponent() {
  return { custom: "2" }
}

<MyComponent />; // ok
<MyFactoryFunction />; // ok
<MyFunctionComponent />; // ok

class NotAValidComponent {}
function NotAValidFactoryFunction() {
  return {};
}

<NotAValidComponent />; // error
<NotAValidFactoryFunction />; // error
```



<details><summary><b>Output</b></summary>

```ts
"use strict";
class MyComponent {
    render() {
        return {
            custom: "2"
        };
    }
}
function MyFactoryFunction() {
    return { render: () => { return { custom: "2" }; } };
}
function MyFunctionComponent() {
    return { custom: "2" };
}
<MyComponent />; // ok
<MyFactoryFunction />; // ok
<MyFunctionComponent />; // ok
class NotAValidComponent {
}
function NotAValidFactoryFunction() {
    return {};
}
<NotAValidComponent />; // error
<NotAValidFactoryFunction />; // error

```


</details>


<details><summary><b>Compiler Options</b></summary>

```json
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "useDefineForClassFields": false,
    "alwaysStrict": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "downlevelIteration": false,
    "noEmitHelpers": false,
    "noLib": false,
    "noStrictGenericChecks": false,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "esModuleInterop": true,
    "preserveConstEnums": false,
    "removeComments": false,
    "skipLibCheck": false,
    "checkJs": false,
    "allowJs": false,
    "declaration": true,
    "experimentalDecorators": false,
    "emitDecoratorMetadata": false,
    "target": "ES2017",
    "module": "ESNext"
  }
}
```


</details>

**Playground Link:** [Provided](https://www.typescriptlang.org/play/index.html?jsx=1#code/CYUwxgNghgTiAEA7KBbEBnADlMCBSAygBrwDeAUPPAJaIAuIMAZjggKIQhr1mVXxgArujoB7FAC54ImLQDmAbj4BfPrQbNW8DlxD0AwtHTpe-eHESgYUgBQBKeAF4AfNs7c6SqqtXlIUY3gAWQBPfXFMUUQ9OlNzPSt7OKo4OkEYRGT+IRFxKQAiACZ8vm8veB9yJkFEMDpqKOCQgDEcMRgWmrqGxCSKFJA0jLJ4y0ZbBxcR1PTM0gFhMUl4IvyKhQqK8lVq2vrG0Oau-cRwlEjo+j6+GeH5nKWC4q3fAB5Qs4uY+AB6Zw2fj94KIANbkd4tNqiDpHPY9X7-X5A0Hgw7HHqfKLfP4A5FgvxGEwAOVEdAAggA1KAQajATGXWKkHboxok8lUmnAVp1aGdOFRa4DIZzZRKN5synU2n07GIwHwRgwaHgiUc2nc9p87qNHFIhUwJUwIA)