Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug with esm #215

Closed
SimonSiefke opened this issue Jul 7, 2021 · 2 comments · Fixed by #225
Closed

bug with esm #215

SimonSiefke opened this issue Jul 7, 2021 · 2 comments · Fixed by #225

Comments

@SimonSiefke
Copy link
Contributor

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

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
@marliotto
Copy link

I have the same problem with v0.27.0

@HaolinHom
Copy link

HaolinHom commented Aug 23, 2021

I have the same problem.

import ow from 'ow';

ow.array.ofType(...);

TypeError: Cannot read property 'ofType' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants