Skip to content

Mapped types with as do not apply the remapping #1219

Description

@justarandomgeek
---@class (partial) EventDataMap
---@field on_achievement_gained EventData.on_achievement_gained
---@field on_ai_command_completed EventData.on_ai_command_completed
---@field on_segmented_unit_died EventData.on_segmented_unit_died
--- like 300 more...

---@class EventToken<E:string>

---@class events<M: EventDataMap = EventDataMap>: {[E in keyof M as E|EventToken<E>]?: fun(e:M[E])}

the as E|EventToken<E> is highlighted correctly, but the remapping of the keys seems to be totally ignored by type checking/hinting. as EventToken<E> is similarly ineffective.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions