Skip to content

Overriding string values with objects, gives an object with string characters as object keys #87

@mrgk21

Description

@mrgk21
const def = await this.getEntityDefinition(identifier, true);
const factory = await this.getFactoryDefinition(identifier, def.definition);
const modifiedKeys = this.getModifiedKeys<T>(def.definition, { includes2, excludes2, override });
const entity = (await factory.build(modifiedKeys)) as T;

Here includes2 and excludes2 are a list of keys which should be included and excluded from the object, which is mixed with override keys.

For the values:

excludes2: {
	email: 1,
	name: 1,
	location: 0
},
includes2: {
	location: 1
},
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
override: {
	location: {
		abcd: 'hello'
	}
}

I get modifiedKeys = { email: undefined, name: undefined, location: { abcd: 'hello' } }

Im getting this result from the build function

 "location": {
        "0": "0",
        "1": "1",
        "2": "9",
        "3": "1",
        "4": "4",
        "5": "5",
        "6": "a",
        "7": "4",
        "8": "-",
        "9": "d",
        "10": "d",
        "11": "d",
        "12": "0",
        "13": "-",
        "14": "7",
        "15": "5",
        "16": "2",
        "17": "d",
        "18": "-",
        "19": "b",
        "20": "7",
        "21": "d",
        "22": "3",
        "23": "-",
        "24": "b",
        "25": "0",
        "26": "f",
        "27": "e",
        "28": "9",
        "29": "f",
        "30": "a",
        "31": "3",
        "32": "8",
        "33": "b",
        "34": "7",
        "35": "0",
        "abcd": "hello"
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions