Repository: strawberry-graphql/strawberry

Issue:
`UnallowedReturnTypeForUnion` Error thrown when having a response of Union Type and using Generics since 0.229.0 release
## Describe the Bug
`UnallowedReturnTypeForUnion` Error thrown when having a response of Union Type and using Generics(with interface) since 0.229.0 release.
Sharing the playground [link](https://play.strawberry.rocks/?gist=a3c87c1b7816a2a3251cdf442b4569e1) showing the error for ease of replication.

This was a feature which was working but seems like it broke with the 0.229.0 release

## System Information

 - Operating system:
 - Strawberry version (if applicable): 0.229.0

## Additional Context

Playground Link : https://play.strawberry.rocks/?gist=a3c87c1b7816a2a3251cdf442b4569e1


<!-- POLAR PLEDGE BADGE START -->
## Upvote & Fund

- We're using [Polar.sh](https://polar.sh/strawberry-graphql) so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.

<a href="https://polar.sh/strawberry-graphql/strawberry/issues/3501">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/strawberry-graphql/strawberry/issues/3501/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/strawberry-graphql/strawberry/issues/3501/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:

Resolving patch:
diff --git a/strawberry/exceptions/__init__.py b/strawberry/exceptions/__init__.py
--- a/strawberry/exceptions/__init__.py
+++ b/strawberry/exceptions/__init__.py
@@ -44,7 +44,6 @@ def __init__(self, field_name: str, result_type: str) -> None:
         super().__init__(message)
 
 
-# TODO: this doesn't seem to be tested
 class UnallowedReturnTypeForUnion(Exception):
     """The return type is not in the list of Union types"""
 
diff --git a/strawberry/types/types.py b/strawberry/types/types.py
--- a/strawberry/types/types.py
+++ b/strawberry/types/types.py
@@ -214,6 +214,11 @@ def is_implemented_by(self, root: Type[WithStrawberryObjectDefinition]) -> bool:
             if hasattr(real_concrete_type, "_enum_definition"):
                 real_concrete_type = real_concrete_type._enum_definition
 
+            if isinstance(expected_concrete_type, type) and issubclass(
+                real_concrete_type, expected_concrete_type
+            ):
+                return True
+
             if real_concrete_type is not expected_concrete_type:
                 return False
 


Test patch:
diff --git a/tests/schema/test_generics.py b/tests/schema/test_generics.py
--- a/tests/schema/test_generics.py
+++ b/tests/schema/test_generics.py
@@ -1173,3 +1173,40 @@ def real(self) -> Abstract:
 
     assert not query_result.errors
     assert query_result.data == {"real": {"__typename": "IntReal", "x": ""}}
+
+
+def test_generic_with_interface():
+    T = TypeVar("T")
+
+    @strawberry.type
+    class Pagination(Generic[T]):
+        items: List[T]
+
+    @strawberry.interface
+    class TestInterface:
+        data: str
+
+    @strawberry.type
+    class Test1(TestInterface):
+        pass
+
+    @strawberry.type
+    class TestError:
+        reason: str
+
+    @strawberry.type
+    class Query:
+        @strawberry.field
+        def hello(
+            self, info: strawberry.Info
+        ) -> Union[Pagination[TestInterface], TestError]:
+            return Pagination(items=[Test1(data="test1")])
+
+    schema = strawberry.Schema(Query, types=[Test1])
+
+    query_result = schema.execute_sync(
+        "{ hello { ... on TestInterfacePagination { items { data }} } }"
+    )
+
+    assert not query_result.errors
+    assert query_result.data == {"hello": {"items": [{"data": "test1"}]}}
diff --git a/tests/schema/test_generics_nested.py b/tests/schema/test_generics_nested.py
--- a/tests/schema/test_generics_nested.py
+++ b/tests/schema/test_generics_nested.py
@@ -259,9 +259,9 @@ def blocks(self) -> List[BlockInterface]:
         }
 
         """
-        The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
+        The `JSON` scalar type represents JSON values as specified by [ECMA-404](https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf).
         """
-        scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
+        scalar JSON @specifiedBy(url: "https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf")
 
         type JsonBlock implements BlockInterface {
           id: ID!