-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support for Multi-Typed Entities #179
Comments
As someone that uses "WebSite" for the main type but still want access to types from LocalBusiness such as "telephone" and "email", this is MUCH needed for me. Thank you. |
Quick question: How would you expect this to operate, e.g., if you have: const businessSite: MultiTyped<[WebSite, LocalBusiness]> = {
// ...
}; would you expect that
|
Hm, I never actually thought of that. I personally use |
@Eyas Without getting into too much details, as user, between both I expect the 2nd option. Tuple on generics, same on array and subtypes |
Jumping in to say I'd also love to see support for this. https://json-ld.org/spec/latest/json-ld/#example-14-specifying-multiple-types-for-a-node |
Hey @JacobGrady -- In your use cases, would combining the two "leaf" types be acceptable? i.e. the examples give "Restaurant + Brewery" and then uses them as such. Is there ever a case where you might havea "super-type" in your multi-typed entity? Eg.
The reason I asked is that the second is pretty hard and I haven't figured out a way to support that yet. |
Thanks for the fast reply @Eyas!
In this example it's "author" and "brand", but there are other properties like those. It's entirely possible we are doing this wrong/there is a better way to achieve the same thing. Here's the above passing the rich results test. I did just notice on those Google docs: Google doesn't show a rich result for Software Apps that only have the [VideoGame] type. To make sure that your Software App is eligible for display as a rich result, co-type the [VideoGame] type with another type. For example:
So at least in that example, Google is requiring a second more specific type? |
I'm not sure... I think the SEO folks might have a better answer and reaching out to their support forums directly might be your best bet.
Yep, I totally agree. But what I'm wondering is what kind of support to sub-types you need. E.g. if you had a function that expected (Product, Book), are you okay if it only accepted Product and Book types, and not their sub-types? |
100% totally okay with that, I think it's preferred tbh. We would probably want to add the relevant sub-types into that @type array if we had any. |
Not sure if helpful, but here's another example from those Google docs: |
Hi! I don't know if I missed something, but it appears not to support Multi-Typed Entities. Is it some typescript limitation?
Thanks in advance!
The text was updated successfully, but these errors were encountered: