-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
TypeScript error when using UpdateData<T>
with composite interfaces referencing other interfaces
#8656
Comments
UpdateData<T>
with composite interfaces referencing other interfaces
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hi @BenJackGill, This seems to be a general syntax error outside the bounds of Firestore. Taking Firestore out of it, this also fails to compile with TypeScript:
However, these three options don't throw compliation errors:
Hope this helps! |
The In your first example, I would expect a failure because the The issue I have is unrelated to that. It arises when interfaces reference each other; this composite structure seems to break the intended functionality of |
@BenJackGill, thanks for the detailed report. At this point, it's unclear if/when we will be able to change this behavior. In the meantime, if you can define
Let me know if that workaround works for you. Thanks. |
Note to Firestore devs: this may be addressed by modifying the conditional types from |
Operating System
macOS Sequoia 15.1.1
Environment (if applicable)
node
Firebase SDK Version
11.0.2
Firebase SDK Product(s)
Firestore
Project Tooling
Vue 3 with Vite
Detailed Problem Description
TypeScript throws an error when we use
UpdateData<T>
andT
is an interface that is a combination of other interfaces.This example works because we only have a single
User
interface. It works because theUser
interface does not reference any other interfaces:This example does not work because we have multiple interfaces that reference each other. Here the
User
interface is referencing theEmotions
interface, causing the error to show:This is the TypeScript error we see:
Since types are often built as a composite of other types, it would be good to fix this.
Steps and code to reproduce issue
Use the code snippets above to see the errors.
The text was updated successfully, but these errors were encountered: