Conversation

DanielRosenwasser

Fixes #30455.

@DanielRosenwasser

@typescript-bot run dt

@typescript-bot

Heya @DanielRosenwasser, I've started to run the Definitely Typed test suite on this PR at 53e76b3. You can monitor the build here. It should now contribute to this PR's status checks.

@DanielRosenwasser

The only breakages on DefinitelyTyped seem to be

  • amap-js-api
  • amap-js-api-indoor-map
  • amap-js-api-map3d

And those all really come from amap-js-api unnecessarily plopping Omit in the global scope.

@DanielRosenwasser

A fix is now out to DefinitelyTyped's amap-js-api package.

I used BigTSQuery to partially assess the breakage with the following query

SourceFile:not([externalModuleIndicator]) > TypeAliasDeclaration > Identifier[name=Omit]

BigTSQuery isn't fully up to date (@urish out of curiosity, how recent is the dataset?), but we saw three distinct results:

Also:

@DanielRosenwasser

We discussed this at #30738 and believe that the breakage can be easily communicated and is more limited than we initially anticipated.

@levenleven

Keys are not limited to keyof T. Is that on purpose?

@vkrol

@levenleven

Should we constrain K in the official definition?

Nah

#30738

🤔

@DanielRosenwasser

Exclude doesn't constrain its second type parameter on the first, so we felt like it would be strange to do that with Omit.

@DanielRosenwasser

Note, if you feel that shouldn't be the case, I'd encourage you to open up a separate issue to discuss it.

@seansfkelleyseansfkelley mentioned this pull request Apr 9, 2019
5 tasks
@urish

@DanielRosenwasser the BigTSQuery dataset has last been updated around June 2018. If you find it useful, I can spend some time updating it

@felixfbecker

Can Omit please be made strict before 3.5 moves to stable? #30825

@RyanCavanaugh

@felixfbecker the definition was intentional.

@leoyli

@DanielRosenwasser

Exclude doesn't constrain its second type parameter on the first, so we felt like it would be strange to do that with Omit.

But how a bout the case of Pick? Pick do constrain the use case.

Pick: pick members from a group to get a sub-group;
Omit: omit members in a group to get a sub-group;

As you can see, these 2 helper types are somehow complimentary. Looks pretty nature and intuitive when we use them together. How come Omit being permissive and Pick isn't???

When we make comparison, compare Omit with Exclude is like compare egg with chicken. Exclude is comparable with Extract not Omit, which should be Pick, IMHO.

@OliverJAsh

I've ran into a few bugs which would have been caught if K was constrained (like it is for Pick). Any chance of reconsidering this?

Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Add Omit as a known interface