Giter Site home page Giter Site logo

Comments (7)

piotrwitek avatar piotrwitek commented on May 18, 2024

I like this types, they are definitely useful.

For the name I would propose:

  • PickByValue
  • OmitByValue

I choose this name because regular pick is picking by key, and PickByValue is picking by the value, check the example below:

Examples:

type PickByValue<Base, Condition> = Pick<
  Base,
  { [Key in keyof Base]: Base[Key] extends Condition ? Key : never }[keyof Base]
>;

type Props2 = { name: string; 0: boolean };

type SomeProps1 = Pick<Props2, 0>;
// Expect: { 0: boolean }

type SomeProps2 = PickByValue<Props2, boolean>;
// Expect: { 0: boolean }

Accepting PR's.

from utility-types.

piotrwitek avatar piotrwitek commented on May 18, 2024

It's merged but I'm blocking the release for the moment. Mainly because there are few other API proposals and until all of them are sorted out I don't want to make a mistake and introduce some breaking changes in the process.

from utility-types.

ProdigySim avatar ProdigySim commented on May 18, 2024

What happened to these? It looks like they got merged, but then they were removed from index.ts... and are now difficult to import.

from utility-types.

zepatrik avatar zepatrik commented on May 18, 2024

currently:

import { PickByValue, OmitByValue } from 'utility-types/dist/mapped-types'

from utility-types.

piotrwitek avatar piotrwitek commented on May 18, 2024

I'll have some time during weekend, so hopefully I can finish the proposal for this API and make it public

from utility-types.

IssueHuntBot avatar IssueHuntBot commented on May 18, 2024

@BoostIO has funded $30.00 to this issue.


from utility-types.

IssueHuntBot avatar IssueHuntBot commented on May 18, 2024

@piotrwitek has rewarded $21.00 to @piotrwitek. See it on IssueHunt

  • 💰 Total deposit: $30.00
  • 🎉 Repository reward(20%): $6.00
  • 🔧 Service fee(10%): $3.00

from utility-types.

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.