We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f1640d commit c154b81Copy full SHA for c154b81
src/compiler/factory.ts
@@ -24,14 +24,14 @@ namespace ts {
24
* Make `elements` into a `NodeArray<T>`. If `elements` is `undefined`, returns an empty `NodeArray<T>`.
25
*/
26
export function createNodeArray<T extends Node>(elements?: ReadonlyArray<T>, hasTrailingComma?: boolean): NodeArray<T> {
27
- if (elements) {
+ if (!elements || elements === emptyArray) {
28
+ elements = [];
29
+ }
30
+ else {
31
if (isNodeArray(elements)) {
32
return elements;
33
}
34
- else {
- elements = [];
- }
35
36
const array = <NodeArray<T>>elements;
37
array.pos = -1;
0 commit comments