Closed aleksandar-kandzhichki closed 4 years ago
Actually it shouldn't be undefined. The value comes from here: https://github.com/kekeh/angular-mydatepicker/blob/84ec9f07f904e4c7977f9f171eeff5a4dbedf5b0/projects/angular-mydatepicker/src/lib/services/angular-mydatepicker.config.service.ts#L53
The default config values are read here: https://github.com/kekeh/angular-mydatepicker/blob/84ec9f07f904e4c7977f9f171eeff5a4dbedf5b0/projects/angular-mydatepicker/src/lib/angular-mydatepicker.input.ts#L70
Options are passed to calendar component here: https://github.com/kekeh/angular-mydatepicker/blob/84ec9f07f904e4c7977f9f171eeff5a4dbedf5b0/projects/angular-mydatepicker/src/lib/angular-mydatepicker.input.ts#L328
@kekeh I see, but it is still issue with the types - in the type you say it is possibly undefined, so when using it it would guess you might not have it
(this produces error with strictNullChecks: true in TsConfig)
Maybe there should be added an !
to assert TS that it will be there?:
Ok. I will check that soon.
I can give you a stackblitz with reproduction if needed, but basically adding it in the tsconfig should reproduce the error. I forked the project and fixed it there for me, so it is building properly now, but still would be good to be included here :)
Let me know how you fix it?
I personally prefer this approach - where you make sure even if it is undefined, you would add some valid value there.
The other option is what I showed in the picture - add !
after the stylesData
so you assure TS that the property will not be undefined
Looks good. I am happy if you can create a pull request from this change :-)
Fixed in version 0.4.5.
Hello, while building angular project with strict null type checks, I am getting the following error:![image](https://user-images.githubusercontent.com/13217235/75673283-4705e680-5c8b-11ea-9543-ca247d11f04f.png)
Issue comes from here: https://github.com/kekeh/angular-mydatepicker/blob/84ec9f07f904e4c7977f9f171eeff5a4dbedf5b0/projects/angular-mydatepicker/src/lib/components/calendar/calendar.component.html#L2
In the interface for options it says styles are nullable, so in the calendar component there should be check if they exist - or make sure they exist https://github.com/kekeh/angular-mydatepicker/blob/84ec9f07f904e4c7977f9f171eeff5a4dbedf5b0/projects/angular-mydatepicker/src/lib/interfaces/my-options.interface.ts#L57