Closed OmgImAlexis closed 2 years ago
Yeah, @sindresorhus this looks like a bug:
The Get<ObjectType, PathType> extends unknown ? DefaultValue : ...
here is wrong - it will always evaluate to DefaultValue
because everything extends unknown
. It should be changed to unknown extends Get<ObjectType, PathType> ? DefaultValue : ...
.
There might also be an issue with the tsd tests, they should be catching this. https://github.com/SamVerschueren/tsd/issues/142. I don't know tsd super well but it might be worth switching to expect-type over that bug - it essentially makes every test for this particular library pass no matter what, as far as I can tell.
"Expected" comes from the usage example in the readme and "Actual" comes from typescript's intellisense in VS Code.
The main thing I noticed is the setter and deleter don't seem to mutate the type.
I'm using
v6.0.1
of dot-prop with typescriptv4.2.4
.