I'm trying to convert three scripts from Javascript to TypeScript. The scripts can be found in this gist. I do however have one error left that I can't get rid of. Please note that this is my first React and TypeScript project so I can easily have missed something obvious. I'm using .tsx
files and TypeScript 2.1.
In the file: GoogleApiComponent.tsx
import * as cache from './ScriptCache'
...
componentWillMount() {
this.scriptCache = cache({ <--Error TS2349 here
google: GoogleApi({
apiKey: apiKey,
libraries: libraries
})
});
}
Gives me this error:
Cannot invoke an expression whose type lacks a call signature. Type 'typeof "ScriptCache"' has no compatible call signatures.
ScriptCache.tsx
looks like this:
let counter = 0;
let scriptMap = new Map();
export const ScriptCache = (function (global: any) {
return function ScriptCache(scripts: any) {
const Cache: any = {}
...
import
/export
your modules + on what line the error occurs. – Sebastian Sebald