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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGCC fails with array spread in module declarations #33614

Closed
alan-agius4 opened this issue Nov 6, 2019 · 2 comments
Closed

NGCC fails with array spread in module declarations #33614

alan-agius4 opened this issue Nov 6, 2019 · 2 comments
Milestone

Comments

@alan-agius4
Copy link
Contributor

馃悶 bug report

Affected Package

@angular/compiler-cli

Is this a regression?

Yes, used to work with VE.

Description

When a module declaration contains an array spread example:

const ALL_DIRECTIVES = [
  DefaultShowHideDirective,
  DefaultClassDirective,
];

@NgModule({
  imports: [CoreModule],
  declarations: [...ALL_DIRECTIVES],
  exports: [...ALL_DIRECTIVES]
})
export class ExtendedModule {
}

When compiled down to ES5 TypeScript will add tslib helpers in this case the __spreadArrays.

var ALL_DIRECTIVES = [
    DefaultShowHideDirective,
    DefaultClassDirective
];
var ExtendedModule = /** @class */ (function () {
    function ExtendedModule() {
    }
    ExtendedModule.decorators = [
        { type: NgModule, args: [{
                    imports: [CoreModule],
                    declarations: __spreadArrays(ALL_DIRECTIVES),
                    exports: __spreadArrays(ALL_DIRECTIVES)
                },] },
    ];
    return ExtendedModule;
}());

When NGCC is run on this code it will error out that it expected an array in declarations . previously this used to be allowed in VE.

馃敟 Exception or Error


node_modules/@angular/flex-layout/esm5/extended.es5.js(926,35): error TS-991010: Expected array when reading the NgModule.declarations of ExtendedModule

馃實 Your Environment

Angular Version: 9.0.0-rc.0

Related to angular/flex-layout#1143

@ngbot ngbot bot added this to the needsTriage milestone Nov 6, 2019
@alan-agius4
Copy link
Contributor Author

//cc @petebacondarwin & @CaerusKaru

alan-agius4 added a commit to alan-agius4/flex-layout that referenced this issue Nov 6, 2019
This is causing the consumption of the library to fail.

See: angular/angular#33614
@atscott atscott closed this as completed in d749dd3 Nov 6, 2019
atscott pushed a commit that referenced this issue Nov 6, 2019
We already have special cases for the `__spread` helper function and with this change we handle the new tslib helper introduced in version 1.10 `__spreadArrays`.

For more context see: https://github.com/microsoft/tslib/releases/tag/1.10.0

Fixes: #33614

PR Close #33617
mohaxspb pushed a commit to mohaxspb/angular that referenced this issue Nov 7, 2019
We already have special cases for the `__spread` helper function and with this change we handle the new tslib helper introduced in version 1.10 `__spreadArrays`.

For more context see: https://github.com/microsoft/tslib/releases/tag/1.10.0

Fixes: angular#33614

PR Close angular#33617
mohaxspb pushed a commit to mohaxspb/angular that referenced this issue Nov 7, 2019
We already have special cases for the `__spread` helper function and with this change we handle the new tslib helper introduced in version 1.10 `__spreadArrays`.

For more context see: https://github.com/microsoft/tslib/releases/tag/1.10.0

Fixes: angular#33614

PR Close angular#33617
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant