diff --git a/greenlet.js b/greenlet.js index bcf3493..45896e7 100644 --- a/greenlet.js +++ b/greenlet.js @@ -3,6 +3,12 @@ * @public */ export default function greenlet(asyncFunction) { + // Type checking the argument. + const type = typeof asyncFunction; + if (type !== 'function') { + throw new TypeError('Expected function but recevied ' + type); + } + // A simple counter is used to generate worker-global unique ID's for RPC: let currentId = 0;