Skip to content
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

[BUG] Build will fail if the property name contains special characters. #63

Open
rmagur1203 opened this issue Aug 20, 2024 · 0 comments

Comments

@rmagur1203
Copy link

Describe the bug
Properties are accessed using PropertyAccessExpression, but must use ElementAccessExpression that contain special characters.

Playground link
playground

Expected behavior

function validate(user) {
    if (typeof user !== "object" || user === null)
        throw new Error("Expected user to be User");
    if (typeof user.name !== "string")
        throw new Error("Expected user.name to be a string");
    if (typeof user.id !== "number" || user.id < 10)
        throw new Error("Expected user.id to be a number, to be greater than 10");
    if (typeof user.obj !== "object" || user.obj === null)
        throw new Error("Expected user.obj to be an object");
    if (typeof user.obj["a-special-key"] !== "string")
        throw new Error("Expected user.obj.a-special-key to be a string");
}
validate({
    name: "abc",
    id: 4,
    obj: {
        'a-special-key': "test"
    }
});

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant