Skip to content

Event name is not parsed correct if fired with identifier instead string constant #1

@alexprey

Description

@alexprey

Event name is not parsed correct if fired with identifier instead string constant

import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();

const CLOSE_EVENT_NAME = 'modalWasClosed';
dispatch(CLOSE_EVENT_NAME);

Actual result

{
    "events": [
        {
            "name": "****unhandled-event-name****"
        }
    ]
}

Expected result

{
    "events": [
        {
            "name": "click"
        }
    ]
}

UPD. At 4.0.0 point this issue are partially fixed.

  • Support the top-level plain constants (EVENT_MODAL_CLOSE)
  • Support the top-level object-level constants (EVENT.MODAL.CLOSE)
  • Support the top-level object-level constants with accessing by index getter (EVENT['MODAL']['CLOSE']). Actually, I'm not sure that this are required

Metadata

Metadata

Assignees

No one assigned

    Labels

    Svelte V2Issue related to Svelte V2 componentsSvelte V3Issue related to Svelte V3 componentsenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions