Skip to content

forgo.mount() typing not matching with behaviour #72

@chronoDave

Description

@chronoDave

When trying to run the following code I got an unexpected error:

import * as forgo from "forgo";

const App= () =>
  new forgo.Component({
    render() {
      return <p>Tooltip</p>;
    }
  });

forgo.mount(document.getElementById("root"), <App />);

forgo.min.js:520 Uncaught Error: The container argument to the mount() function should be an HTML element.

Now, because of the typing of mount(), this doesn't throw an error, though I'm not sure why.

export function mount(
  forgoNode: ForgoNode,
  container: Element | string | null
): RenderResult {
  return forgoInstance.mount(forgoNode, container);
}

null however is never a valid container because if (parentElement) will always return false.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions