Suggestion: Extension methods · Issue #9 · microsoft/TypeScript (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@RyanCavanaugh

Description

@RyanCavanaugh

Allow a declarative way of adding members to an existing type's prototype

Example:

class Shape { // ... }

/* ...elsewhere.../ extension class Shape { // Syntax?? getArea() { return / ... */; } }

var x = new Shape(); console.log(x.getArea()); // OK

Metadata

Metadata

Labels

Development

No branches or pull requests

Issue actions