Skip to content

Conversation

MurhafElmasri
Copy link

@MurhafElmasri MurhafElmasri commented Dec 21, 2021

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

type USD={id:'usd'} & number
const usd: USD = 5 as USD  // typescript allow this
const 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 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.

1 participant