Skip to content

Repository files navigation

@johngw/outerface

Create static interfaces for your Typescript classes.

Installation

npm install @johngw/outerface

Use

Use the @outerface class decorator, with an Outerface extended interface to declare your static properties and methods.

interfaceComparableStatic<T>extendsOuterface<T>{compare(a: T,b: T): number}
@outerface<ComparableStatic<TableCell>>()classTableCell{readonlyvalue: numberconstructor(value: number){this.value=value}// This static method is required and the program will not compile// without it.staticcompare(a: TableCell,b: TableCell): number{returna.value-b.value}}

The Outerface interface requires a type parameter that is the instance type of the class.

About

Typescript's static interfaces

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages