Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict null checks with datepicker NgbDateStruct #1544

Closed
AlexKhymenko opened this issue May 8, 2017 · 3 comments · Fixed by jhipster/generator-jhipster#10901
Closed

Strict null checks with datepicker NgbDateStruct #1544

AlexKhymenko opened this issue May 8, 2017 · 3 comments · Fixed by jhipster/generator-jhipster#10901
Milestone

Comments

@AlexKhymenko
Copy link

Please remember, the issues forum is NOT for support requests. It is for bugs and feature requests only.
Please read https://github.com/ng-bootstrap/ng-bootstrap/blob/master/CONTRIBUTING.md and search
existing issues (both open and closed) prior to opening any new issue and ensure you follow the instructions therein.

Bug description:

Uncompatible with typescript strict null checks Support. The parse method should return null or NgbDateStruct. Right now return only NgbDateStruct.

Link to minimally-working plunker that reproduces the issue:

You can fork a plunker from one of our demos and use it as a starting point.
Please note that we can not act on bug reports without a minimal reproduction scenario in plunker. Here is why:
https://github.com/ng-bootstrap/ng-bootstrap#you-think-youve-found-a-bug

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 4

ng-bootstrap:

Bootstrap:

@AlexKhymenko
Copy link
Author

AlexKhymenko commented May 8, 2017

For someone who has this issue but want to use strict null checks the workaround is to add any before null

    if (!value) {
        return <any>null;
    }
    return d.isValid() ? { year: d.year(),
            month: d.month() + 1,
            day: d.date() } : <any>null; 

Not beautiful but works :-)

@pkozlowski-opensource
Copy link
Member

Yeh, we should review this project for the proper strict null checks...

@wesleycho
Copy link
Member

So I took a stab at trying to implement proper strict null checks...this is not an easy task. This pollutes a lot of areas, and needs a lot of love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants