Skip to content

Commit fb9a0cd

Browse files
committed
Since declaration files are contained in own folder,
Angular 2 Tutorial was changed accordingly. Fixes Urigo/meteor-angular2.0-socially#40
1 parent cebd399 commit fb9a0cd

File tree

3 files changed

+68
-50
lines changed

3 files changed

+68
-50
lines changed

docs/angular-meteor/client/content/tutorials/socially/angular2/tutorials.socially.angular2.step_00.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,14 @@ At this moment you've likely noticed a message in the console saying that `angul
215215
It occurs because the TypeScript compiler is configured in the package with diagnostics messages turned on by default and
216216
the TypeScript compiler doesn't know anything about the location of the `angular2/core` and `angular2/platform/browser` modules. To fix this, you will need to make use of TypeScript declaration files, which is a TypeScript way to inform the compiler about third-party API modules.
217217

218-
After the first run, you will find the `angular2-meteor.d.ts` file in the new folder called "typings".
218+
After the first run, you will find the `angular2-meteor.d.ts` file in the new folder called "typings". This file is actually located
219+
in its own folder with the same name. This is how declaration files are laid out due to the convention followed by TypeScript community.
219220
This file has been created by the package at start time and contains a special reference to Angular 2 and Meteor declaration files.
220221
There are two ways to link `app.ts` and `angular2-meteor.d.ts` together:
221222

222223
- one way is to directly reference `angular2-meteor.d.ts` using a special sugared syntax at the top of `app.ts` as follows:
223224

224-
/// <reference path="../typings/angular2-meteor.d.ts" />
225+
/// <reference path="typings/angular2-meteor/angular2-meteor.d.ts" />
225226

226227
import {Component, View} from 'angular2/core';
227228

