Skip to content

handbook: incorrect recipe for "function with parameters" #4751

@wardbell

Description

@wardbell

As I write, the handbook says that the following usage:

zooKeeper.workSchedule = "morning";
zooKeeper(giraffeCage);

should have the following TypeScript declaration

// Note: Function must precede module
function zooKeeper(cage: AnimalCage);
module zooKeeper {
    var workSchedule: string;
}

That doesn't work AFAIK. I believe the recommendation should be:

interface zooKeeper {
  (cage:AnimalCage) : void;
  workSchedule: string;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDocsThe issue relates to how you learn TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions