Comments (4)
Do we still want this @patrick91? Personally I'm fine with AsyncGenerator[str, None]
since I see it a lot in code using asyncio. But adding a type alias is still an option of course :)
(sorry for digging this up, I'm trying to get our issue count under control :D )
from strawberry.
I think an alias would be nice to have, at least until we get optional type params :D
from strawberry.
@jaydenwindle yes, that's a very good point, I don't like that too, not sure what our best options are.
The reason why I was using typing.AsyncGenerator
is because MyPy was complaining :D
I'd say I like your last suggestion, but maybe it should look like this:
@strawberry.subscription
async def time(self, info) -> strawberry.SubscriptionResult[str]:
...
so it looks more like a python typing type ;)
We should maybe also have a look at MyPy plugins, like the one for dataclasses: https://github.com/python/mypy/blob/master/mypy/plugins/dataclasses.py
from strawberry.
I like that option too!
I'll have to look a little deeper into how MyPy does its magic, but I think if we define strawberry.SubscriptionResult
as a custom type that's just a wrapper around typing.AsyncGenerator
it should keep MyPy from complaining.
from strawberry.
Related Issues (20)
- Upgrade causes "no current event loop in thread" exception HOT 1
- Opentelemetry creating one span per object HOT 1
- Mypy crashes if pydantic model and strawberry model has different fields HOT 1
- Ability to disable auto-camelcasing per field HOT 3
- `strawberry.Parent` not supporting forward refs HOT 1
- Debug server returns "ERR_INVALID_HTTP_RESPONSE" HOT 1
- Descriptions don't work with pydantic decorators HOT 2
- `Annotated` + `strawberry.lazy` + deferred annotations results in `UnresolvedFieldTypeError: Could not resolve the type of ...` errors HOT 2
- `field: None = strawberry.field()` results in `UnresolvedFieldTypeError: Could not resolve the type of ...` error HOT 1
- Changelog on PYPI redirect to error HOT 2
- `UnallowedReturnTypeForUnion` Error thrown when having a response of Union Type and using Generics since 0.229.0 release HOT 2
- Support explicit setting of federation version HOT 3
- Subgraph: "'NoneType' object has no attribute '...'" HOT 4
- oneOf is not properly exported to graphql-core library HOT 1
- Operation directives (seemingly) always erroring HOT 5
- Allow create interfaces without fields. HOT 2
- Functionality for filtering events in Subscriptions HOT 1
- Subscriptions fail to create WebSocket connections
- default_factory doesn't work HOT 11
- Wrong info type passed to resolve_reference classmethod
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strawberry.