Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using GLPK() in TypeScript results in 'This expression is not callable' #37

Closed
domdomegg opened this issue Jan 10, 2023 · 4 comments · Fixed by #38
Closed

Using GLPK() in TypeScript results in 'This expression is not callable' #37

domdomegg opened this issue Jan 10, 2023 · 4 comments · Fixed by #38

Comments

@domdomegg
Copy link
Contributor

This code in TypeScript

import GLPK from "glpk.js";

const glpk = GLPK();

Throws a compliation error:

This expression is not callable.
  Type 'typeof import("/my_app/node_modules/glpk.js/dist/glpk")' has no call signatures.ts(2349)

However, based on the documentation this seems like the correct way to initialise the library. Using // @ts-ignore, the library seems to work correctly. So I think this is an issue with the typings in dist/glpk.d.ts.

Specifically I'm using versions:

typescript: 4.9.4
glpk.js: 4.0.1

But think it applies on any modern version of TypeScript.

domdomegg added a commit to domdomegg/glpk.js that referenced this issue Jan 10, 2023
@jvail
Copy link
Owner

jvail commented Jan 10, 2023

Hello @domdomegg,

I admit my treatment of TS is quite stepmotherly ... If the fix in the PR works for you (I guess it does now?) then I am just going to merge it.

Thank you
Jan

@domdomegg
Copy link
Contributor Author

domdomegg commented Jan 11, 2023

Hi Jan,

Yes, the fix in my PR works for me.

Adam

@jvail jvail closed this as completed in #38 Jan 11, 2023
@laszlojakab
Copy link

Could you please release this fix to npm?

@jvail
Copy link
Owner

jvail commented Dec 8, 2023

Could you please release this fix to npm?

Yes, good idea. I'll try to get it done over the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants