sindresorhus / ow

Function argument validation for humans
https://sindresorhus.com/ow/
MIT License
3.8k stars 105 forks source link

"rewrite" in esm format #207

Closed nnmrts closed 3 years ago

nnmrts commented 3 years ago

This basically converts all the typescript stuff to "normal" js. The motivation for this was issue #196 and the fact you have to const { default: ow } = require("ow"); or import { default as ow } from "ow";

nnmrts commented 3 years ago

Converted this to a draft because it still has "fork-specific" stuff in there.

mmkal commented 3 years ago

Um... can we please not kill the typescript support for this type-validation library?

sindresorhus commented 3 years ago

We are not going to convert back to JS.

sindresorhus commented 3 years ago

We do plan to move to ESM output at the end of April: https://github.com/sindresorhus/meta/discussions/15

nnmrts commented 3 years ago

@sindresorhus I know that you will move to ESM, that's why I did this (draft), I just didn't know it's only about the output and that you're planning to transpile code to ESM instead of just writing it in...ESM. I don't really understand the value of TypeScript here, because the validation itself, AFAIK, isn't typescript dependent. Also, TypeScript "support" won't be "killed" by this, like @mmkal suggested. TypeScript users could still use this in the exact same way.

But whatever, I'll just use my fork then, since I would still have to import { default as ow } from "ow"; otherwise. (See #196)

sindresorhus commented 3 years ago

I don't really understand the value of TypeScript here, because the validation itself, AFAIK, isn't typescript dependent.

This package is strongly-typed for TypeScript users, which makes usage in TypeScript much better. It also benefits non-TS users in the sense that we can make changes and refactor more confidently because of types, which leads to fewer bugs in general.

Also, TypeScript "support" won't be "killed" by this, like @mmkal suggested. TypeScript users could still use this in the exact same way.

Yes, it practically will. No TS users will want to use this without types.

nnmrts commented 3 years ago

Alright, I obviously misunderstood how Typescript is used here, sorry.