Reputation: 565
I'm trying to create my own UMD library with typescript and webpack, and when importing a file I get the error TS2339 (Property 'makeRequest' does not exist on type 'typeof Utils'). Both files are in the same folder
My two files
assets.ts
'use strict';
import Utils from './utils';
export default class Assets {
constructor() {}
search(api: any, query: any) {
let request = {
path: `/assets`,
type: 'POST',
data: query
};
return Utils.makeRequest(api, request);
}
}
utils.ts
'use strict';
export default class Utils {
makeRequest(api: any, request: any): void {}
}
Upvotes: 0
Views: 2212
Reputation: 1050
You could use 2 ways to call your makeRequest method:
Mark the method as static:
static makeRequest(api: any, request: any): void { }
Create a new instance of the utils class and then call the method:
let util = new Utils(); return util.makeRequest(api, request);
Upvotes: 1