alexmojaki / pyodide-worker-runner

MIT License
23 stars 2 forks source link

Fix building types #33

Closed jorg-vr closed 11 months ago

jorg-vr commented 11 months ago

This pr fixes the building of types.

The issue was typescript breaking because it autodetected the return type of the function to be Promise<PyodideAPI>. This returned an error as PyodideAPI is not exported by pyodide and thus cannot be used as the type of an exported function.

It is fixed by explicitly specifying the return type.

The resulting code is the same as pyodide defines:

export declare type PyodideInterface = typeof PyodideAPI;

Closes https://github.com/alexmojaki/pyodide-worker-runner/issues/32

alexmojaki commented 11 months ago

Thank you so much, I don't know if I would have been able to figure this out! I didn't know this was a problem I had to worry about, why doesn't it complain about TS errors when building??? Anyway, I released 1.3.4.