I'm contributing to a DT package, sometimes I got message implying it doesn't compare types structurally:
1. eslint: TypeScript expected type to be:
boolean | "yes or no"
got:
"yes or no" | NonNullable<boolean | undefined> [@definitelytyped/expect]
It's inconvenient for writing tests as the result type might be wrapped inside another generic in the future.
If the wrapper type is not a simple utility type, it can be confusing what exact type this test is expecting.
I know I can add & {} to the return type in the definition, but that would also make it confusing for maintainers.
And I did have a grep on the DT codebase, it turns out I would be the first one to do & {} for the return type 😅
I'm contributing to a DT package, sometimes I got message implying it doesn't compare types structurally:
It's inconvenient for writing tests as the result type might be wrapped inside another generic in the future.
If the wrapper type is not a simple utility type, it can be confusing what exact type this test is expecting.
I know I can add
& {}to the return type in the definition, but that would also make it confusing for maintainers.And I did have a grep on the DT codebase, it turns out I would be the first one to do
& {}for the return type 😅