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

Clone bug #15

Open
lamo2k123 opened this issue Aug 16, 2023 · 1 comment
Open

Clone bug #15

lamo2k123 opened this issue Aug 16, 2023 · 1 comment

Comments

@lamo2k123
Copy link

Source structure:
image
image

Clone result:
image
image

Added new node ParenthesizedExpression

@lamo2k123
Copy link
Author

I have an idea that it can be fixed in this way. How right am I?

export function cloneElementAccessExpression(node: TS.ElementAccessExpression, options: CloneNodeVisitorOptions<TS.ElementAccessExpression>): TS.ElementAccessExpression | TS.ElementAccessChain {
	if(node.questionDotToken) {
		return options.factory.createElementAccessChain(
			options.hook("expression", options.nextNode(node.expression), node.expression),
			options.hook("questionDotToken", options.nextNode(node.questionDotToken), node.questionDotToken),
			options.hook("argumentExpression", options.nextNode(node.argumentExpression), node.argumentExpression)
		);
	}

	return options.factory.createElementAccessExpression(
		options.hook("expression", options.nextNode(node.expression), node.expression),
		options.hook("argumentExpression", options.nextNode(node.argumentExpression), node.argumentExpression)
	);
}

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