google / schema-dts

JSON-LD TypeScript types for Schema.org vocabulary
Apache License 2.0
889 stars 33 forks source link

sameAs as an array #185

Open retroriff opened 2 years ago

retroriff commented 2 years ago

I see that sameAs is a string attribute and I was wondering if it also should be a string[] so it can accept a list of social networks, as explained here.

{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Company Name",
  "url": "company.com",
  "logo": "company.com/logo.png",
  "sameAs": [
    "https://facebook.com/",
    "https://twitter.com/",
  ]
}
Eyas commented 2 years ago

Yep, all attributes (other than "@context", "@type", and "@id") can be either their direct type or an array as-is. Let me know if you're having trouble using it as such!

mirhamasala commented 7 months ago

@Eyas I'm having a some trouble using string[] for sameAs

Type 'string[]' is not assignable to type 'string | Role<string, "sameAs">'.ts(2322)

Any insight? 🙏🏼