Giter Club home page Giter Club logo

Comments (4)

enyo avatar enyo commented on August 16, 2024 1

Just ran into this. This fails for me:

<script lang="ts">
  let period: 'monthly' | 'yearly' = 'yearly'
</script>

{#if period === 'monthly'}
  paid every month
{/if}

With this error:

Error: This comparison appears to be unintentional because the types '"yearly"' and '"monthly"' have no overlap. (ts)

EDIT: To temporarily work around this issue, I changed the typescript dependency to: 5.3.x

from language-tools.

4750moorem avatar 4750moorem commented on August 16, 2024

Just ran into this. This fails for me:

<script lang="ts">
  let period: 'monthly' | 'yearly' = 'yearly'
</script>

{#if period === 'monthly'}
  paid every month
{/if}

With this error:

Error: This comparison appears to be unintentional because the types '"yearly"' and '"monthly"' have no overlap. (ts)

EDIT: To temporarily work around this issue, I changed the typescript dependency to: 5.3.x

You can cast the string 'yearly' as 'monthly' | 'yearly' to get around it for now if you wanna stay on 5.4.x.

 let period: 'monthly' | 'yearly' = 'yearly' as 'monthly' | 'yearly' 

from language-tools.

jasonlyu123 avatar jasonlyu123 commented on August 16, 2024

This one is expected because there isn't any reassignment. If your actual case has an assignment somewhere that isn't binding. Can you share it here?

from language-tools.

danieldiekmeier avatar danieldiekmeier commented on August 16, 2024

@dummdidumm Sadly, this is not completely fixed in the latest svelte-check v3.6.8. Maybe it's missing a special case for bind:group? At least that's the problem I'm running into. I built a small reproduction: https://stackblitz.com/edit/vitejs-vite-r64k1v?file=src%2FApp.svelte

If you run pnpm i && pnpm check, you can still see the error.

from language-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.