Skip to content

codegen: function-pointer arrays not supported (Array<(x: string) => void>) #586

@cs01

Description

@cs01

Bug

Arrays of function types fail to compile. Example that fails:

const listeners: Array<(x: string) => void> = [];
listeners.push((x) => console.log(x));
listeners[0]("hi");

Error: function-pointer arrays not yet supported.

Impact

Forces stdlib/library authors into single-listener-per-event patterns instead of the idiomatic array-of-listeners event-emitter shape. Hit during the lib/net.ts implementation (PR #585) — Socket.on() had to be refactored to accept only one listener per event as a workaround.

Related

Ties directly to issue for arr[i](args) call expression rejection — together they block idiomatic event-emitter patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus:in-progressActively being worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions