| OLD | NEW |
| 1 # Closure Compilation | 1 # Closure Compilation |
| 2 | 2 |
| 3 ## What is type safety? | 3 ## What is type safety? |
| 4 | 4 |
| 5 [Strongly-typed languages](https://en.wikipedia.org/wiki/Strong_and_weak_typing) | 5 [Strongly-typed languages](https://en.wikipedia.org/wiki/Strong_and_weak_typing) |
| 6 like C++ and Java have the notion of variable types. | 6 like C++ and Java have the notion of variable types. |
| 7 | 7 |
| 8 This is typically baked into how you declare variables: | 8 This is typically baked into how you declare variables: |
| 9 | 9 |
| 10 ```c++ | 10 ```c++ |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ++ '../my_project/compiled_resources2.gyp:*', | 189 ++ '../my_project/compiled_resources2.gyp:*', |
| 190 ], | 190 ], |
| 191 } | 191 } |
| 192 ] | 192 ] |
| 193 } | 193 } |
| 194 ``` | 194 ``` |
| 195 | 195 |
| 196 This file is used by the | 196 This file is used by the |
| 197 [Closure compiler bot](https://build.chromium.org/p/chromium.fyi/builders/Closur
e%20Compilation%20Linux) | 197 [Closure compiler bot](https://build.chromium.org/p/chromium.fyi/builders/Closur
e%20Compilation%20Linux) |
| 198 to automatically compile your code on every commit. | 198 to automatically compile your code on every commit. |
| 199 |
| 200 ## Externs |
| 201 |
| 202 [Externs files](https://github.com/google/closure-compiler/wiki/FAQ#how-do-i-wri
te-an-externs-file) |
| 203 define APIs external to your JavaScript. They provide the compiler with the type |
| 204 information needed to check usage of these APIs in your JavaScript, much like |
| 205 forward declarations do in C++. |
| 206 |
| 207 Third-party libraries like Polymer often provide externs. Chrome must also |
| 208 provide externs for its extension APIs. Whenever an extension API's `idl` or |
| 209 `json` schema is updated in Chrome, the corresponding externs file must be |
| 210 regenerated: |
| 211 |
| 212 ```shell |
| 213 ./tools/json_schema_compiler/compiler.py -g externs \ |
| 214 extensions/common/api/your_api_here.idl \ |
| 215 > third_party/closure_compiler/externs/your_api_here.js |
| 216 ``` |
| OLD | NEW |