Repository navigation
Closed
Description
🐞 bug report
Affected Package
@angular/material
@angular/flex-layout
Is this a regression?
Yes - works prior to building with Ivy.
Description
Building with Ivy causes .d.ts files to be modified. As part of those modifications, the following line is added:`static ngBaseDef: ɵngcc0.ɵɵBaseDef;`
This causes the build to fail. Switching 'enableIvy' back to false still results in a broken build due to the .d.ts file modifications (although the 'WARNING' lines disappear).
🔬 Minimal Reproduction
https://github.com/kccsf/IvyIssue
🔥 Exception or Error
WARNING in Unknown member type: "[key: string]: (data: any) => void;
WARNING in Unknown member type: "[key: string]: (data: any) => void;
WARNING in Unknown member type: "[key: string]: (data: any) => void;
ERROR in node_modules/@angular/flex-layout/extended/typings/class/class.d.ts(30,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/extended/typings/img-src/img-src.d.ts(38,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/flex/typings/flex/flex.d.ts(50,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/align-columns/align-columns.d.ts(28,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/align-rows/align-rows.d.ts(28,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/areas/areas.d.ts(31,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/auto/auto.d.ts(31,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/columns/columns.d.ts(32,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/gap/gap.d.ts(31,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/flex-layout/grid/typings/rows/rows.d.ts(32,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
node_modules/@angular/material/menu/typings/menu.d.ts(161,23): error TS2314: Generic type 'ɵɵBaseDef' requires 1 type argument(s).
🌍 Your Environment
Angular Version:
Angular CLI: 8.1.0-beta.2
Node: 10.15.3
OS: win32 x64
Angular: 8.1.0-next.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.0-beta.2
@angular-devkit/build-angular 0.801.0-beta.2
@angular-devkit/build-optimizer 0.801.0-beta.2
@angular-devkit/build-webpack 0.801.0-beta.2
@angular-devkit/core 8.1.0-beta.2
@angular-devkit/schematics 8.1.0-beta.2
@angular/cdk 8.0.0
@angular/cli 8.1.0-beta.2
@angular/flex-layout 8.0.0-beta.26
@angular/material 8.0.1
@ngtools/webpack 8.1.0-beta.2
@schematics/angular 8.1.0-beta.2
@schematics/update 0.801.0-beta.2
rxjs 6.3.3
typescript 3.4.5
webpack 4.34.0
Anything else relevant?
Reacted by Dominik, fridoo, Daniel Dorantes, Roberto Simonetti, Fredrik Nilsson, Minchul Joh, Richard Sengers, Sergiy Morenets, Adam, JA and 31 more
Activity
magnattic commentedon Jun 20, 2019
This seems to happen when a Directive inherits from another class (that doesn't have any metadata).
I have the same problem when I compile my library that uses angular-l10n:
robisim74/angular-l10n#253
The base class that causes the problem is this one:
https://github.com/robisim74/angular-l10n/blob/master/src/models/base-directive.ts
magnattic commentedon Jun 20, 2019
Apparently this is a regression in 8.1.0, it works fine with 8.0.0 and enableIvy: true.
See the discussion on robisim74/angular-l10n#253
29 remaining items
willkara commentedon Jul 30, 2019
Looks like this is still broken by default when running
ng new Appand then enabling Ivy.I wasn't able to fix it by making the cli/compiler version changes.
tsconfig.json
tsconfig.app.json
Gives me the error:
An unhandled exception occurred: Object prototype may only be an Object or null: undefinedIs there an ETA on when it'll be fixed on a stable version?
mahdiprog commentedon Aug 26, 2019
same here
benelliott commentedon Sep 26, 2019
@petebacondarwin I'm still seeing this bug on 9.0.0-next.8, with type errors springing up for .d.ts entries for abstract superclasses (without metadata) for concrete components. Would you like me to try to create a reproduction or are you aware of the issue?
JoostK commentedon Sep 26, 2019
@benelliott we are aware of that issue, it's a slight variation of the one reported here. A compilation error occurs for base classes without
@Directive()decorator that require generic type arguments themselves.You can probably workaround that issue by adding the
@Directive()decorator to the base class, which ensures that anngDirectiveDefis produced instead of thengBaseDef; the former does not suffer from the same bug.benelliott commentedon Sep 26, 2019
@JoostK Thanks - is there a separate issue I can follow for that one?
The typedefs are coming from an internal library - AFAIK selectorless directives are only supported on v9+ so I couldn't add that to my library without breaking compat for v8 right?
JoostK commentedon Sep 26, 2019
@benelliott There's no github issue at the moment. The plan is to get rid of
ngBaseDefaltogether, so no effort has been put into fixing this issue. Feel free to open an issue for tracking purposes, if you like.Your point regarding backwards compatibility is a valid concern for which I don't know the answer. I suspect it may indeed break, as you're afraid of.
As an alternative, you could insert a default type for the generic type parameter:
becomes
This is not ideal and should just be considered as a temporary workaround.
benelliott commentedon Sep 27, 2019
@JoostK Thanks. I think this won't work in my case as the generic is bounded by an
extends, ie I can't doBaseComp<T extends U = unknown>.benelliott commentedon Oct 3, 2019
For anyone else who has the same issue as me - I worked around it by adding a Directive with a dummy selector (not empty, but something that obviously shouldn't be used) to my abstract classes and then declaring them in my modules, inspired by this commit in
@angular/components:angular/components@8c98013
xboysms commentedon Oct 21, 2019
ok, please undo package-lock.json file
then npm install
should work, it is working fine for me
abadakhshan commentedon Oct 24, 2019
I still have this problem
gkalpak commentedon Oct 24, 2019
These errors will likely be fixed by #33264.
abadakhshan commentedon Oct 28, 2019
Thank you @gkalpak
It was fixed by "9.0.0-next.14"
add default type to OwlDateTime<T>
angular-automatic-lock-bot commentedon Nov 28, 2019
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.