Coder Social home page Coder Social logo

Comments (1)

chriskrycho avatar chriskrycho commented on July 18, 2024

While I understand your POV, this is strictly not a regression, it's an intentional change in the type to match the actual behavior. There is no way for find() to actually provide something of that type, so we are not going to ship a type definition which pretends it does.

While folks often use generics/type params like this as a convenient way to do a cast, there's a very good reason that most ESLint (and historically also TSLint!) rule sets forbid generic types which constrain the return type without any relation to an input parameter. That reason is: it is literally always a lie for a generic to appear on a call expression like this other than a constructor type (where it is narrowing what you can do with the returned type from an otherwise unconstrained default). Net: this was always an inappropriate use of a generic parameter.

To be clear: I understand why you might find the decrease in convenience annoying, especially in tests. But it's not a regression, and we're not going to revert it.

(And no, shipping something stronger than TS does is not necessarily "overly opinionated": TS has to balance not breaking every single piece of DOM code using TS out there against correctness, and they might well make different decisions today if starting from scratch!)

from ember-test-helpers.

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.