Reputation: 17530
I am writing a TypeScript class:
export class Test
{
property : string;
}
I want to extend the Knockout interface, KnockoutObservable
like for String
, Bool
that are already in Knockout.d.ts;
export declare interface KnockoutObservableTest extends KnockoutObservableBase
{
...
}
If I have the interface in my Test.ts file together with the class I cant get it working. if I put it in a separate App.d.ts file and reference it, it seems to work.
My test is
var value : KnockoutObservableTest;
Wondering why it have to be in a d.ts file, or maybe there is something I do not know ?
Upvotes: 2
Views: 1068
Reputation: 17530
When loading it from the same file as the Test.ts
with...
import TestModel = module('Test');
... the interface is declared in TestModel.KnockoutObservableTest
in contrast to just being in the root scope when references a .d.ts
file.
Upvotes: 1