You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type DemoType = {
optionalProp?: string
}
const filteredList = propEq('Yes', 'optionalProp')({ optionalProp: 'Yes' } as DemoType)
This produces this error:
Argument of type 'DemoType' is not assignable to parameter of type 'Record<"optionalProp", string>'. Types of property 'optionalProp' are incompatible. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.
I feel like this should work just fine? The code runs as expected, just produces a the error.
it doesn't error if you pass all parameters at the same time rather than using the curried functions. I'm really not sure why. propEq('Yes', 'optionalProp', { optionalProp: 'Yes' } as DemoType)
I've forked the project and written a failing test, but sadly I'm not proficient enough at typescript to write something that does any type guarding but allows my use case.
The text was updated successfully, but these errors were encountered:
This produces this error:
Argument of type 'DemoType' is not assignable to parameter of type 'Record<"optionalProp", string>'. Types of property 'optionalProp' are incompatible. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.
I feel like this should work just fine? The code runs as expected, just produces a the error.
it doesn't error if you pass all parameters at the same time rather than using the curried functions. I'm really not sure why.
propEq('Yes', 'optionalProp', { optionalProp: 'Yes' } as DemoType)
I've forked the project and written a failing test, but sadly I'm not proficient enough at typescript to write something that does any type guarding but allows my use case.
The text was updated successfully, but these errors were encountered: