Replies: 1 comment 7 replies
-
I don't know Typescript, so I may be completely off in my answer. In Psalm (and also in PHPStan), array shapes are not "strict". Which means that any key not directly documented in the shape could still be in the array without issue. (which means, if you document a function as expection We don't currently have a strict array (which would forbid other keys in the shape). The closest thing we do have is that you should be able to document a known forbidden key as |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I could only find this, which seems to be unfinished: https://psalm.dev/docs/annotating_code/type_syntax/atomic_types/#magical-types
I'm looking for something similar to mapped types, because I'm trying to remove multiple keys from a shape. unset() is able to do that, but so far I'm unable to replicate the behaviour.
To clarify, I need either something like typescript's Omit<>, or some way of subtracting a shape from another shape.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions