I am calling a function that appears to obviously be a function, but I keep getting TypeError: [function name] is not a function.
Here is a minimal example to reproduce the error.
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
}
}
Some details on the background items being used.
Typescript is 1.8 targeting ES5, and generating modules using AMD.
RequireJS is 2.2.0 and data-main points to main
I was testing in Chrome 52.0.2743.116 m