Giter VIP home page Giter VIP logo

Comments (4)

jdoklovic avatar jdoklovic commented on May 29, 2024

If this is indeed true, I would suggest either putting all of that type conversion in, OR refactoring the library to explicitly deal with strings to make it less confusing.

from survey.

AlecAivazis avatar AlecAivazis commented on May 29, 2024

Thanks for another issue @jdoklovic!

Indeed, you are correct that at the moment Input will always return a string. I tried to document this in the README but I need to do more work detailing these "constraints". I am personally a fan of keeping survey simple and pushing any sort of type assertion/casting logic outside (beyond what was necessary to support prompts like MultiSelect and Confirm) but i will continue to think about wether this belong in survey or not.

Since you are the first person to request it, i'm inclined to hold of on more large refactoring that introduces more logic in the background. You should be able to use the string conversion you showed me earlier in order to satisfy your immediate use case. If more people ask for this sort of conversion, we can revisit what sort of type semantics belong in survey as a whole.

from survey.

jdoklovic avatar jdoklovic commented on May 29, 2024

It's fine if it only deals with strings, but if that's the case, it's currently super painful to do the type stuff at a higher level. I'll try to send you some code illustrating what i have to do in a bit

from survey.

AlecAivazis avatar AlecAivazis commented on May 29, 2024

I'm going to close this now since the prompts should be converting to whatever type is handed to them. Thanks again for all the work with the type conversions!

from survey.

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.