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

fix: add constructors when extending another classes to fix (f)esm2015 build #2339

Closed
wants to merge 1 commit into from

Conversation

CarterLi
Copy link

@CarterLi CarterLi commented Oct 23, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Currently (f)esm2015 build is broken due to base components inheritance. When creating instances of subclasses, Angular fails to resolve their dependencies because auto-generated constructors have no type metadata which are required for DI working correctly.

For example:

image

NzPopoverComponent has no explicit constructor. TypeScript ( or babel? ) generates

constructor() {
  super(...arguments);
  // other class fields inits
}

Angular cannot deduce its dependencies so that angular passes no arguments into it

image

which results in error when opening popovers

image

Issue Number: N/A

What is the new behavior?

don't throw errors

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This change has been discussed with @vthinkxie on DingDing

@codecov
Copy link

codecov bot commented Oct 23, 2018

Codecov Report

Merging #2339 into master will decrease coverage by 0.05%.
The diff coverage is 79.16%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2339      +/-   ##
=========================================
- Coverage   95.86%   95.8%   -0.06%     
=========================================
  Files         485     487       +2     
  Lines       12224   12241      +17     
  Branches     1645    1655      +10     
=========================================
+ Hits        11719   11728       +9     
- Misses        148     153       +5     
- Partials      357     360       +3
Impacted Files Coverage Δ
components/form/nz-form-label.component.ts 100% <100%> (ø) ⬆️
components/radio/nz-radio-button.component.ts 100% <100%> (ø) ⬆️
components/form/nz-form-item.component.ts 100% <100%> (ø) ⬆️
components/form/nz-form-control.component.ts 100% <100%> (ø) ⬆️
...omponents/dropdown/nz-dropdown-button.component.ts 100% <100%> (ø) ⬆️
components/date-picker/year-picker.component.ts 90% <50%> (+1.11%) ⬆️
components/date-picker/month-picker.component.ts 90% <50%> (+1.11%) ⬆️
components/date-picker/range-picker.component.ts 90% <66.66%> (+2.5%) ⬆️
components/date-picker/week-picker.component.ts 80% <66.66%> (+5%) ⬆️
components/date-picker/date-picker.component.ts 90% <66.66%> (+2.5%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af7d472...5792058. Read the comment docs.

@CarterLi
Copy link
Author

Any chance to merge? I'm facing more problems using nz-datepicker, it's completely unusable

@vthinkxie
Copy link
Member

@CarterLi you have to pass all ci before we start reviewing your code.

@CarterLi
Copy link
Author

CarterLi commented Oct 24, 2018

@vthinkxie I'm surprised that adding some constructors can affects that much ( it's strange that adding constructor in nz-dropdown-button can affect tests in nz-autocomplete ). But I've reverted all changes that break CI. Only date-xxx-components left 😸

@CarterLi
Copy link
Author

CarterLi commented Oct 24, 2018

Ok I completely have no idea why CI is still broken. I give up.

Although I think my change is safe to merge. If it's unacceptable, I'll close my pr. But I still hope that you can fix it in next small release. It's important to us.

@vthinkxie
Copy link
Member

@CarterLi plz track #2357
I will take it over

@vthinkxie vthinkxie closed this Oct 25, 2018
vthinkxie added a commit that referenced this pull request Oct 26, 2018
* fix(module:esm5): fix esm5 package
close #2339

* refactor(module:all): refactor all constructor

* fix(module:esm5): fix esm5 error
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this pull request Aug 5, 2020
* fix(module:esm5): fix esm5 package
close NG-ZORRO#2339

* refactor(module:all): refactor all constructor

* fix(module:esm5): fix esm5 error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants