Closed Eyas closed 2 years ago
Supports Role fully as described in http://blog.schema.org/2014/06/introducing-role.html
Every Property can now be a Role.
This is a pretty risky change, I published schema-dts@0.11.0-beta.1 as an example.
schema-dts@0.11.0-beta.1
Examples of diffs:
-declare type SchemaValue<T> = T | readonly T[]; +declare type SchemaValue<T, TProperty extends string> = T | Role<T, TProperty> | readonly (T | Role<T, TProperty>)[];
-interface RoleLeaf extends RoleBase { - "@type": "Role"; -} -export declare type Role = RoleLeaf | LinkRole | OrganizationRole | PerformanceRole; +declare type RoleLeaf<TContent, TProperty extends string> = RoleBase & { + "@type": "Role"; +} & { + [key in TProperty]: TContent; +}; +export declare type Role<TContent = never, TProperty extends string = never> = RoleLeaf<TContent, TProperty> | LinkRole<TContent, TProperty> | OrganizationRole<TContent, TProperty> | PerformanceRole<TContent, TProperty>;
interface PersonBase extends ThingBase { - "worksFor"?: SchemaValue<Organization | IdReference>; + "worksFor"?: SchemaValue<Organization | IdReference, "worksFor">; }
For schema-dts-gen, this change only becomes visible once a Role property is present. I might end up regretting this.
Role
Fixes #143
Supports Role fully as described in http://blog.schema.org/2014/06/introducing-role.html
Every Property can now be a Role.
This is a pretty risky change, I published
schema-dts@0.11.0-beta.1
as an example.Examples of diffs:
For schema-dts-gen, this change only becomes visible once a
Role
property is present. I might end up regretting this.Fixes #143