Closed SimonSiefke closed 2 years ago
The export default doesn't seem to work correctly with esm and throws an error: TypeError: Cannot read property 'minLength' of undefined
TypeError: Cannot read property 'minLength' of undefined
Reproduction Repo: https://github.com/SimonSiefke/ow-bug
import ow from 'ow'; const unicorn = input => { ow(input, ow.string.minLength(5)); }; unicorn(3); // throws TypeError: Cannot read property 'minLength' of undefined
For now i am using this workaround (which is a bit ugly):
import owDefault from "ow"; // @ts-ignore const ow = /** @type {import('ow').default} */ (owDefault.default); const unicorn = (input) => { ow(input, ow.string.minLength(5)); }; unicorn(3); // works as expected
I have the same problem with v0.27.0
I have the same problem.
import ow from 'ow'; ow.array.ofType(...);
TypeError: Cannot read property 'ofType' of undefined
The export default doesn't seem to work correctly with esm and throws an error:
TypeError: Cannot read property 'minLength' of undefined
Reproduction Repo: https://github.com/SimonSiefke/ow-bug
For now i am using this workaround (which is a bit ugly):