@@ -230,8 +231,8 @@ There are two ways to link `app.ts` and `angular2-meteor.d.ts` together:
230231
- another way is to create a custom [TypeScript configuration file](https://github.com/Microsoft/TypeScript/wiki/tsconfig.json) with the "files" property set to include all required typings files.
231232

232233
This configuration file should be called `tsconfig.json` and placed at
233-
the app root folder. We'll also take a close look at the configuration itself during the "Folder Structure"
234-
step, including how to configure TypeScript properly to automatically generate your `tsconfig.json` file in different IDEs.
234+
the app root folder. We'll also take a close look at the configuration itself during
235+
step 7, including how to configure TypeScript properly to automatically generate your `tsconfig.json` file in different IDEs.
235236

236237
Let's make use of the typings in the second way. Angular 2 and the Meteor API will be
237238
used in pretty much every file of our app, so adding declaration files manually might become repetitive.
@@ -240,9 +241,26 @@ Now create `tsconfig.json` and add path to `angular2-meteor.d.ts` as follows:
240241

241242
{{> DiffBox tutorialName="meteor-angular2-socially" step="0.8"}}
242243

243-
> Note: if you just loaded your app from a repository, you'll need to re-start it once.
244-
> This is because Meteor's local hierarchy of files is not yet built at the time the TypeScript compiler accesses them.
244+
Angular2-Meteor package adds not only its own declaration file but also Angular 2 declaration files it depends on to the typings folder.
245+
This is due to these files are distributed via the Angular 2 NPM package and Angular2-Meteor uses that NPM internally.
246+
From other side, declaration files for other dependencies like Meteor, ES6 Promise etc are available
247+
in the global repository of all typings called [DefinitelyTyped](http://definitelytyped.org/). So
248+
it's preferable to install them directly from this repo.
249+
In order to do that and thus add full type-checking support at this stage, you'll need to run tree commands:
245250

251+
npm install tsd -g
252+
253+
tsd install meteor
254+
255+
tsd install es6-promise
256+
257+
tsd install es6-shim
258+
259+
Briefly, it installs a special utility to work with that repo and add three main dependencies our
260+
app and Angular 2 depend on.
261+
262+
As it's mentioned above, step 7 provides a lot of details of how TypeScript and type-checking work,
263+
so you will learn everything needed later or you can go there now and read about TSD utility.
246264

247265
# Templates
248266

docs/angular-meteor/client/content/tutorials/socially/angular2/tutorials.socially.angular2.step_07.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Some of the typings files have names `angular2.d.ts` and `meteor.d.ts`, which, a
3636

3737
But as you remember, we've mentioned so far only one declaration file `angular2-meteor.d.ts` and used it in the TypeScript config (on the first step), that's thanks to a special TypeScript syntax construction that can link together one declaration files with other declaration files as well as TypeScript files. If you look inside of `angular2-meteor.d.ts` you'll see Angular 2 and Meteor declaration files are linked there by:
3838

39-
/// <reference path="angular2.d.ts" />
40-
/// <reference path="meteor/meteor.d.ts" />
39+
/// <reference path="../angular2/angular2.d.ts" />
40+
/// <reference path="../meteor/meteor.d.ts" />
4141

4242
Let’s create our own declaration file for our project in order to learn this type-checking better.
4343

docs/angular-meteor/client/content/tutorials/socially/patches/meteor-angular2-socially.multi.patch

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ index 19d3bf1..0000000
363363
2.5.4 (Apple Git-61)
364364

365365

366-
From 71b31fd9e53c07247e343b5d8a5b3321ab3e902e Mon Sep 17 00:00:00 2001
366+
From 71487d1366f7ce2c2d0b442551a5fbca1fffa0c2 Mon Sep 17 00:00:00 2001
367367
From: barbatus <[email protected]>
368368
Date: Wed, 6 Jan 2016 17:14:37 +0700
369-
Subject: [PATCH 010/165] Step 0.8: add tsconfig.json with the typings
369+
Subject: [PATCH 010/173] Step 0.8: add tsconfig.json with the typings
370370

371371
---
372372
tsconfig.json | 5 +++++
@@ -375,13 +375,13 @@ Subject: [PATCH 010/165] Step 0.8: add tsconfig.json with the typings
375375

376376
diff --git a/tsconfig.json b/tsconfig.json
377377
new file mode 100644
378-
index 0000000..ccc1ef1
378+
index 0000000..45aafe9
379379
--- /dev/null
380380
+++ b/tsconfig.json
381381
@@ -0,0 +1,5 @@
382382
+{
383383
+ "files": [
384-
+ "typings/angular2-meteor.d.ts"
384+
+ "typings/angular2-meteor/angular2-meteor.d.ts"
385385
+ ]
386386
+}
387387
--
@@ -1876,24 +1876,24 @@ index 0000000..deb86df
18761876
2.5.4 (Apple Git-61)
18771877

18781878

1879-
From abdfd9c6cd955198837fb05d83729e10baf0baf9 Mon Sep 17 00:00:00 2001
1879+
From 80696f37b4dae4c210091fe8aa75c2e7d07b8b3d Mon Sep 17 00:00:00 2001
18801880
From: barbatus <[email protected]>
18811881
Date: Thu, 7 Jan 2016 13:15:51 +0700
1882-
Subject: [PATCH 055/165] Step 7.2: add party declaration file to the tsconfig
1882+
Subject: [PATCH 055/173] Step 7.2: add party declaration file to the tsconfig
18831883

18841884
---
18851885
tsconfig.json | 3 ++-
18861886
1 file changed, 2 insertions(+), 1 deletion(-)
18871887

18881888
diff --git a/tsconfig.json b/tsconfig.json
1889-
index ccc1ef1..4c95bdd 100644
1889+
index 45aafe9..97fc4fd 100644
18901890
--- a/tsconfig.json
18911891
+++ b/tsconfig.json
18921892
@@ -1,5 +1,6 @@
18931893
{
18941894
"files": [
1895-
- "typings/angular2-meteor.d.ts"
1896-
+ "typings/angular2-meteor.d.ts",
1895+
- "typings/angular2-meteor/angular2-meteor.d.ts"
1896+
+ "typings/angular2-meteor/angular2-meteor.d.ts",
18971897
+ "typings/party.d.ts"
18981898
]
18991899
}
@@ -1974,18 +1974,18 @@ index 40be530..3dacd0a 100644
19741974
2.5.4 (Apple Git-61)
19751975

19761976

1977-
From 0e5d1c5c66a686d4acfe35ed8b9b07df9da18091 Mon Sep 17 00:00:00 2001
1977+
From 46657b1c1c82585f9536c775258305ddea9e37ed Mon Sep 17 00:00:00 2001
19781978
From: barbatus <[email protected]>
19791979
Date: Thu, 7 Jan 2016 14:38:05 +0700
1980-
Subject: [PATCH 059/165] Step 7.6: add new TypeScript options to configure
1980+
Subject: [PATCH 059/173] Step 7.6: add new TypeScript options to configure
19811981
plugins
19821982

19831983
---
19841984
tsconfig.json | 9 ++++++++-
19851985
1 file changed, 8 insertions(+), 1 deletion(-)
19861986

19871987
diff --git a/tsconfig.json b/tsconfig.json
1988-
index 4c95bdd..a82844e 100644
1988+
index 97fc4fd..848662f 100644
19891989
--- a/tsconfig.json
19901990
+++ b/tsconfig.json
19911991
@@ -1,6 +1,13 @@
@@ -1996,7 +1996,7 @@ index 4c95bdd..a82844e 100644
19961996
+ "target": "es5"
19971997
+ },
19981998
"files": [
1999-
"typings/angular2-meteor.d.ts",
1999+
"typings/angular2-meteor/angular2-meteor.d.ts",
20002000
- "typings/party.d.ts"
20012001
+ "typings/party.d.ts",
20022002
+ "client/app.ts",
@@ -2090,27 +2090,27 @@ index b29e580..9444cba 100644
20902090
2.5.4 (Apple Git-61)
20912091

20922092

2093-
From 07b5880beb2a40b568edcdd69d2a9e9b45534a96 Mon Sep 17 00:00:00 2001
2093+
From cc727c2929175cc7ad60658b688deb3d7db01252 Mon Sep 17 00:00:00 2001
20942094
From: barbatus <[email protected]>
20952095
Date: Thu, 7 Jan 2016 15:16:00 +0700
2096-
Subject: [PATCH 063/165] Step 8.3: add typings to the tsconfig
2096+
Subject: [PATCH 063/173] Step 8.3: add typings to the tsconfig
20972097

20982098
---
20992099
tsconfig.json | 1 +
21002100
1 file changed, 1 insertion(+)
21012101

21022102
diff --git a/tsconfig.json b/tsconfig.json
2103-
index a82844e..b749b07 100644
2103+
index 848662f..85cf989 100644
21042104
--- a/tsconfig.json
21052105
+++ b/tsconfig.json
2106-
@@ -7,6 +7,7 @@
2106+
@@ -6,6 +6,7 @@
2107+
},
21072108
"files": [
2108-
"typings/angular2-meteor.d.ts",
2109+
"typings/angular2-meteor/angular2-meteor.d.ts",
2110+
+ "typings/meteor-accounts-ui/meteor-accounts-ui.d.ts",
21092111
"typings/party.d.ts",
2110-
+ "typings/meteor-accounts-ui.d.ts",
21112112
"client/app.ts",
21122113
"server/main.ts"
2113-
]
21142114
--
21152115
2.5.4 (Apple Git-61)
21162116

@@ -2258,27 +2258,27 @@ index 6160a20..a1a7442 100644
22582258
2.5.4 (Apple Git-61)
22592259

22602260

2261-
From e27b47b44f6cb7892539ea59009f2232cdb8efd0 Mon Sep 17 00:00:00 2001
2261+
From 92a52636ecf19da0e0b54aab10124b0ffa1b7396 Mon Sep 17 00:00:00 2001
22622262
From: barbatus <[email protected]>
22632263
Date: Thu, 7 Jan 2016 15:18:33 +0700
2264-
Subject: [PATCH 068/165] Step 8.7: add typings to the tsconfig
2264+
Subject: [PATCH 068/173] Step 8.7: add typings to the tsconfig
22652265

22662266
---
22672267
tsconfig.json | 1 +
22682268
1 file changed, 1 insertion(+)
22692269

22702270
diff --git a/tsconfig.json b/tsconfig.json
2271-
index b749b07..1ab4d3d 100644
2271+
index 85cf989..c009240 100644
22722272
--- a/tsconfig.json
22732273
+++ b/tsconfig.json
2274-
@@ -8,6 +8,7 @@
2275-
"typings/angular2-meteor.d.ts",
2274+
@@ -7,6 +7,7 @@
2275+
"files": [
2276+
"typings/angular2-meteor/angular2-meteor.d.ts",
2277+
"typings/meteor-accounts-ui/meteor-accounts-ui.d.ts",
2278+
+ "typings/meteor-accounts/meteor-accounts.d.ts",
22762279
"typings/party.d.ts",
2277-
"typings/meteor-accounts-ui.d.ts",
2278-
+ "typings/meteor-accounts.d.ts",
22792280
"client/app.ts",
22802281
"server/main.ts"
2281-
]
22822282
--
22832283
2.5.4 (Apple Git-61)
22842284

@@ -3019,27 +3019,27 @@ index e676414..e8c9ca8 100644
30193019
2.5.4 (Apple Git-61)
30203020

30213021

3022-
From b589c41c8b999e2508806b5c2c2d227604835079 Mon Sep 17 00:00:00 2001
3022+
From 69b82a4abd198c04f6b4bd1a830c8f75f0b8862d Mon Sep 17 00:00:00 2001
30233023
From: barbatus <[email protected]>
30243024
Date: Thu, 7 Jan 2016 16:04:26 +0700
3025-
Subject: [PATCH 092/165] Step 12.6: add pagination typings
3025+
Subject: [PATCH 092/173] Step 12.6: add pagination typings
30263026

30273027
---
30283028
tsconfig.json | 1 +
30293029
1 file changed, 1 insertion(+)
30303030

30313031
diff --git a/tsconfig.json b/tsconfig.json
3032-
index 1ab4d3d..8bca042 100644
3032+
index c009240..6463596 100644
30333033
--- a/tsconfig.json
30343034
+++ b/tsconfig.json
3035-
@@ -9,6 +9,7 @@
3035+
@@ -8,6 +8,7 @@
3036+
"typings/angular2-meteor/angular2-meteor.d.ts",
3037+
"typings/meteor-accounts-ui/meteor-accounts-ui.d.ts",
3038+
"typings/meteor-accounts/meteor-accounts.d.ts",
3039+
+ "typings/ng2-pagination/ng2-pagination.d.ts",
30363040
"typings/party.d.ts",
3037-
"typings/meteor-accounts-ui.d.ts",
3038-
"typings/meteor-accounts.d.ts",
3039-
+ "typings/ng2-pagination.d.ts",
30403041
"client/app.ts",
30413042
"server/main.ts"
3042-
]
30433043
--
30443044
2.5.4 (Apple Git-61)
30453045

