Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1758

Svelte: correct way to use type ReactiveValue< number | undefined > in a comparison?

$
0
0

I'd like to make the following comparison:

import { innerWidth } from 'svelte/reactivity/window';const breakPoint = 777;let screenIsBig: boolean = $derived(innerWidth >= breakPoint);

However, this produces an error:

Operator '>=' cannot be applied to types 'ReactiveValue<number | undefined>' and 'number'

I suspect, I'm just not familiar enough with TypeScript to understand the obvious solution to this. Can anyone with Svelte+TypeScript exeprience advise on the correct way to achieve something like this comparison?


Viewing all articles
Browse latest Browse all 1758

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>