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
The Clockodo SDK has been previously designed in a way to allow additional parameters that haven't been typed yet. E.g. imagine there is a new parameter we haven't added to the function type yet:
clockodo.getUser({newParam: true});
In TypeScript, this would show an error because of the "excess property check". We extend all params with Record<string, unknown> to allow new, untyped params.
As a downside, this also makes it possible to missspell properties and TypeScript will allow it:
clockodo.getUser({// TS allows this because it thinks it's a new paramoldButMisspelledParam: true});
I think, we should remove & Record<string, unknown> thus making the type check more strict. As a downside, the SDK will now show an error if a new, untyped param is used. However, I think this can be easily fixed:
clockodo.getUser({// New, untyped param. Remove this once it got added to the SDK// @ts-expect-errornewParam: true});
This way, it will show a TypeScript error as soon as the type is added and the ts-expect-error is not necessary anymore. With us working more actively on the SDK, I think we should try to get the complete API typed and up-to-date.
The Clockodo SDK has been previously designed in a way to allow additional parameters that haven't been typed yet. E.g. imagine there is a new parameter we haven't added to the function type yet:
In TypeScript, this would show an error because of the "excess property check". We extend all params with
Record<string, unknown>
to allow new, untyped params.As a downside, this also makes it possible to missspell properties and TypeScript will allow it:
I think, we should remove
& Record<string, unknown>
thus making the type check more strict. As a downside, the SDK will now show an error if a new, untyped param is used. However, I think this can be easily fixed:This way, it will show a TypeScript error as soon as the type is added and the
ts-expect-error
is not necessary anymore. With us working more actively on the SDK, I think we should try to get the complete API typed and up-to-date.What do you think @mrclickbits @anki247 @dsumer ?
The text was updated successfully, but these errors were encountered: