I was just building primeng component wrappers for my application. When I wrapped p-calendar I forwarded inputs from my components to p-calendar components, like so:
Code: Select all
<p-calendar [placeholder]="placeholder"
[selectionMode]="selectionMode"
[timeOnly]="timeOnly"
... etc ...
[showTime]="showTime"
[hourFormat]="hourFormat"
(onSelect)="onValueSelected($event)"></p-calendar>
So, by not adding redundant inputs in my component,
Code: Select all
<my-calendar placeholder="'placeholder'"></my-calendar>
What happens is that calendar will not work properly and no error will be thrown.
Same happens for
Code: Select all
[selectionMode]="'someKindOfTypo'"
I can see developers wasting time for a single typo which can easily be errored:
Code: Select all
private _selectionMode: string;
@Input() get selectionMode(): string {
return this._selectionMode;
}
set selectionMode(_selectionMode: string) {
if (!["single", "multiple", "range"].includes(_selectionMode)) { // perhaps add an enum or list on top of the file
throw "Invalid selection mode";
}
this._selectionMode = _selectionMode;
}
Thanks for the answer!