Skip to content

Scoped augments / monkey patches / refinements #8464

@jklmli

Description

@jklmli

Now that augments / monkey patches are live in 1.8, maybe we could consider a move towards safer augments that are scoped to the file they're used in.

As a current workaround, I'm using explicit conversions, which are a Typescript take on implicit classes. (The difference being you have to explicitly invoke the conversion). They provide scoped monkey-patching. Here is some sample code written in this style.

Would these be considered as a future addition to TypeScript with nicer syntax and direct compiler support?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions