Skip to content

Commit c8dfea3

Browse files
schmidt-sebastianjshcrowthe
authored andcommitted
fix(*): Fix compilation problems in my local environment (#98)
* fix(*): Fix compilation problems in my local environment * fix(deps): update typescript, ts-loader, and karma-typescript versions * docs(tests): update README.md to include the necessary project.json instructions * fix(comment): Adding comment on TS compiler
1 parent 2f989fb commit c8dfea3

File tree

6 files changed

+78
-27
lines changed

6 files changed

+78
-27
lines changed

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,18 @@ gulp --tasks
5858

5959
## Testing the SDK
6060

61-
To run all tests for the SDK simply run: `npm test` at the root of this package.
61+
To run all tests for the SDK you must first supply a firebase project config for
62+
your tests. This is done by creating a file called `project.json` and at the
63+
following path:
64+
65+
```
66+
tests/config/project.json
67+
```
68+
69+
This file should contain a JSON object with your app information (i.e. the same
70+
information you would pass to `firebase.initializeApp`).
71+
72+
After you have done this, simply run: `npm test` at the root of this package.
6273

6374
There are several types of available tests:
6475

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@
6868
"karma-firefox-launcher": "^1.0.1",
6969
"karma-mocha": "^1.3.0",
7070
"karma-spec-reporter": "^0.0.30",
71-
"karma-typescript": "^3.0.1",
71+
"karma-typescript": "^3.0.4",
7272
"merge2": "^1.0.3",
7373
"mkdirp": "^0.5.1",
7474
"require-dir": "^0.3.1",
7575
"rimraf": "^2.6.1",
7676
"shx": "^0.2.2",
7777
"sinon": "^2.1.0",
7878
"through2": "^2.0.3",
79-
"ts-node": "2.1.1",
80-
"typescript": "^2.2.1",
79+
"ts-node": "^3.3.0",
80+
"typescript": "^2.4.2",
8181
"validate-commit-msg": "^2.12.1",
8282
"vinyl-named": "^1.1.0",
8383
"webpack": "^3.0.0",

src/messaging/controllers/window-controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export default class WindowController extends ControllerInterface {
247247
const serviceWorker = registration.installing || registration.waiting ||
248248
registration.active;
249249

250-
return new Promise((resolve, reject) => {
250+
return new Promise<ServiceWorkerRegistration>((resolve, reject) => {
251251
if (!serviceWorker) {
252252
// This is a rare scenario but has occured in firefox
253253
reject(this.errorFactory_.create(Errors.codes.NO_SW_IN_REG));

src/messaging/models/db-interface.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class DBInterface {
2525
private dbVersion_: number;
2626
private openDbPromise_: Promise<IDBDatabase>;
2727
protected errorFactory_: ErrorFactory<string>;
28-
protected TRANSACTION_READ_WRITE: string;
28+
protected TRANSACTION_READ_WRITE: IDBTransactionMode;
2929

3030
/**
3131
* @param {string} dbName

src/storage/task.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,15 @@ export class UploadTask {
493493
/**
494494
* This object behaves like a Promise, and resolves with its snapshot data
495495
* when the upload completes.
496-
* The fulfillment callback. Promise chaining works as normal.
496+
* @param onFulfilled The fulfillment callback. Promise chaining works as normal.
497497
* @param onRejected The rejection callback.
498498
*/
499499
then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | PromiseLike<U>) | null, onRejected?: ((error: any) => U | PromiseLike<U>) | null): Promise<U> {
500+
// These casts are needed so that TypeScript can infer the types of the
501+
// resulting Promise.
500502
return this.promise_.then<U>(
501503
(onFulfilled as (value: UploadTaskSnapshot) => U | PromiseLike<U>),
502-
(onRejected as ((error: any) => PromiseLike<U>) | null));
504+
(onRejected as ((error: any) => PromiseLike<never>) | null));
503505
}
504506

505507
/**

yarn.lock

+57-19
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ ansi-styles@^2.2.1:
152152
version "2.2.1"
153153
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
154154

155+
ansi-styles@^3.1.0:
156+
version "3.2.0"
157+
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
158+
dependencies:
159+
color-convert "^1.9.0"
160+
155161
anymatch@^1.3.0:
156162
version "1.3.0"
157163
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507"
@@ -1335,6 +1341,14 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
13351341
strip-ansi "^3.0.0"
13361342
supports-color "^2.0.0"
13371343

1344+
chalk@^2.0.0:
1345+
version "2.0.1"
1346+
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d"
1347+
dependencies:
1348+
ansi-styles "^3.1.0"
1349+
escape-string-regexp "^1.0.5"
1350+
supports-color "^4.0.0"
1351+
13381352
child-process-promise@^2.2.1:
13391353
version "2.2.1"
13401354
resolved "https://registry.yarnpkg.com/child-process-promise/-/child-process-promise-2.2.1.tgz#4730a11ef610fad450b8f223c79d31d7bdad8074"
@@ -1453,6 +1467,16 @@ collection-visit@^0.2.1:
14531467
map-visit "^0.1.5"
14541468
object-visit "^0.3.4"
14551469

1470+
color-convert@^1.9.0:
1471+
version "1.9.0"
1472+
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
1473+
dependencies:
1474+
color-name "^1.1.1"
1475+
1476+
color-name@^1.1.1:
1477+
version "1.1.3"
1478+
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
1479+
14561480
14571481
version "1.0.3"
14581482
resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b"
@@ -3119,6 +3143,10 @@ has-flag@^1.0.0:
31193143
version "1.0.0"
31203144
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
31213145

3146+
has-flag@^2.0.0:
3147+
version "2.0.0"
3148+
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
3149+
31223150
has-gulplog@^0.1.0:
31233151
version "0.1.0"
31243152
resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce"
@@ -3774,9 +3802,9 @@ karma-spec-reporter@^0.0.30:
37743802
dependencies:
37753803
colors "^1.1.2"
37763804

3777-
karma-typescript@^3.0.1:
3778-
version "3.0.1"
3779-
resolved "https://registry.yarnpkg.com/karma-typescript/-/karma-typescript-3.0.1.tgz#64619473a68973773ec3132f96be06da7428427e"
3805+
karma-typescript@^3.0.4:
3806+
version "3.0.4"
3807+
resolved "https://registry.yarnpkg.com/karma-typescript/-/karma-typescript-3.0.4.tgz#9cdeeeddd1671693440c34ec62aba2d6ff9e4b05"
37803808
dependencies:
37813809
acorn "^4.0.4"
37823810
amdefine "1.0.0"
@@ -5066,7 +5094,7 @@ pinkie-promise@^2.0.0:
50665094
dependencies:
50675095
pinkie "^2.0.0"
50685096

5069-
pinkie@^2.0.0, pinkie@^2.0.4:
5097+
pinkie@^2.0.0:
50705098
version "2.0.4"
50715099
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
50725100

@@ -5998,6 +6026,12 @@ supports-color@^3.1.0:
59986026
dependencies:
59996027
has-flag "^1.0.0"
60006028

6029+
supports-color@^4.0.0:
6030+
version "4.2.1"
6031+
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836"
6032+
dependencies:
6033+
has-flag "^2.0.0"
6034+
60016035
symbol-tree@^3.2.1:
60026036
version "3.2.2"
60036037
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"
@@ -6222,22 +6256,20 @@ trim-right@^1.0.1:
62226256
version "1.0.1"
62236257
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
62246258

6225-
ts-node@2.1.1:
6226-
version "2.1.1"
6227-
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-2.1.1.tgz#2fe7049ea56319730052a9e677985e6151a7bd31"
6259+
ts-node@^3.3.0:
6260+
version "3.3.0"
6261+
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.3.0.tgz#c13c6a3024e30be1180dd53038fc209289d4bf69"
62286262
dependencies:
62296263
arrify "^1.0.0"
6230-
chalk "^1.1.1"
6264+
chalk "^2.0.0"
62316265
diff "^3.1.0"
62326266
make-error "^1.1.1"
62336267
minimist "^1.2.0"
62346268
mkdirp "^0.5.1"
6235-
pinkie "^2.0.4"
62366269
source-map-support "^0.4.0"
62376270
tsconfig "^6.0.0"
6238-
v8flags "^2.0.11"
6239-
xtend "^4.0.0"
6240-
yn "^1.2.0"
6271+
v8flags "^3.0.0"
6272+
yn "^2.0.0"
62416273

62426274
tsconfig@^6.0.0:
62436275
version "6.0.0"
@@ -6289,9 +6321,9 @@ typedarray@~0.0.5:
62896321
version "0.0.6"
62906322
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
62916323

6292-
typescript@^2.2.1:
6293-
version "2.3.2"
6294-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"
6324+
typescript@^2.4.2:
6325+
version "2.4.2"
6326+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844"
62956327

62966328
uglify-js@^2.6, uglify-js@^2.8.29:
62976329
version "2.8.29"
@@ -6460,12 +6492,18 @@ uuid@^3.0.0:
64606492
version "3.0.1"
64616493
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1"
64626494

6463-
v8flags@^2.0.10, v8flags@^2.0.11, v8flags@^2.0.9:
6495+
v8flags@^2.0.10, v8flags@^2.0.9:
64646496
version "2.1.1"
64656497
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"
64666498
dependencies:
64676499
user-home "^1.1.1"
64686500

6501+
v8flags@^3.0.0:
6502+
version "3.0.0"
6503+
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.0.tgz#4be9604488e0c4123645def705b1848d16b8e01f"
6504+
dependencies:
6505+
user-home "^1.1.1"
6506+
64696507
vali-date@^1.0.0:
64706508
version "1.0.0"
64716509
resolved "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6"
@@ -6873,6 +6911,6 @@ [email protected]:
68736911
version "0.1.2"
68746912
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"
68756913

6876-
yn@^1.2.0:
6877-
version "1.2.0"
6878-
resolved "https://registry.yarnpkg.com/yn/-/yn-1.2.0.tgz#d237a4c533f279b2b89d3acac2db4b8c795e4a63"
6914+
yn@^2.0.0:
6915+
version "2.0.0"
6916+
resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"

0 commit comments

Comments
 (0)