aboutsummaryrefslogtreecommitdiffstats
path: root/README.closure.md
diff options
context:
space:
mode:
authorMartin Probst2014-01-21 11:18:54 +0100
committerIgor Minar2014-01-22 11:39:09 -0800
commit00b44d8e12de2c928c5c9c7c3b46e9e41a1d43ef (patch)
tree80cd99d28ef5a3eb77a557fbac1c91e90e712db4 /README.closure.md
parentca865d29a3d4f21601222e43ee49abad5d38ce93 (diff)
downloadangular.js-00b44d8e12de2c928c5c9c7c3b46e9e41a1d43ef.tar.bz2
refactor(externs): move Closure Externs back to Closure code repositoryv1.0.x
While Closure Compiler generally recommends to maintain the externs for projects together with their source, this has not worked well for AngularJS: - Changes to externs must be tested; they can break clients. AngularJS has no testing infrastructure for this. - Changes mostly come from users inside of Google and are much more easily submitted together with the code using them within Google's repository. This change deletes the externs here and adds a README.closure.md to document the change. They will be added back to Closure Compiler in a separate submit. Closes #5907
Diffstat (limited to 'README.closure.md')
-rw-r--r--README.closure.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/README.closure.md b/README.closure.md
new file mode 100644
index 00000000..8d93f0a2
--- /dev/null
+++ b/README.closure.md
@@ -0,0 +1,23 @@
+Using AngularJS with the Closure Compiler
+=========================================
+
+The Closure Compiler project contains externs definitions for AngularJS
+JavaScript in its `contrib/externs` directory.
+
+The definitions contain 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/