Skip to content

Instantly share code, notes, and snippets.

@dandean
Created May 6, 2015 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dandean/068afee97a3e2d5ac82b to your computer and use it in GitHub Desktop.
Save dandean/068afee97a3e2d5ac82b to your computer and use it in GitHub Desktop.
import args from "assert-args";
// Annotate functions for argument warnings in non-production environments:
@args({ bar: String, baz: Function })
function foo(bar, baz) {
}
foo();
// Argument Warning: expected bar to be String, found undefined
// Argument Warning: expected baz to be Function, found undefined
foo(5, "pow");
// Argument Warning: expected bar to be String, found Number
// Argument Warning: expected baz to be Function, found String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment