GithubHelp home page GithubHelp logo

Comments (9)

scalvert avatar scalvert commented on June 12, 2024 1

After talking to @rwjblue, it sounds like native is fine if you don't support IE11 (makes sense). We should probably use PromiseLike<T>, instead. Just trying to figure out the optimal return type.

from ember-test-waiters.

scalvert avatar scalvert commented on June 12, 2024

Thanks, @NullVoxPopuli. I could be wrong, but I think the issue here is you're trying to intermix native and RSVP promises.

https://github.com/NullVoxPopuli/emberclear/blob/master/packages/frontend/app/services/toast.ts#L57

You're not importing RSVP promise in this service, but rather using native promises, so waitForPromise will error due to a type mismatch.

from ember-test-waiters.

NullVoxPopuli avatar NullVoxPopuli commented on June 12, 2024

waitForPromise will error due to a type mismatch.

right, but waitForPromise is compat with native Promises, so the types should be updated, yeah?

PR: #130

from ember-test-waiters.

scalvert avatar scalvert commented on June 12, 2024

We specifically import RSVP.Promise and use that in waitForPromise. So I'm not sure that's true?

from ember-test-waiters.

scalvert avatar scalvert commented on June 12, 2024

We additionally specifically use RSVP.Promise in our tests, so we're not testing for native promises.

from ember-test-waiters.

NullVoxPopuli avatar NullVoxPopuli commented on June 12, 2024

sure, but isn't RSVP.Promise pretty much a polyfill at this point? the APIs are the same

from ember-test-waiters.

NullVoxPopuli avatar NullVoxPopuli commented on June 12, 2024

like, should I not use waitForPromise / ember-test-waiters if I want to use native promises? seems weird to need to fork the repo for a type error :-\

I s`pose I could add tests for native promises?

from ember-test-waiters.

scalvert avatar scalvert commented on June 12, 2024

Looking at this again, and playing with it a while, I think we should stick with what you have. If we use PromiseLike<T>, that interface doesn't include catch and finally. That means that we'd be narrowing the return type from waitForPromise, which isn't what we want to be doing.

from ember-test-waiters.

scalvert avatar scalvert commented on June 12, 2024

Resolved with #130

from ember-test-waiters.

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.