Add type check - #80
Conversation
| type AllOf = { allOf: Schema[] } & Meta | ||
| type MultiSchema = AnyOf | AllOf | ||
|
|
||
| export type Schema = (SingleSchema | MultiSchema) |
| @@ -1170,7 +1174,7 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot | |||
| .map(entryToProperty({ path: prefix, typeRefChain: [] })); | |||
There was a problem hiding this comment.
Would it be worthwhile to type entryToProperty return value? This would make the change in l. 1177 obsolete.
| * Add parameter for query option $skip | ||
| * @param {Array} parameters Array of parameters to augment | ||
| * @param {string} target Target container child of path | ||
| * @param {Record<string, boolean>} target Target container child of path FIXME: this seems to be an incorrect use of TargetRestrictions |
There was a problem hiding this comment.
target not explicitly typed including null, as is the case in l. 1252…
There was a problem hiding this comment.
I believe target should have the same type as in all other instances where it is declared as parameter. But the usage within the function implies a different type. I highly suspect that this is actually a bug in the implementation (see the FIXME behind the type), but I did not want to introduce behavioural changes in this PR.
| checkForExtentionEnums(extensionObj, extensionEnums); | ||
|
|
||
| let extenstionSchema = { | ||
| let extenstionSchema = { |
There was a problem hiding this comment.
Not a regression in this PR, but rename to extensionSchema + the function above (checkForExtentionEnums)
There was a problem hiding this comment.
Woops, good catch, renamed to eggstensioné.
Introducing strict types and a strict checking mechanism is a first step towards facilitating a better understanding, cleaning up the current file structure, and enabling subsequent refactoring efforts.
This PR's scope is to introduce a consistent checking mechanism, make types slightly stricter where easy wins can be achieved, but leave the current structure untouched as much as possible.
Making the types as strict as possible will be done in a follow-up PR.