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

Type-casting methods should return the exact type #367

Open
senese opened this issue Nov 13, 2024 · 1 comment · May be fixed by #371
Open

Type-casting methods should return the exact type #367

senese opened this issue Nov 13, 2024 · 1 comment · May be fixed by #371

Comments

@senese
Copy link
Contributor

senese commented Nov 13, 2024

Using environs I noticed that type-casting methods they don't return the type casted, only Unknown,

image

If the intention is to cast the environment variable to the correct type it should let your IDE know that it is indeed that type being returned. Environs should leverage marshmallow to return the exact type that is being casted. Type checkers like mypy would benefit from this behavior as well.

One more thing is that type-casting methods are not exactly methods and are being treated as variables although the syntax used is like calling functions. Maybe this should be reviewed in the next version?

@sloria
Copy link
Owner

sloria commented Nov 14, 2024

I agree that this would be a nice improvement. Would certainly appreciate a PR (even if just a POC) for this

OkeyDev added a commit to OkeyDev/environs that referenced this issue Nov 24, 2024
OkeyDev added a commit to OkeyDev/environs that referenced this issue Nov 24, 2024
@OkeyDev OkeyDev linked a pull request Nov 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants