-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(compiler): check entry component metadata #14335
fix(compiler): check entry component metadata #14335
Conversation
@@ -949,6 +950,10 @@ export class CompileMetadataResolver { | |||
return {componentType: dirType, componentFactory: dirSummary.componentFactory}; | |||
} | |||
} | |||
|
|||
if (throwIfNotFound) { | |||
throw new SyntaxError(`${dirType.name} is not an entry component.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or ... can not be used as an entry component
.
.toThrowError(SyntaxError, `SimpleService is not an entry component.`); | ||
})); | ||
|
||
it(`should not throw an error when a Directive is added to module's bootstrap list`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it should throw in this case as well!
if (entry) { | ||
components.push(entry); | ||
} | ||
}); | ||
return components; | ||
} | ||
|
||
private _getEntryComponentMetadata(dirType: any): cpl.CompileEntryComponentMetadata { | ||
private _getEntryComponentMetadata(dirType: any, throwIfNotFound = true): | ||
cpl.CompileEntryComponentMetadata { | ||
const dirMeta = this.getNonNormalizedDirectiveMetadata(dirType); | ||
if (dirMeta) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check DirMeta.isComponent
/ dirSummary.isComponent
to be truthy...
4869fd4
to
59ef923
Compare
Throw a proper error when a non-component is added to module's bootstrap list
4f3524c
to
02130f6
Compare
@tbosch PTAL |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Throw a proper error when a non-component is added to module's bootstrap list.
This avoids adding non-components to entry components and avoids printing stack traces.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
Does this PR introduce a breaking change? (check one with "x")