fix(compiler): Improve error message for missing annotations (#14724)

Currently, it says:
Unexpected value 'FuzzyTimePipe in
javascript/angular2/example/search/fuzzy_time.ts' declared by the module
'SearchModule in javascript/angular2/example/search/search_module.ts'

The new error message also suggests: 'Please add a @Pipe/@Directive/@Component annotation.'
This commit is contained in:
Bowen Ni
2017-03-14 17:12:18 -07:00
committed by Chuck Jazdzewski
parent ff60c041f6
commit 3c15916e17
3 changed files with 28 additions and 6 deletions

View File

@ -433,7 +433,7 @@ export class CompileMetadataResolver {
if (!importedModuleSummary) {
this._reportError(
syntaxError(
`Unexpected ${this._getTypeDescriptor(importedType)} '${stringifyType(importedType)}' imported by the module '${stringifyType(moduleType)}'`),
`Unexpected ${this._getTypeDescriptor(importedType)} '${stringifyType(importedType)}' imported by the module '${stringifyType(moduleType)}'. Please add a @NgModule annotation.`),
moduleType);
return;
}
@ -491,7 +491,7 @@ export class CompileMetadataResolver {
} else {
this._reportError(
syntaxError(
`Unexpected ${this._getTypeDescriptor(declaredType)} '${stringifyType(declaredType)}' declared by the module '${stringifyType(moduleType)}'`),
`Unexpected ${this._getTypeDescriptor(declaredType)} '${stringifyType(declaredType)}' declared by the module '${stringifyType(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`),
moduleType);
return;
}