-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Export ɵNgNoValidate from @angular/forms, since it is used by the ng-linker/ivy #41277
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/forms.
Is this a regression?
No.
Description
@angular/forms v11.2.5
declare class ɵNgNoValidate {
static ɵfac: ɵngcc0.ɵɵFactoryDef<ɵNgNoValidate, never>;
static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta<ɵNgNoValidate, "form:not([ngNoForm]):not([ngNativeValidate])", never, {}, {}, never>;
}
export { ɵNgNoValidate }
export { ɵNgNoValidate as ɵangular_packages_forms_forms_y }@angular/forms v11.2.6
export declare const ɵangular_packages_forms_forms_y: StaticProvider;
declare class ɵNgNoValidate {
static ɵfac: ɵngcc0.ɵɵFactoryDef<ɵNgNoValidate, never>;
static ɵdir: ɵngcc0.ɵɵDirectiveDefWithMeta<ɵNgNoValidate, "form:not([ngNoForm]):not([ngNativeValidate])", never, {}, {}, never>;
}
export { ɵNgNoValidate }
export { ɵNgNoValidate as ɵangular_packages_forms_forms_ba }External library compiled with "compilationMode": "partial"
import * as i0 from '@angular/core';
import {
NgControlStatus,
ɵangular_packages_forms_forms_y,
NgControlStatusGroup,
FormGroupDirective,
FormGroupName,
} from '@angular/forms';
MeetingListComponent.ɵfac = function MeetingListComponent_Factory(t) { return new (t || MeetingListComponent)();};
MeetingListComponent.ɵcmp = ɵɵngDeclareComponent({
version: '11.2.5',
type: BarComponent
selector: 'ng-component',
viewQueries: [],
usesInheritance: true,
ngImport: i0,
template: ' <form [formGroup]="testFormGroup"></form>',
styles: [],
directives: [
{ type: NgControlStatus, selector: '[formControlName],[ngModel],[formControl]' },
{
type: FormControlDirective,
selector: '[formControl]',
inputs: ['disabled', 'formControl', 'ngModel'],
outputs: ['ngModelChange'],
exportAs: ['ngForm'],
},
{ type: ɵangular_packages_forms_forms_y, selector: 'form:not([ngNoForm]):not([ngNativeValidate])' },
{
type: NgControlStatusGroup,
selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]',
},
{
type: FormGroupDirective,
selector: '[formGroup]',
inputs: ['formGroup'],
outputs: ['ngSubmit'],
exportAs: ['ngForm'],
},
{ type: FormGroupName, selector: '[formGroupName]', inputs: ['formGroupName'] },
],
pipes: { async: AsyncPipe },
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
});If i use my external library with @angular v11.2.5 everything works fine, but as soon as i switch to @angular v11.2.6, angular throws an exception at runtime Error: 'undefined' is neither 'ComponentType' or 'DirectiveType' .
I have done some debugging and the ɵangular_packages_forms_forms_y import resolves to export declare const ɵangular_packages_forms_forms_y: StaticProvider; in the new version, which is not the correct directive.
🔬 Minimal Reproduction
Compile a library which contains a @Component with a form in its template, using the new partial compiler mode in an enviroment with @angular v11.2.5.
Then use the library in an enviroment with @angular v11.2.6.
🔥 Exception or Error
core.js:6162 ERROR Error: Uncaught (in promise): Error: 'undefined' is neither 'ComponentType' or 'DirectiveType'.
Error: 'undefined' is neither 'ComponentType' or 'DirectiveType'.
at extractDirectiveDef (core.js:956)
at Array.map ()
at def.directiveDefs (core.js:931)
at createTView (core.js:9665)
at getOrCreateTComponentView (core.js:9613)
at createRootComponentView (core.js:12378)
at ComponentFactory$1.create (core.js:25004)
at ViewContainerRef.createComponent (core.js:23078)
at RouterOutlet.activateWith (router.js:5306)
at ActivateRoutes.activateRoutes (router.js:2129)
at resolvePromise (zone-evergreen.js:798)
at resolvePromise (zone-evergreen.js:750)
at zone-evergreen.js:860
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:28497)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at drainMicroTaskQueue (zone-evergreen.js:569)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:484)
at invokeTask (zone-evergreen.js:1621)
🌍 Your Environment
Angular Version:
"@angular-devkit/build-angular": "~0.1102.5",
"@angular/animations": "^11.2.6",
"@angular/cli": "^11.2.5",
"@angular/cdk": "^11.2.5",
"@angular/cdk-experimental": "^11.2.5",
"@angular/common": "^11.2.6",
"@angular/compiler": "^11.2.6",
"@angular/compiler-cli": "^11.2.6",
"@angular/core": "^11.2.6",
"@angular/forms": "^11.2.6",
"@angular/material": "^11.2.5",
"@angular/material-moment-adapter": "^11.2.5",
"@angular/platform-browser": "^11.2.6",
"@angular/platform-browser-dynamic": "^11.2.6",
"@angular/router": "^11.2.6",