Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9d0a697

Browse files
committed
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.
1 parent 117de8e commit 9d0a697

File tree

2 files changed

+1929
-0
lines changed

2 files changed

+1929
-0
lines changed

closure/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This file contains externs for use with the Closure compiler (aka JSCompiler).
2+
Passing these files to the --externs parameter of a compiler pass allows using
3+
type annotations for AngularJS objects. For example, Angular's $scope objects
4+
can be annotated as:
5+
```js
6+
/** @type {angular.Scope} */
7+
var scope = $scope;
8+
```
9+
10+
This allows JSCompiler to type check accesses to scope, give warnings about
11+
missing methods or incorrect arguments, and also prevents renaming of property
12+
accesses with advanced compilation.
13+
14+
The externs are incomplete and maintained on an as-needed basis, but strive to
15+
be correct. Externs for individual modules should be added in separate files.
16+
17+
See https://developers.google.com/closure/compiler/

0 commit comments

Comments
 (0)