1.0.2 • Published 5 years ago

@peregrine/static-implements v1.0.2

Weekly downloads
1,103
License
MIT
Repository
github
Last release
5 years ago

static-implements

Define static methods in interfaces in TypeScript

Note: you might have to add/enable "experimentalDecorators": true in your tsconfig.json

Usage

MyInterface.ts

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

MyClass.ts

import ImplementsStatic from "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.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago