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
oats generates a ts-ignore to the source file when the schema has object type with additionalFields: A where A is not any or unknown. This is because we use a phantom object property to brand types. The ts-ignore pragma circumvents typescript error about the field used for branding not matching the type of the string indexed field.
Sadly typescript does not keep the ts-ignore pragmas in the d.ts file it generates so the same type error happens when trying to use the generated code as a library. See microsoft/TypeScript#38628
The workaround to this is to postprocess the d.ts file and add the ignore back there. The index key name is always the same so finding it from the d.ts file should be easy.
If this becomes a major issue we could export some helpers to deal with this.
The text was updated successfully, but these errors were encountered:
oats generates a ts-ignore to the source file when the schema has object type with
additionalFields: A
whereA
is notany
orunknown
. This is because we use a phantom object property to brand types. The ts-ignore pragma circumvents typescript error about the field used for branding not matching the type of the string indexed field.Sadly typescript does not keep the ts-ignore pragmas in the d.ts file it generates so the same type error happens when trying to use the generated code as a library. See microsoft/TypeScript#38628
The workaround to this is to postprocess the d.ts file and add the ignore back there. The index key name is always the same so finding it from the d.ts file should be easy.
If this becomes a major issue we could export some helpers to deal with this.
The text was updated successfully, but these errors were encountered: