Giter Site home page Giter Site logo

Comments (4)

7nik avatar 7nik commented on June 2, 2024 1

Obviously, the concept of reactive expressions doesn't even exist in TS. So TS thinks that when buildBoundingBoxes(inspectResult?.elements)) is executed, inspectResult can only be null. And then it seems to face this issue microsoft/TypeScript#41766.

It seems another workaround is inspectResult!?.elements.

from svelte.

dummdidumm avatar dummdidumm commented on June 2, 2024

Yeah this is a type narrowing issue, and the type is widened in the lambda.
Another way to get around it is to type the $state generic: let foo = $state<boolean | null>(null)

Giving this the documentation label because there's not much we can do.

from svelte.

eighty4 avatar eighty4 commented on June 2, 2024

Why wouldn't derived.by be the API style of derived and drop derived.by? I'm not sure why compiler magic that necessitates a duplicate rune to work around trumps having a natural API.

from svelte.

7nik avatar 7nik commented on June 2, 2024

@eighty4 it was discussed multiple times, including in the initial #10240

from svelte.

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.