TypeScript-related issues with example code


I am a newbee to Aurelia, looking into it for less than a week now. Of course, I am thoroughly studying the available guides first, and I am also trying out any interesting examples in my own local development environment.

Yesterday I encountered an issue with the live sandbox example in the “How it works” article of the “Binding” guide. The import of several Expression-derived classes (specifically the AccessThis, Assign, CallFunction, CallScope, LiteralArray, LiteralObject, and Unary classes) raise errors, stating that they are not exported members of aurelia-framework. The example code seems to work fine in the online sandbox, however. So I have been examining those errors somewhat further in my local development environment.

First, it seems that the previously mentioned Expression-derived classes do exist in the aurelia-binding.js file, but they are not declared in the aurelia-binding.d.ts file. I consider this to be rather odd, because I assume that the .d.ts file is automatically generated during the compilation of aurelia.

Second, in the aurelia-binding.js file, which is located in the same folder where aurelia-binding.d.ts is located (node_modules/aurelia-binding/dist), the implementation of the base Expression class contains TypeScript code! In a JavaScript file! I find that even odder. But I get no runtime error, because it seems that the aurelia-binding.js file from the subfolder native-modules was taken during compilation. But nevertheless I was somewhat shocked to encounter this in deployed code.

Third, the declaration of the Expression class in aurelia-binding.d.ts contains four methods: evaluate, assign, connect, and accept. The actual implementation of the Expression class in aurelia-binding.ts contains - apart from the toString override - just two methods: evaluate and assign.

Can anybody please provide some explanation of these discrepancies between the implementations in the aurelia-binding.js file and the declarations in the aurelia-binding.d.ts file? My main goal is to get the example code from the sandbox completely up and running in my local development environment with a very strict TypeScript configuration, but it now fails to compile due to the import errors. And simply commenting out the missing imports and related code blocks results in some “Unknown” expression types in the rendered tree (of course).

Thank you very much in advance.