-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Typed to
Arguments
#44
Comments
Interesting idea. But I wonder if it's good to provide the same functionality in multiple ways. Actually, I made the new statement.Iam()
.deny()
.toDeletePolicy()
.toDeletePolicyVersion()
.toCreatePolicyVersion()
.toSetDefaultPolicyVersion(); I'll have a look and try literal types, but I'm not sure JSII will like this. Wondering how this would be translated to other languages. |
Hehe - I almost forgot about these methods :D - Still, I think literal types could be quite interesting for Typescript users.
I'm almost certain |
Interestingly this compiles with jsii. Not sure it would be usable though. Wouldn't be the first time something passes jsii building and then throws up when imported. But my first quick test shows literal types are of no use at all. Because, again, the type Test = 'Foo' | 'Bar' | 'and 8722 more strings here' | string; And while code suggestion and auto-completion does work for pure literal types, with the fallback of It would only work if there are two seperate methods, one supporting all the literal types and one for fallback.
Could you elaborate on how this is benefitial? You already get completion/suggestion for all the distinct methods which include detailed documentation on which resources and conditions can be used in conjunction. |
I prepared a PR just to see how this would look. |
Given the following example:
It'd be great if the the argument for
to
would be fully typed, so that the editor / IDE could auto-complete permissions. I think it's fairly striaghtforward for the full permission names, but rather complicated for wildcards (e.g..to('Delete*')
to still be considered valid for Typescript. Perhaps literal types could help with that.The text was updated successfully, but these errors were encountered: