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

"This comparison appears to be unintentional" error, why?

$
0
0

I don't know how to reproduce the following in the svelte-5 REPL because it doesn't recognize enum from the same file:

<script lang="ts">    enum Pro {        ZERO,        ONE,        TWO    }    let pros: Pro = $state(Pro.ZERO);    const again: boolean = $derived(pros == Pro.ONE || pros == Pro.TWO);</script>

I'm getting the typescript error:

This comparison appears to be unintentional because the types 'Pro.IDLE' and 'Pro.ONE' have no overlap. ts(2367)

Why?


Viewing all articles
Browse latest Browse all 1545

Trending Articles



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