The following tsc command doesn't create a usable foo.d.ts:
TSC -declaration -m amd foo.ts
foo.ts:
export enum foo {
bar
}
foo.d.ts:
export declare enum foo {
bar,
}
But
///<reference path="./foo.d.ts"/>
doesn't work until the "export" is removed fro foo.d.ts. Is there another way of declaring a variable of type foo in a second file? Seems to me referencing foo.ts should have worked (it didn't):
///<reference path="./foo.ts"/>
Am I missing a keyword?
When you are working with external modules in TypeScript ///<reference
comments are not relevant.
To import the type into another file you need to do:
import mod = require('./foo');
// Then access the enum object as : mod.foo
To learn about internal vs. external modules check out this short video tutorial I made : http://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With