Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false negative with array_of #18

Open
kmarkus opened this issue Dec 7, 2023 · 0 comments
Open

false negative with array_of #18

kmarkus opened this issue Dec 7, 2023 · 0 comments

Comments

@kmarkus
Copy link

kmarkus commented Dec 7, 2023

It seems that the array_of type doesn't detect invalid keys in the top-level table.

Example:

local types = require("tableshape").types
                                                                                                                                                               
local oneof_shape = types.array_of(
   types.shape { foo = types.number}
)

print(oneof_shape({xyz=2})) -- -> true, should be false

I would have expected an error about an unexpected key-value pair.

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

No branches or pull requests

1 participant