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

Option to declare types with TypeCheck #33

Open
jtormey opened this issue Jul 15, 2022 · 8 comments · May be fixed by #34
Open

Option to declare types with TypeCheck #33

jtormey opened this issue Jul 15, 2022 · 8 comments · May be fixed by #34

Comments

@jtormey
Copy link

jtormey commented Jul 15, 2022

I've been using TypedEctoSchema for a while now and love it, it's been an amazing tool for working with dialyzer!

Now, my team is interested in using type_check to add stricter typing to our project. A hurdle we're running into is that all schemas have their types defined with typed_schema, and so cannot easily substitute @type declarations with @type!.

Is this an option worth adding here? I'm happy to work towards a contribution if so.

@bamorim
Copy link
Owner

bamorim commented Jul 15, 2022

Hello @jtormey, thanks for the idea!

In fact, I talked a little bit about this same idea with @Qqwy at Elixir Conf EU this year as this is something I was also interested in checking out. The only reason I haven't put too much work in that was because I didn't had time to test TypeCheck in depth.
My only other concern was introducing another dependency, so I was in doubt of whether this should be an option, a completely different library or just "mandatory".

What I'd do would be to try out in this library and see what we can do.

As far as implementation goes, I am not sure using @type! would be the best idea, maybe we can convert to the TypeCheck internal representation directly, but I haven't checked the idea that deeply to evaluate which approach would be the best.

In the meantime, what are your thoughts on that @dvic?

@bamorim
Copy link
Owner

bamorim commented Jul 15, 2022

Actually, I changed my mind, we are probably better off just using the @type! macro as we also allow types to be overriden with ::, so this would work with that out of the box.

@dvic
Copy link
Collaborator

dvic commented Jul 16, 2022

I have also played around with TypeCheck and the library has made great progress since the last time I checked it out. We do plan to use it in some projects so I'm 👍 for the idea. I think using the @type! macro is a good idea.

@dvic
Copy link
Collaborator

dvic commented Jul 16, 2022

We can make it an optional dependency and using a config option to switch between @type and @type!.

@bamorim bamorim linked a pull request Jul 19, 2022 that will close this issue
@bamorim
Copy link
Owner

bamorim commented Jul 19, 2022

@jtormey opened a PR to start working on that.

@jtormey
Copy link
Author

jtormey commented Jul 19, 2022

Amazing! That was fast 😄

@bamorim
Copy link
Owner

bamorim commented Jan 12, 2023

Hey, sorry for being away for a long time. I've been struggling with some aspects of my life in the past few months. I hope that I can come back and contribute again. I'll let you know when I can finally do something for this.

@Qqwy
Copy link

Qqwy commented Jan 16, 2023

No worries! Life has been hard for many people. I've been struggling with physical health issues myself the past months.

Thank you very much for the heads-up. Take your time, and I wish you all the strength in the world 🫂 !

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

Successfully merging a pull request may close this issue.

4 participants