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

Removing TSPropertySignature node adds commas to the type declaration #653

Open
danielo515 opened this issue Nov 17, 2021 · 0 comments
Open

Comments

@danielo515
Copy link

I originally opened this issue on the jscodeshift project (facebook/jscodeshift#464), but I'm pretty sure it is originating on this library.
Basically when you try to remove a type property of a type definition you get unneeded commas like it was an object.
This only happens for typescript, if you use flow you have to use ObjectTypeProperty that works correctly.

Input:

type Props = {
    __: translator;
    form: Form<any>;
    isOpen: boolean;
    closeModal: () => void;
};

Execute:

  j(file.source).find(j.TSPropertySignature, { key: { name: "__" } }).remove();

Output:

type Props = {
    form: Form<any>;,
    isOpen: boolean;,
    closeModal: () => void;
};
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