Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix intersections with primitives to add support for nominal types#120

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MurhafElmasri wants to merge2 commits intowoutervh-:master
base:master
Choose a base branch
Loading
fromMurhafElmasri:Fix-intersections-with-primitives-to-add-support-for-nominal-types

Conversation

MurhafElmasri
Copy link

@MurhafElmasriMurhafElmasri commentedDec 21, 2021
edited
Loading

as issue#110 stated mention, typescript-is does not support adding nominal types. while typescript does for example:

type USD={id:'usd'} & numberconst usd: USD = 5 as USD  // typescript allow thisconst x=5;console.log(is(<USD>(x)) // --> false

Suggested fix

we can notice that every time we intersect an object with primitive type the return type will the primitive type, So simply what I did is return the that primitive type when ever there is intersection between it and any object

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@MurhafElmasri

[8]ページ先頭

©2009-2025 Movatter.jp