Skip to content

Problems with Genrics on Lambda-functions #21

@misantronic

Description

@misantronic

There is a problem when compiling files with generics on lambda-functions.
Example:

const fn = <T>(Dependency: Constructable<T>, hint?: string): T =>
        ensureInjector().get(Dependency, hint);

It transpiles to this:

const fn = React.createElement(
      T,
      null,
      "(Dependency: Constructable",
      React.createElement(
        T,
        null,
        ", hint?: string): T => ensureInjector().get(Dependency, hint); // function fn",
        React.createElement(
          T,
          null,
          "(Dependency: Constructable",
          React.createElement(
            T,
            null,
            ", hint?: string): T ",
            fn.reset = () => {
              injector = void 0;
            },
            "; return fn; })();"
          )
        )
      )
    );

When changing the function to this it works:

function fn<T>(Dependency: Constructable<T>, hint?: string): T {
    return ensureInjector().get(Dependency, hint);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions