aboutsummaryrefslogtreecommitdiffstats
path: root/closure/README.md
diff options
context:
space:
mode:
authorMartin Probst2013-10-30 15:15:03 -0700
committerMartin Probst2013-10-30 15:15:03 -0700
commit9d0a69772c39bfc751ca2000c3b4b3381e51fe93 (patch)
tree0701e63288a184c2c8a8f69246e084b8674d6f64 /closure/README.md
parent117de8e6e26495959fd20831a39cce49a4cf2d51 (diff)
downloadangular.js-9d0a69772c39bfc751ca2000c3b4b3381e51fe93.tar.bz2
feat(Angular.js): add externs file for Closure Compiler
This adds an (incomplete) externs file for use with the Closure Compiler. Users can pass this as -extern to the compiler pass to get type checking and protect their AngularJS use against property renaming in advanced compilation mode.
Diffstat (limited to 'closure/README.md')
-rw-r--r--closure/README.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/closure/README.md b/closure/README.md
new file mode 100644
index 00000000..2501a2ad
--- /dev/null
+++ b/closure/README.md
@@ -0,0 +1,17 @@
+This file contains externs for use with the Closure compiler (aka JSCompiler).
+Passing these files to the --externs parameter of a compiler pass allows using
+type annotations for AngularJS objects. For example, Angular's $scope objects
+can be annotated as:
+```js
+/** @type {angular.Scope} */
+var scope = $scope;
+```
+
+This allows JSCompiler to type check accesses to scope, give warnings about
+missing methods or incorrect arguments, and also prevents renaming of property
+accesses with advanced compilation.
+
+The externs are incomplete and maintained on an as-needed basis, but strive to
+be correct. Externs for individual modules should be added in separate files.
+
+See https://developers.google.com/closure/compiler/