Skip to content

Add .exclude and .extract helpers#220

Merged
mmkal merged 8 commits intomainfrom
exclude-extract
Dec 8, 2020
Merged

Add .exclude and .extract helpers#220
mmkal merged 8 commits intomainfrom
exclude-extract

Conversation

@mmkal
Copy link
Owner

@mmkal mmkal commented Nov 30, 2020

Closes #219

@reiv do you think this would help with the use case you described?

@codecov-io
Copy link

Codecov Report

Merging #220 (5951c57) into main (11e6d41) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #220   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           40        40           
  Lines          710       710           
  Branches       116       116           
=========================================
  Hits           710       710           
Impacted Files Coverage Δ
packages/expect-type/src/index.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11e6d41...5951c57. Read the comment docs.

@reiv
Copy link

reiv commented Nov 30, 2020

@mmkal yep, that would mean I wouldn't have to extract the object-like member into a separate type to test it. My use case would be closer to this (I edited my reply in the linked issue to reflect this as well):

expectTypeOf<ResponsiveProp<number>>().excluding<number | number[]>().toHaveProperty("sm");
expectTypeOf<ResponsiveProp<number>>().excluding<number | number[]>().not.toHaveProperty("xxl");

i.e. validating its usage as an input type.

@mmkal mmkal changed the title Add .excluding and .extracting helpers Add .exclude and .extract helpers Dec 4, 2020
@mmkal mmkal merged commit 7827d7d into main Dec 8, 2020
@mmkal mmkal deleted the exclude-extract branch December 8, 2020 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[expect-type] not.toMatchTypeOf error on non-matching union type

3 participants