I am trying to change from using external (export
) modules, to using internal modules. But I am getting an error when I remove the "export".
I have a file like this:
box.ts:
import {computedFrom} from 'aurelia-framework';
module Entities {
export class Box { .. Stuff }
I use this in another file.
service-actions.ts:
/// <reference path="../entities/box.ts" />
....
var box = new Entities.Box();
This gives me the following error:
Property 'Box' does not exist on 'typeof(Entities)'
But if I take out import {computedFrom} from 'aurelia-framework';
then the error is gone (it works fine).
I tried moving the import {computedFrom} from 'aurelia-framework';
into the module. When I do that the error is gone, but I get a new one:
Import declarations in a namespace cannot reference a module.
What can I do to be able to use the computedFrom
module in my class? (Does it have to be an external module for it to work?)
On the whole, it is best to avoid mixing internal and external modules.
External modules (or modules as they are now known) are actually rather graceful, and you can organise your code really well without internal modules (or namespaces as they are now known).
box.ts:
service-actions.ts: