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

Not attribute shouldn't be mandatory in casl-react when using Typescript #95

Closed
zareth opened this issue Jul 26, 2018 · 2 comments
Closed
Labels

Comments

@zareth
Copy link

zareth commented Jul 26, 2018

The not attribute for the types CanProps and CanPropsStrict in @casl/react is defined as mandatory. From looking at the examples it seems this attribute should be optional.

The following should be possible (taken from project readme)

<Can I="create" a="Post" ability={ability}>
  () => <button onClick={this.createPost.bind(this)}>Create Post</button>
</Can>

The above will result in a type error as the not attribute is missing.

With the current type definitions you have to write it as follows

<Can not={false} I="create" a="Post" ability={ability}>
  () => <button onClick={this.createPost.bind(this)}>Create Post</button>
</Can>
@stalniy
Copy link
Owner

stalniy commented Jul 26, 2018

Thanks for the issue! Could you please create a PR for this?

@stalniy stalniy added the bug label Jul 29, 2018
@stalniy
Copy link
Owner

stalniy commented Jul 29, 2018

Fixed in @casl/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants