Allow resolving of ES5 default values in functions#25048
Conversation
There was a problem hiding this comment.
Could this be reworded to This list may have been filtered (...) to indicate the ReflectionHost is expected to do that. Currently it reads to me as if consumers of ReflectionHost are responsible for doing so, in which it doesn't make much sense to tell here wat consumers can do with an array :)
There was a problem hiding this comment.
I'll fix this in my PR
There was a problem hiding this comment.
Perhaps stick some triple back ticks around this.
ngtsc's static resolver can evaluate function calls where parameters have default values. In TypeScript code these default values live on the function definition, but in ES5 code the default values are represented by statements in the function body. A new ReflectionHost method getDefinitionOfFunction() abstracts over this difference, and allows the static reflector to more accurately evaluate ES5 code.
789c2ef to
b185031
Compare
|
You can preview b185031 at https://pr25048-b185031.ngbuilds.io/. |
| * A current limitation is that this metadata has no representation for shorthand assignment of | ||
| * parameter objects in the function signature. | ||
| * | ||
| * @param node a TypeScript `ts.Declaration` node representing the function over which to reflect. |
There was a problem hiding this comment.
I'll fix this in my PR
| return { | ||
| node, | ||
| body: node.body !== undefined ? Array.from(node.body.statements) : null, | ||
| parameters: node.parameters.map(node => { |
There was a problem hiding this comment.
Consider renaming the second node to paramNode to avoid confusion below.
There was a problem hiding this comment.
I'll fix this in my PR
|
@petebacondarwin will merge this along with the ngcc implementation. |
|
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. |
No description provided.