Khan/flow-to-ts

Convert string literals typed as string literals to use `as const`

kevinbarabash opened this issue · 0 comments

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;