@@ -4546,18 +4546,18 @@ index 95e6e57..1301c19 100644
45464546
2.5.4 (Apple Git-61)
45474547

45484548

4549-
From 2ac2737ab0b44ce77afdc2fba9e282adfd3c9f25 Mon Sep 17 00:00:00 2001
4549+
From 1dbc178657cd2d9839cadba617110c38f5da3b9f Mon Sep 17 00:00:00 2001
45504550
From: barbatus <[email protected]>
45514551
Date: Tue, 12 Jan 2016 22:53:12 +0700
4552-
Subject: [PATCH 136/165] Step 16.1: extend party location with lat and lng
4552+
Subject: [PATCH 136/173] Step 16.1: extend party location with lat and lng
45534553
coordinates
45544554

45554555
---
45564556
typings/party.d.ts | 6 +++++-
45574557
1 file changed, 5 insertions(+), 1 deletion(-)
45584558

45594559
diff --git a/typings/party.d.ts b/typings/party.d.ts
4560-
index ea07831..50fb3ce 100644
4560+
index ea07831..22d54b2 100644
45614561
--- a/typings/party.d.ts
45624562
+++ b/typings/party.d.ts
45634563
@@ -2,7 +2,11 @@ interface Party {
@@ -4566,9 +4566,9 @@ index ea07831..50fb3ce 100644
45664566
description?: string;
45674567
- location: string;
45684568
+ location: {
4569-
+ name: string,
4570-
+ lat?: number,
4571-
+ lng?: number
4569+
+ name: string;
4570+
+ lat?: number;
4571+
+ lng?: number;
45724572
+ };
45734573
owner?: string;
45744574
public: boolean;

0 commit comments

Comments
 (0)