forgojs / forgojs/forgo

forgo.mount() typing not matching with behaviour

Open
#72 3 comments 0 reactions 1 assignee Claimed by @spiffytech View on GitHub
Dominant language
TypeScript
Stars
321
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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

```tsx
import * as forgo from "forgo";

const App= () =>
new forgo.Component({
render() {
return

Tooltip

;
}
});

forgo.mount(document.getElementById("root"), );
```

`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.

```ts
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`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.