Skip to content

Commit d773b6a

Browse files
committed
fixed(spy): support SpyObject in Typescript as well
- allow `@IMPLEMENTS` as a decorator - implement empty `noSuchMethod`
1 parent f6cd26b commit d773b6a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

modules/angular2/src/facade/lang.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ export function CONST() {
4545

4646
export class ABSTRACT {}
4747

48-
export class IMPLEMENTS {}
48+
// Note: This is only a marker annotation needed for ts2dart.
49+
// This is written so that is can be used as a Traceur annotation
50+
// or a Typescript decorator.
51+
export function IMPLEMENTS(_) {
52+
return (t) => t;
53+
}
4954

5055
export function isPresent(obj): boolean {
5156
return obj !== undefined && obj !== null;

modules/angular2/src/test_lib/test_lib.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ export class SpyObject {
299299
}
300300
}
301301
}
302+
// Noop so that SpyObject has the smae interface as in Dart
303+
noSuchMethod(args) {}
304+
302305
spy(name) {
303306
if (!this[name]) {
304307
this[name] = this._createGuinnessCompatibleSpy(name);

0 commit comments

Comments
 (0)