GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — An index signature parameter type with types extends string or number. · Issue #28519 · microsoft/TypeScript

An index signature parameter type with types extends string or number. #28519

New issue
Copy link
New issue
Copy link
Open
Open
An index signature parameter type with types extends string or number.#28519
Copy link
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript

Description

@xiaozs
xiaozs
opened on Nov 14, 2018
Issue body actions

An_index_signature_parameter_type_must_be_string_or_number_1023:
with this Feature, I can't make this code work:

export class Events<ED extends EventsDef, EventName extends keyof ED = keyof ED> {
    private eventMap = new Map<EventName, Event<ED[EventName]>>();

    constructor() {
        new Proxy(this, {
            get: (target, p) => {
                if (p in target) {
                    return target[p];
                } else {
                    this.getEvent(p as EventName);
                }
            }
        })
    }

    private getEvent(eventName: EventName) {
        return this.eventMap.get(eventName) || this.generateEvent(eventName);
    }

    private generateEvent(eventName: EventName) {
        let event = new Event<ED[EventName]>();
        this.eventMap.set(eventName, event);
        return event;
    }

                     // error here
    readonly [eventName: EventName]: Event<ED[EventName]>;
}

Activity

  1. weswigham commented on Nov 14, 2018

    @weswigham
    Wesley Wigham (weswigham)
    on Nov 14, 2018
    Member
    More actions

    Ref #26797

  2. Wesley Wigham (weswigham)
    added
    SuggestionAn idea for TypeScriptAn idea for TypeScript
    In DiscussionNot yet reached consensusNot yet reached consensus
    on Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.