Giter Site home page Giter Site logo

Comments (4)

Pmyl avatar Pmyl commented on May 18, 2024

Tell me if I'm wrong, to solve this at some extent we just need to normalize the variable names to avoid [Symbol.toStringTag] to error as a name. The fact is that normally a Promise is not mocked entirely so probably it shouldn't happen here too.

This issue actually brings up a problem with intersection types when one part of the intersection is a function. That is going to either fail miserably in the same way as the Promise case or is just going to mock entirely the Function without using the MockFactory (jasmine, jest, etc).

Maybe we need to review how we handle intersection types?

from ts-auto-mock.

uittorio avatar uittorio commented on May 18, 2024

Yes, so the problem is how we are handling intersection types. Right now is using getPropertyOfTypes from typescript api, and that functionality try to fetch all the properties of a real Promise. We definitely have to solve Symbol.toStringTag and I have to make sure that the type is converted to our Promise before converting it. Unfortunately the conversion of the Promise is not centralised yet

from ts-auto-mock.

Pmyl avatar Pmyl commented on May 18, 2024

@uittorio I think this is already working. The behaviour is that if something comes from typescript types it ignores it completely.

Let me know if this can be closed

from ts-auto-mock.

uittorio avatar uittorio commented on May 18, 2024

We can ignore this issue with the assumption that we ignore typescript libs for intersections. If we are happy with that we can close it for now. If in the future we need the functionality we can open a new issue

from ts-auto-mock.

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.