I updated lib project from 11 to 12 angular version. Updated storybook from 6.1 to 6.4. Build builds well, without errors. Storybook compiles as well, BUT... I received strange errors.
Error: compareWith must be a function
TypeError: this.onChange is not a function
But in component class it is declared.
onChange = (value: any) => {};
The same with compareWith
, it declares as @Input() compareWith: (o1: T, o2: T) => boolean = ((o1: T, o2: T) => o1 === o2);
It worked good with 11 angular and 6.1 storybook. I started debugging and found this (I logged component context)
clearable: true
compareWith: "((o1: T, o2: T) => o1 === o2)"
disabled: false
id: "select"
labelParamName: "name"
lastScrollTop: NaN
list: (13) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
matSelect: MatSelect {_elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: null, ngControl: NgModel, …}
multiple: true
ngModelControl: undefined
onChange: "() => {...}"
onTouched: "() => {...}"
It casts functions to string
I tried to find similar questions, but I didn't find. Tried to update angular and storybook from the beginning, but nothing. I followed link: Angular update Storybook update Storybook migration