You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Staying in line with using type safety, it would be great if typing support was built into the library by default for the type definition keys. Take a look at the following:
typeDefinitionType<T>={[KinkeyofT]: IField;};interfaceTypedIntermediateTypeOptions<T>extendsIntermediateTypeOptions{readonlydefinition: DefinitionType<T>;}classExtendedInterfaceType<T>extendsInterfaceType{constructor(name: string,options: TypedIntermediateTypeOptions<T>){super(name,options);}}exportinterfaceDataItem{day: number;month: number;source: DataProvider;timestamp: number;year: number;}// will give an error since source is missingexportconstDataItemType=newExtendedInterfaceType<DataItem>("DataItem",{definition: {timestamp: GraphqlType.int(),year: GraphqlType.int(),month: GraphqlType.int(),day: GraphqlType.int(),},});// will not give an error since all properties are implemented exportconstDataItemType=newExtendedInterfaceType<DataItem>("DataItem",{definition: {timestamp: GraphqlType.int(),year: GraphqlType.int(),month: GraphqlType.int(),day: GraphqlType.int(),source: DataProviderEnumType.attribute(),},});
We've made the choice to make the type required on the interface, ensuring consistent typing everywhere, but for this particular library it probably makes more sense to make it optional (will also ensure it isn't a breaking change).
I don't think the implementation would be a heavy lift, and am happy to submit a PR whenever I get a chance, but what do you all think about this functionality? Agree it makes sense to build it into the library?
The text was updated successfully, but these errors were encountered:
Staying in line with using type safety, it would be great if typing support was built into the library by default for the type definition keys. Take a look at the following:
We've made the choice to make the type required on the interface, ensuring consistent typing everywhere, but for this particular library it probably makes more sense to make it optional (will also ensure it isn't a breaking change).
I don't think the implementation would be a heavy lift, and am happy to submit a PR whenever I get a chance, but what do you all think about this functionality? Agree it makes sense to build it into the library?
The text was updated successfully, but these errors were encountered: