Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions source/nodejs/adaptivecards-designer/src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,17 @@ export class FieldDefinition {
let forceIndexerSyntax: boolean = false;

for (let i = path.length - 1; i >= 0; i--) {
let qualifiedName = path[i].qualifiedName(false)
let qualifiedName = path[i].qualifiedName(false);

if (shouldUseIndexerSyntax(qualifiedName) || forceIndexerSyntax) {
let modifiedName = qualifiedName;

// If we include `[0]` in the qualified name while determining if we should use indexer syntax,
// We could incorrectly wrap the name in []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add example string?

if (path[i].dataType instanceof ArrayData && qualifiedName.endsWith("[0]")) {
modifiedName = qualifiedName.substring(0, qualifiedName.length - 3);
}

if (shouldUseIndexerSyntax(modifiedName) || forceIndexerSyntax) {
qualifiedName = "['" + qualifiedName + "']";

forceIndexerSyntax = true;
Expand Down