Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Convert string literals typed as string literals to use as const #254

Open
kevinbarabash opened this issue Mar 8, 2021 · 0 comments
Open
Labels
conversion enhancement New feature or request

Comments

@kevinbarabash
Copy link
Contributor

Some examples:

export const NEW_PERMISSION_ID = ("NEW_PERMISSION_ID": "NEW_PERMISSION_ID");

would be converted to

export const NEW_PERMISSION_ID = "NEW_PERMISSION_ID" as const;

and

export const action = {
    FETCH_PERMISSIONS: ("FETCH_PERMISSIONS": "FETCH_PERMISSIONS"),
    RECEIVED_PERMISSIONS: ("RECEIVED_PERMISSIONS": "RECEIVED_PERMISSIONS"),

    FETCH_ROLES: ("FETCH_ROLES": "FETCH_ROLES"),
    RECEIVED_ROLES: ("RECEIVED_ROLES": "RECEIVED_ROLES"),

    ...
};

would be converted to

export const action = {
    FETCH_PERMISSIONS: "FETCH_PERMISSIONS"
    RECEIVED_PERMISSIONS: "RECEIVED_PERMISSIONS",

    FETCH_ROLES: "FETCH_ROLES",
    RECEIVED_ROLES: "RECEIVED_ROLES",

    ...
} as const;
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
conversion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant