Wondering what’s next for npm?Check out our public roadmap! »

ts-todoTypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

TODO for TypeScript

Utility function to indicate unfinished code by throwing with a message of "Not yet implemented".

This can be useful if you are prototyping and are just looking to have your code typecheck.

The difference between unimplemented and todo is that while todo conveys an intent of implementing the functionality later and the message is "Not yet implemented", unimplemented makes no such claims. Its message is "Not implemented".

Advantages over simply throwing an error:

  • You can easily search your codebase for todo()
  • The error thrown will have the code ERR_TODO
  • Very clear what intentions it conveys

Installation

npm install --save ts-todo

Usage

import todo = require('ts-todo')
 
// Here's an example of some in-progress code. We have a interface Foo:
interface Foo {
  bar(): string
  baz(): number
}
 
// We want to implement Foo on one of our types, but we also want to work on just bar() first.
// In order for our code to compile, we need to implement baz(), so we can use todo:
class MyClass implements Foo {
  bar () {
    return 'test'
  }
 
  baz () {
    return todo()
  }
}

Related Packages

Prior Art

Install

npm i ts-todo

DownloadsWeekly Downloads

33

Version

1.0.0

License

MIT

Unpacked Size

2.08 kB

Total Files

4

Last publish

Collaborators

  • avatar