Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor type checks #1280

Merged
merged 6 commits into from
Aug 8, 2022
Merged

Refactor type checks #1280

merged 6 commits into from
Aug 8, 2022

Conversation

colinhacks
Copy link
Owner

No description provided.

@netlify
Copy link

netlify bot commented Jul 22, 2022

Deploy Preview for guileless-rolypoly-866f8a ready!

Name Link
🔨 Latest commit e8de9c7
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/62de4a3589c2bf0008d38963
😎 Deploy Preview https://deploy-preview-1280--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@colinhacks colinhacks changed the title Switch to conditional-type-checks and tsx Switch to conditional-type-checks Jul 22, 2022
@ecyrbe
Copy link
Contributor

ecyrbe commented Jul 23, 2022

conditional type checks lib seems hacky and over complicated.
can't you just use this :

type Assert<T, U> =
    (<V>() => V extends T ? 1 : 2) extends
    (<V>() => V extends U ? 1 : 2) ? true : 
    { error: "Types are not equal"; type1: T; type2: U };

If you want to be a little less strict to handle intersections , see my comment here

i use it for zodios and it seems to pass all my checks.
i made an article about it here on dev.to

@colinhacks
Copy link
Owner Author

Sure, sounds good! That's some dark type magic.

@colinhacks colinhacks changed the title Switch to conditional-type-checks Refactor type checks Jul 25, 2022
@colinhacks colinhacks merged commit f923706 into master Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants