-
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
primitive string type disallows picking types from Organization #50
Comments
Yikes, yeah, we should fix that. |
FWIW a fix in client code would be: // Before:
type ImageType = Organization["image"];
// After
type ImageType = (Exclude<Organization, string>)["image"]; |
(Unrelated, but you don't need |
If we have a type like: // From https://stackoverflow.com/a/50375286
type __Flatten<U> =
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never
type AllSchemaProperties = __Flatten<Exclude<Thing, DataType>>;
export type SchemaProperty = keyof AllSchemaProperties;
export type SchemaRange<TProp extends SchemaProperty> = AllSchemaProperties[TProp]; Where AllSchemaProperties is a flattened-out So This would be the ideal solution because RDF is property-centric (and you can't have the same property meaning different things on different object). It's pretty expensive to do though and especially with #34 going on I'm not sure if I should add something like this. But perhaps a simpler: export type PropertyOf<
TSchema,
TProp extends keyof Exclude<TSchema, DataType>> =
Exclude<TSchema, DataType>[TProp]; is still helpful. |
I have built some helper methods to help assemble instances in our common patterns. With the recent introduction of #47, and the fact that none of the
Base
types are exposed (related: #29 (comment)), I no longer have a way to access/reuse the types of the properties withinOrganizationBase
model.With the latest release including #47, I get:
e.g.
for completeness:
How should I be referencing the declared type of something like
Organization['image']
?The text was updated successfully, but these errors were encountered: