1.0.0 • Published 6 years ago

ts-static-implements v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

ts-static-implements

Define static methods in interfaces in TypeScript

Usage

MyInterface.ts

interface MyInterface {
    doesThisWork(): boolean
    greeting(): string
}

MyClass.ts

import ImplementsStatic from "ts-static-implements"
import MyInterface from "./MyInterface"

@ImplementsStatic<MyInterface>() // instead of "class MyClass implements MyInterface"
class MyClass {
    static doesThisWork(): boolean {
        return true
    }

    static greeting(): string {
        return "Hello World!"
    }
}
1.0.0

6 years ago