Every time I try to call a function that clearly appears to be defined as a function, I continuously receive the error message: TypeError: [function name] is not a function.
To demonstrate the issue, here is a simple example:
main.ts
import someFunction from './someFunction'
export const baseUrl = document.location.protocol + '//' + document.location.hostname
someFunction(); //causing TypeError: someFunction is not a function
someFunction.ts
import {Foo} from './Foo'
export default function someFunction(): void {
//some code here
let foo = new Foo();
//some other code here
}
Foo.ts
import {baseUrl} from './main'
export class Foo{
constructor()
private someRandomPrivateFunction(): void {
//some code
let url = baseUrl + "other/stuff"; //removing this line fixes the TypeError
//some other code
}
}
Further information on the tools and versions in use:
Typescript version 1.8 is being used, targeting ES5, and generating modules using AMD.
RequireJS version 2.2.0 is implemented and data-main points to main.
The testing environment was Chrome version 52.0.2743.116 m.