Giter Club home page Giter Club logo

Comments (15)

NetanelBasal avatar NetanelBasal commented on June 1, 2024 1

lol, that's precisely what I did right now.

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024 1

Thank you. Feel free to give more feedback or issues. :)

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

Isn't it simply just a question of changing Element to R here? https://github.com/NetanelBasal/spectator/blob/master/src/lib/src/internals.ts#L69

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024

In general, you are right. It's a question of what is the more common case? If you most of the times query for DOM element it's more convenient. Don't you think so?

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

Then perhaps change the return value to HTMLElement instead of Element so common things like .click() work without having to cast the return value?

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024

BTW, Why are you not using the built-in click method?

spectator.click('button');

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

Because i didn't know that API existed 😁

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024

It will click and trigger change detection for you.

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

Excellent! Just changed my test to use that API :)

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024

https://netbasal.gitbooks.io/spectator/api.html

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

I guess we can close this issue then.

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024

I love your idea, but it means that if I changed it, everyone would get the any type. It means that you must pass a type.

spectator.query<HTMLButtonElement>("button");

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

You could do query<R = Element>(directiveOrSelector: string, options?: { read }): R;

from spectator.

NetanelBasal avatar NetanelBasal commented on June 1, 2024

I'm releasing a new version with this change for all queries methods.

from spectator.

jpzwarte avatar jpzwarte commented on June 1, 2024

Great, thanks!

from spectator.

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.