-
Notifications
You must be signed in to change notification settings - Fork 33
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
'@type' as array #189
Comments
Yeah this is also discussed in #179. There are a few issues here. In general, you can construct your own type as a workaround: import {Car, Product} from 'schema-dts';
type CarProduct = Omit<Car & Product, '@type'> & { "@type": ["Car", "Product"] }
const c: CarProduct = {
"@type": ["Car", "Product"],
"name": "abc",
"roofLoad": {"@type": "QuantitativeValue"},
}; The problem with generic support, however, is that it's really easy to multiple |
This doesn't seem to work with |
For anyone else facing the same issue, I've resorted to the following for now:
Seeing as ArtGallery is a sub-class of Organization, I only really use the one specific property with the rest coming from Organization. Also using the |
Was wondering if it would be possible to use the @type in an array.
My use case would be in the context of utilizing two types like this:
'@type': (['Car', 'Product']
currently working around this by casting to one of the types
'@type': (['Car', 'Product'] as unknown as 'Car')
Would be keen to hear if this would be possible?
The text was updated successfully, but these errors were encountered: