-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Type inference for conditions? #865
Comments
The alias should just be |
Thanks got that instance condition checking thing working. But now when I create an empty hash parameter with this alias def api(method, route, query = {} of ReqQuery)
end it gives me this error x error in ./playlyfe.cr:93: expecting token '=>', not ','
def api(method, route, query = {} of ReqQuery, body = Object.new, raw = false) ^ Is this not possible or is there some other syntax because I have a lot of methods with this and don't want to redefine the types. |
Simply do |
Thanks that works.. Need to learn more on crystal. |
I Have a constructor like this,
But I get this compile error shouldn't the compiler know that @store will never be nil.
Anyway I tried this
But then this gives this this error
And is there an easier way to alias this
{} of String => String
I tried
alias ReqQuery = Hash of String => String
But that doesn't seem to work.The text was updated successfully, but these errors were encountered: