Skip to content

Commit

Permalink
chore: solve lint error type 'undefined' is not assignable to type 'N…
Browse files Browse the repository at this point in the history
…ode' (#412)

# Motivation

Lint currently detects an error on `main`:

```
/Users/daviddalbusco/projects/dfinity/gix-components/src/lib/components/Tooltip.svelte:69:31
Error: Argument of type 'HTMLDivElement | undefined' is not assignable to parameter of type 'Node'.
  Type 'undefined' is not assignable to type 'Node'. (ts)
    // Move tooltip to the body to avoid it being cut off by overflow: hidden.
    document.body.appendChild(tooltipComponent);
  });
```
  • Loading branch information
peterpeterparker authored Apr 17, 2024
1 parent b968b43 commit 8d467c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/Tooltip.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
import { notEmptyString } from "@dfinity/utils";
import { nonNullish, notEmptyString } from "@dfinity/utils";
import { translateTooltip } from "$lib/utils/tooltip.utils";

export let id: string;
Expand Down Expand Up @@ -66,7 +66,7 @@

onMount(async () => {
// Move tooltip to the body to avoid it being cut off by overflow: hidden.
document.body.appendChild(tooltipComponent);
nonNullish(tooltipComponent) && document.body.appendChild(tooltipComponent);
});

let destroyed = false;
Expand Down

0 comments on commit 8d467c1

Please sign in to comment.