strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Allow using tuple (and/or iterable) as an alias to the GraphQL type

Open dogweather opened this issue 1 year ago • 0 comments

Feature Request Type

Alteration (enhancement/optimization) of existing feature(s)

Description

Returning a tuple when the attribute is hinted as list works.

But hinting the return type correctly as a tuple causes an error:

@strawberry.type
class Dictionary:
    entries: tuple[Entry]
    sources: tuple[Source]
TypeError: Unexpected type tuple[Entry]

Our code uses tuples and iterables whenever appropriate for robustness, efficiency, and documentation. We also use strict type hinting. It'd be great for these read-only sequences to be explicitly supported.

dogweather avatar Jul 21 '22 17:07 dogweather