Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including attyc with all npm packages installed. Try it out:

attyc lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("attyc/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

attyc v0.1.10

Command line app to verify types in an angularjs template

ATTyC

Currently in Alpha

AngularTemplateTypeChecker is a command line tool that uses typescript to verify angularjs templates. You supply the names and types of the variables that the template uses, and attyc will find any bugs in your template.

Note: Attyc isn't intended to conclusively prove that a template is correct, AFAIK this is impossible in angularjs. Its goal is to give you a bit more confidence that the template is correct. If you want absolute confidence that your templates don't contain errors, upgrade to angular 2 and use the AOT compiler.

Getting Started

To install run npm install -g attyc. For help, run attyc --help.

Attyc needs some metadata about your template to work out the types of template variables. It expects there to be a comment at the very top of the template, containing an edn vector of maps containing the keys :name (variable name), :type (variable type) and optionally :import (path to import the type from). For example:

<!-- [{:name "ctrl" :type "Controller" :import "./controller"}] -->

Once you've added this metadata, run attyc [glob matching template files]

Known Issues

  • Attyc works best when you use the "controller as" syntax. If you don't, you'll have to specify every single scope variable you use in the template metadata (ain't nobody got time for that).
  • Other than in the ng-init, ng-repeat and ng-options attributes, variable declaration is not allowed. For example, {{ x = 10 }} will cause an error.
  • Attyc assumes that if an attribute contains a variable name, then it is an angular expression. This may not always be true.
  • Filters are not type checked (although arguments to filters are). This could potentially lead to attyc missing errors. This may change in future.

Building it yourself

  • Clone the repo
  • Run npm install
  • Make sure you have leiningen installed
  • Run lein figwheel
  • In another terminal, run node dist/main.js
  • Figwheel will rebuild the code whenever it changes

For a production build, run lein cljsbuild once prod.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free