-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong type for M2M relations? #21
Comments
Oh you are right. The type returned by the directus API doesn't seem to match the type used by the SDK in this case. Since we still have to cover the case that the Directus SDK just returns the item IDs instead of the actual relational items, would export type Scene = {
audioScene: any[] & SceneAudioScene[]; |
On a second look the Directus API doesn't even return something wrong, I just use "string" as the default type if no other one is given. |
Since the SDK returns an empty array if there are no relations or nothing if the relation is not requested |
Ok, i see. Your suggestion seems to be the correct one! audioScene?: any[] & SceneAudioScene[]; |
Fixed in eb83e90 |
Thanks for the great extension!
Looks like there is a problem with M2M relations when creating types for TypeScript:
Database
Generated Types
Why does the scene M2M reference
scene
on the TypeAudioScene
have the typestring & SceneAudioScene[];
Seems to be that it never will be a string. Same for the referenceaudioScene
on the typeScene
.The text was updated successfully, but these errors were encountered: