developit / greenlet

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

ESLint/TypeScript: Any way to mark the function as external/scope-less? #56

Open fregante opened 3 years ago

fregante commented 3 years ago

This piece of code passes every static analyzer, ESLint and TS because they don't know that the arrow function is run in a different context:

import greenlet from 'greenlet'

const myFavNumber = 43;

const getFav = greenlet( async () => {
    return myFavNumber
});

Are you aware of any way to mark the function in a way that linters/parsers know myFavNumber is not defined in the function?