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

Types do not include Promise<> #43

Open
chrisvander opened this issue Mar 12, 2024 · 2 comments
Open

Types do not include Promise<> #43

chrisvander opened this issue Mar 12, 2024 · 2 comments

Comments

@chrisvander
Copy link

Making use of this package in a TypeScript project, inside of a WebWorker. At import, the GLPK type does not indicate it's a promise, nor does the result of glpk.solve, so at the moment I am typecasting to unknown and then the Promise<> type. Could you fix this?

@jvail
Copy link
Owner

jvail commented Mar 15, 2024

Would you like to propose a change or file a PR? I do not have a browser ts project where I import glpk.js. Also I am not sure if there should be an index.d.ts file and then how to share types with glpk.d.ts...

@RaenonX
Copy link

RaenonX commented Feb 16, 2025

Would you like to propose a change or file a PR? I do not have a browser ts project where I import glpk.js. Also I am not sure if there should be an index.d.ts file and then how to share types with glpk.d.ts...

Encountering this issue as well:
I am not sure how / why would browser promisify it while node.js doesn't, but if possible, maybe split the constructing part to either promisifying or not? So for example:

Server-side:

import {makeGlpk} from 'glpk.js';

const glpkInstance = makeGlpk();

or (default import, current behavior)

import glpk from 'glpk.js';

const glpkInstance = glpk();

Client-side:

import {makeGlpkPromise} from 'glpk.js';

const glpkInstance = await makeGlpkPromise();

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

No branches or pull requests

3 participants