Git Product home page Git Product logo

Comments (3)

adam-coster avatar adam-coster commented on June 8, 2024 1

Whoops, apparently we don't use DsGrids in any of our projects!

The accessor fix will be in the next version (after 1.3.2) by end of day Central Time.

I'm not sure why the global is ending up with an Any type, though using global.X is challenging for the parser since it's not possible to determine which global.X = assignment is the initial declaration (Stitch uses the declaration, or the first discovered assignment to determine the type).

If you use globalvar to declare them that might resolve it, since that unambiguously indicates where the declaration of that variable is.

from stitch.

adam-coster avatar adam-coster commented on June 8, 2024 1

Yeah the global thing is just sorta incompatible with static analysis, unfortunately.

Since Stitch only assigns types when things are assigned, you should be able to ensure that a type is correct for a given global.X if you:

  • Find each assignment for that global global.X = ...
  • Above each, add a /// @type {TheType} JSDoc above it (this is a Stitch extension to Feather's JSDocs)

Stitch gives the /// @type {TheType} directive precedence over inferred types, so as long as you can ensure that the first assignment Stitch sees is explicitly typed like that (by explicitly typing all assignments) you should end up with what you want.

Note that Stitch works from top to bottom on files, so you would only need to explicitly type a global's first assignment in a given file.

The latest version (1.4.0) was just published a moment ago and includes the DsGrid accessor fix, among a bunch of other fixes.

from stitch.

stdc105 avatar stdc105 commented on June 8, 2024

This is great! Unfortunately we're using global.STUFF to define all of our global variables and we may not be able to change them right now, but that's okay, "Find References" works on global and in most cases I know the types already. Thank you for all the help and fixes!

from stitch.

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.