fix(core): log error instead of warning for unknown properties and elements (#36399)
Changes the Ivy unknown element/property messages from being logged with `console.warn` to `console.error`. This should make them a bit more visible without breaking existing apps. Furthermore, a lot of folks filter out warning messages in the dev tools' console, whereas errors are usually still shown. BREAKING CHANGE: Warnings about unknown elements are now logged as errors. This won't break your app, but it may trip up tools that expect nothing to be logged via `console.error`. Fixes #35699. PR Close #36399
This commit is contained in:

committed by
Alex Rickabaugh

parent
d9c4840a9c
commit
9d9d46f52b
@ -963,7 +963,7 @@ Did you run and wait for 'resolveComponentResources()'?` :
|
||||
});
|
||||
|
||||
|
||||
modifiedInIvy(`Unknown property error thrown instead of logging a warning`)
|
||||
modifiedInIvy(`Unknown property error thrown instead of logging a message`)
|
||||
.it('should error on unknown bound properties on custom elements by default', () => {
|
||||
@Component({template: '<some-element [someUnknownProp]="true"></some-element>'})
|
||||
class ComponentUsingInvalidProperty {
|
||||
@ -982,13 +982,13 @@ Did you run and wait for 'resolveComponentResources()'?` :
|
||||
restoreJasmineIt();
|
||||
});
|
||||
|
||||
onlyInIvy(`Unknown property warning logged instead of an error`)
|
||||
onlyInIvy(`Unknown property error logged instead of throwing`)
|
||||
.it('should error on unknown bound properties on custom elements by default', () => {
|
||||
@Component({template: '<div [someUnknownProp]="true"></div>'})
|
||||
class ComponentUsingInvalidProperty {
|
||||
}
|
||||
|
||||
const spy = spyOn(console, 'warn');
|
||||
const spy = spyOn(console, 'error');
|
||||
withModule({declarations: [ComponentUsingInvalidProperty]}, () => {
|
||||
const fixture = TestBed.createComponent(ComponentUsingInvalidProperty);
|
||||
fixture.detectChanges();
|
||||
|
Reference in New Issue
Block a user