Ng-zorro-antd: Upgrading to V9 gives: "Class extends value undefined is not a constructor or null"

Created on 4 May 2020  ·  4Comments  ·  Source: NG-ZORRO/ng-zorro-antd

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-start-wen6uj

Steps to reproduce

ng update ng-zorro-antd

What is expected?

The upgrade to finish successfully

What is actually happening?

Receiving this error instead: "An unhandled exception occurred: Class extends value undefined is not a constructor or null".

| Environment | Info |
|---|---|
| ng-zorro-antd | 9.1.0 |
| Browser | CLI |


I saw people saying that it might be due to circular dependencies but the app is working fine.

These are the logs for the error:

[error] TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\Users\<user name>\Desktop\Work\<project name>\node_modules\ng-zorro-antd\schematics\ng-update\upgrade-rules\checks\calendar-input-rule.js:4:49)

These are the contents of the calendar-input-rule.js file:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular/cdk/schematics");
class CalendarTemplateRule extends schematics_1.MigrationRule {
    constructor() {
        super(...arguments);
        this.ruleEnabled = this.targetVersion === schematics_1.TargetVersion.V9;
    }
    visitTemplate(template) {
        schematics_1.findInputsOnElementWithTag(template.content, 'nzCard', ['nz-calendar'])
            .forEach(offset => {
            this.failures.push({
                filePath: template.filePath,
                position: template.getCharacterAndLineOfPosition(offset),
                message: `Found deprecated input "nzCard" component. Use "nzFullscreen" to instead please.`
            });
        });
    }
}
exports.CalendarTemplateRule = CalendarTemplateRule;
//# sourceMappingURL=calendar-input-rule.js.map

I also tried to upgrade an empty Angular 8 app with NG-Zorro 8 to version 9 and I get the same error. One of my colleagues tried to upgrade too, but he got the same error.

Question ⚙️ Schematics

All 4 comments

Hello,
I seem to have the same issue. Any updates or can a workaround be provided?

Thank you

@Drackos @IonelLupu

$ npm i @angular/[email protected] --save

Try downgrade @angular/cdk to 9.2.1 until [email protected] released.

Thank you @hsuanxyz for the workaround. It works for now 😄

I will reopen it so others can find it.

Was this page helpful?
0 / 5 - 0 ratings