developit / greenlet

🦎 Move an async function into its own thread.
https://npm.im/greenlet
4.67k stars 100 forks source link

Synchronous functions broken in TypeScript #44

Closed DCtheTall closed 4 years ago

DCtheTall commented 4 years ago

Trying to compile

import greenlet from 'greenlet';

const f = greenlet((foo: string) => foo);

Results in the following error

Argument of type '(foo: string) => string' is not assignable to parameter of type 'AsyncFunction<{}>'

I'd be happy to supply a PR with a fix!

TypeScript version: 3.3.4 greenlet version: 1.1.0