@c8/check-interface

Super tiny lib on top of check-types npm package to check ES 6 class interfaces

Usage no npm install needed!

<script type="module">
  import c8CheckInterface from 'https://cdn.skypack.dev/@c8/check-interface';
</script>

README

@c8/check-interface

Super tiny lib on top of check-types npm package to check object interfaces

Installation

npm i @c8/check-interface

Usage

const checkInterface = require('@c8/check-interface')

class MyInterface {

  constructor () {
    checkInterface(this, ['foo', 'bar'])
  }
}

class Foo extends MyInterface {
  constructor () {
    super()
  }

  foo () {
    return
  }
}

let fooClass = new Foo() // will throw an Error as bar isn't implemented