fix(ivy): a couple of typos in error messages (#31571)

Fixes a couple of typos that were noticed after the initial PR (#31543) got merged in.

PR Close #31571
This commit is contained in:
crisbeto 2019-07-15 21:11:10 +02:00 committed by Matias Niemelä
parent 54794f9b31
commit 9e83822679
2 changed files with 10 additions and 7 deletions

View File

@ -171,7 +171,7 @@ function verifySemanticsOfNgModuleDef(
ngModuleDef = getNgModuleDef(moduleType) !; ngModuleDef = getNgModuleDef(moduleType) !;
if (!ngModuleDef) { if (!ngModuleDef) {
throw new Error( throw new Error(
`Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add a @NgModule annotation.`); `Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
} }
} else { } else {
ngModuleDef = getNgModuleDef(moduleType, true); ngModuleDef = getNgModuleDef(moduleType, true);
@ -186,7 +186,7 @@ function verifySemanticsOfNgModuleDef(
const exports = maybeUnwrapFn(ngModuleDef.exports); const exports = maybeUnwrapFn(ngModuleDef.exports);
declarations.forEach(verifyDeclarationsHaveDefinitions); declarations.forEach(verifyDeclarationsHaveDefinitions);
const combinedDeclarations: Type<any>[] = [ const combinedDeclarations: Type<any>[] = [
...declarations.map(resolveForwardRef), // ...declarations.map(resolveForwardRef),
...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef), ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef),
]; ];
exports.forEach(verifyExportsAreDeclaredOrReExported); exports.forEach(verifyExportsAreDeclaredOrReExported);
@ -283,12 +283,12 @@ function verifySemanticsOfNgModuleDef(
if (getComponentDef(type) || getDirectiveDef(type)) { if (getComponentDef(type) || getDirectiveDef(type)) {
throw new Error( throw new Error(
`Unexpected directive '${type.name}' imported by the module '${importingModule.name}'. Please add a @NgModule annotation.`); `Unexpected directive '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
} }
if (getPipeDef(type)) { if (getPipeDef(type)) {
throw new Error( throw new Error(
`Unexpected pipe '${type.name}' imported by the module '${importingModule.name}'. Please add a @NgModule annotation.`); `Unexpected pipe '${type.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
} }
} }
} }

View File

@ -1428,7 +1428,8 @@ describe('acceptance integration tests', () => {
.createComponent(SomeComponent); .createComponent(SomeComponent);
}) })
.toThrowError( .toThrowError(
`Unexpected directive 'SomeComponent' imported by the module 'ModuleWithImportedComponent'. Please add a @NgModule annotation.`); // The ViewEngine error has a typo, whereas the Ivy one fixes it.
/^Unexpected directive 'SomeComponent' imported by the module 'ModuleWithImportedComponent'\. Please add (a|an) @NgModule annotation\.$/);
}); });
it('should throw with descriptive error message when a pipe is passed to imports', () => { it('should throw with descriptive error message when a pipe is passed to imports', () => {
@ -1446,7 +1447,8 @@ describe('acceptance integration tests', () => {
.createComponent(FixtureComponent); .createComponent(FixtureComponent);
}) })
.toThrowError( .toThrowError(
`Unexpected pipe 'SomePipe' imported by the module 'ModuleWithImportedPipe'. Please add a @NgModule annotation.`); // The ViewEngine error has a typo, whereas the Ivy one fixes it.
/^Unexpected pipe 'SomePipe' imported by the module 'ModuleWithImportedPipe'\. Please add (a|an) @NgModule annotation\.$/);
}); });
it('should throw with descriptive error message when a module is passed to declarations', () => { it('should throw with descriptive error message when a module is passed to declarations', () => {
@ -1501,7 +1503,8 @@ describe('acceptance integration tests', () => {
.createComponent(FixtureComponent); .createComponent(FixtureComponent);
}) })
.toThrowError( .toThrowError(
`Unexpected value 'SomeModule' imported by the module 'ModuleWithImportedModule'. Please add a @NgModule annotation.`); // The ViewEngine error has a typo, whereas the Ivy one fixes it.
/^Unexpected value 'SomeModule' imported by the module 'ModuleWithImportedModule'\. Please add (a|an) @NgModule annotation\.$/);
}); });
}); });