-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Currently, in order to use serializer classes imported from flagsmith-common
in strictly typed codebases, we have to use type: ignore
or cast
created/updated instances to target model types.
We should look into the following:
- Add a
TypeVar
toSerializerWithMetadata
so subclasses can be annotated as e.g.class FeatureSerializerWithMetadata(SerializerWithMetadata[Feature], CreateFeatureSerializer
in the consuming code. - In
common.types
module, try to import the Core API models underif TYPE_CHECKING
, and only use type aliases tomodel.Model
if they are not available.
emyller and Zaimwa9