Skip to content

Commit

Permalink
Reformat release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 committed Jan 10, 2022
1 parent bfbc422 commit 28f9de2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Release type: patch

Improve typing of `@strawberry.enum()` by:

1. Using a `TypeVar` bound on `EnumMeta` instead of `EnumMeta`, which allows type-checkers (like pyright)
to detect the fields of the enum being decorated. For example, for the following enum:
1. Using a `TypeVar` bound on `EnumMeta` instead of `EnumMeta`, which allows
type-checkers (like pyright) to detect the fields of the enum being
decorated. For example, for the following enum:

```python
@strawberry.enum
Expand All @@ -13,10 +14,11 @@ class IceCreamFlavour(Enum):
CHOCOLATE = "chocolate"
```

Prior to this change, pyright would complain if you tried to access
`IceCreamFlavour.VANILLA`, since the type information of `IceCreamFlavour` was being
erased by the `EnumMeta` typing .
Prior to this change, pyright would complain if you tried to access
`IceCreamFlavour.VANILLA`, since the type information of `IceCreamFlavour` was
being erased by the `EnumMeta` typing .

2. Overloading it so that type-checkers (like pyright) knows in what cases it returns a decorator
(when it's called with keyword arguments, e.g. `@strawberry.enum(name="IceCreamFlavor")`),
versus when it returns the original enum type (without keyword arguments.
2. Overloading it so that type-checkers (like pyright) knows in what cases it
returns a decorator (when it's called with keyword arguments, e.g.
`@strawberry.enum(name="IceCreamFlavor")`), versus when it returns the
original enum type (without keyword arguments.

0 comments on commit 28f9de2

Please sign in to comment.