Repository: gcanti/io-ts-types (ts)

Issue:
Export all types from index
## 🚀 Feature request

I'd like to be able to import `io-ts-types` once and have all the codecs/combinators, like Ramda. AFAIK right now each thing must be imported from its own file.

### Current Behavior

```typescript
import { fromNullable } from 'io-ts-types/lib/fromNullable';
import { DateFromISOString } from 'io-ts-types/lib/DateFromISOString';
```

### Desired Behavior

```typescript
import { fromNullable, DateFromISOString } from 'io-ts-types/lib';
```

### Suggested Solution

Add index files with re-exports.

### Who does this impact? Who is this for?

All users except those who import individual files for bundle size reasons.

Bundle size is not a concern on NodeJS, where `io-ts` can be used for validation.

### Describe alternatives you've considered

It would be ideal to just `import 'io-ts-types'`. Not sure if that's possible.

### Your environment

<!-- PLEASE FILL THIS OUT -->

| Software    | Version(s) |
| ----------- | ---------- |
| fp-ts       |    2.6.1   |
| io-ts       |    2.2.3   |
| io-ts-types |    0.5.6   |
| TypeScript  |    3.9.3   |


Pull request description:
feat: export each module's exports from the library entrypoint
I noticed that `package.json` updated automatically.
Would you like to keep this change or have it reversed?

Do we need tests to check that `index.ts` is exporting the correct modules?
If so, I'd recommend that the tests import their from `index.ts` rather than from the source.

closes #129 


Patch:
diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md
index 9692594..56e579a 100644
--- a/docs/modules/index.ts.md
+++ b/docs/modules/index.ts.md
@@ -6,7 +6,7 @@ parent: Modules
 
 # index overview
 
-Added in v0.5.0
+Added in v0.5.7
 
 ---
 
diff --git a/dtslint/ts3.5/index.ts b/dtslint/ts3.5/index.ts
index 9bff6bc..d4d896e 100644
--- a/dtslint/ts3.5/index.ts
+++ b/dtslint/ts3.5/index.ts
@@ -1,11 +1,6 @@
 import { ordNumber } from 'fp-ts/lib/Ord'
 import * as t from 'io-ts'
-import { either } from '../../src/either'
-import { nonEmptyArray } from '../../src/nonEmptyArray'
-import { NumberFromString } from '../../src/NumberFromString'
-import { option } from '../../src/option'
-import { optionFromNullable } from '../../src/optionFromNullable'
-import { setFromArray } from '../../src/setFromArray'
+import { either, nonEmptyArray, NumberFromString, option, optionFromNullable, setFromArray } from '../../src'
 
 //
 // either
diff --git a/dtslint/ts3.5/readonlyNonEmptyArray.ts b/dtslint/ts3.5/readonlyNonEmptyArray.ts
index 61585bf..4727a4e 100644
--- a/dtslint/ts3.5/readonlyNonEmptyArray.ts
+++ b/dtslint/ts3.5/readonlyNonEmptyArray.ts
@@ -1,5 +1,5 @@
 import * as t from 'io-ts'
-import { readonlyNonEmptyArray } from '../../src/readonlyNonEmptyArray'
+import { readonlyNonEmptyArray } from '../../src'
 
 const RNAS = readonlyNonEmptyArray(t.string)
 
diff --git a/dtslint/ts3.5/readonlySetFromArray.ts b/dtslint/ts3.5/readonlySetFromArray.ts
index cb9ce1e..a454baf 100644
--- a/dtslint/ts3.5/readonlySetFromArray.ts
+++ b/dtslint/ts3.5/readonlySetFromArray.ts
@@ -1,5 +1,5 @@
 import * as t from 'io-ts'
-import { readonlySetFromArray } from '../../src/readonlySetFromArray'
+import { readonlySetFromArray } from '../../src'
 import { ordString } from 'fp-ts/lib/Ord'
 
 const RS = readonlySetFromArray(t.string, ordString)
diff --git a/package-lock.json b/package-lock.json
index 5e3d2e5..54bfa98 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "io-ts-types",
-  "version": "0.5.6",
+  "version": "0.5.7",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/src/index.ts b/src/index.ts
index 42e5f13..22c0a07 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,129 @@
 /**
- * @since 0.5.0
+ * @since 0.5.7
  */
-export {}
+export * from './mapOutput'
+
+/**
+ * @since 0.5.7
+ */
+export * from './NonEmptyString'
+
+/**
+ * @since 0.5.7
+ */
+export * from './nonEmptyArray'
+
+/**
+ * @since 0.5.7
+ */
+export * from './readonlySetFromArray'
+
+/**
+ * @since 0.5.7
+ */
+export * from './fromRefinement'
+
+/**
+ * @since 0.5.7
+ */
+export * from './date'
+
+/**
+ * @since 0.5.7
+ */
+export * from './fromNewtype'
+
+/**
+ * @since 0.5.7
+ */
+export * from './optionFromNullable'
+
+/**
+ * @since 0.5.7
+ */
+export * from './DateFromISOString'
+
+/**
+ * @since 0.5.7
+ */
+export * from './readonlyNonEmptyArray'
+
+/**
+ * @since 0.5.7
+ */
+export * from './clone'
+
+/**
+ * @since 0.5.7
+ */
+export * from './DateFromNumber'
+
+/**
+ * @since 0.5.7
+ */
+export * from './withFallback'
+
+/**
+ * @since 0.5.7
+ */
+export * from './UUID'
+
+/**
+ * @since 0.5.7
+ */
+export * from './fromNullable'
+
+/**
+ * @since 0.5.7
+ */
+export * from './BooleanFromString'
+
+/**
+ * @since 0.5.7
+ */
+export * from './withMessage'
+
+/**
+ * @since 0.5.7
+ */
+export * from './withValidate'
+
+/**
+ * @since 0.5.7
+ */
+export * from './getLenses'
+
+/**
+ * @since 0.5.7
+ */
+export * from './regexp'
+
+/**
+ * @since 0.5.7
+ */
+export * from './option'
+
+/**
+ * @since 0.5.7
+ */
+export * from './DateFromUnixTime'
+
+/**
+ * @since 0.5.7
+ */
+export * from './NumberFromString'
+
+/**
+ * @since 0.5.7
+ */
+export * from './setFromArray'
+
+/**
+ * @since 0.5.7
+ */
+export * from './IntFromString'
+
+/**
+ * @since 0.5.7
+ */
+export * from './either'


Test patch:
diff --git a/test/BooleanFromString.ts b/test/BooleanFromString.ts
index 9e63905..f946789 100644
--- a/test/BooleanFromString.ts
+++ b/test/BooleanFromString.ts
@@ -1,4 +1,4 @@
-import { BooleanFromString } from '../src/BooleanFromString'
+import { BooleanFromString } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 
 describe('BooleanFromString', () => {
diff --git a/test/DateFromISOString.ts b/test/DateFromISOString.ts
index 0593234..5805bcd 100644
--- a/test/DateFromISOString.ts
+++ b/test/DateFromISOString.ts
@@ -1,5 +1,5 @@
 import * as assert from 'assert'
-import { DateFromISOString } from '../src/DateFromISOString'
+import { DateFromISOString } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 
 const d = new Date(1973, 10, 30)
diff --git a/test/DateFromNumber.ts b/test/DateFromNumber.ts
index f5ea586..d5fa208 100644
--- a/test/DateFromNumber.ts
+++ b/test/DateFromNumber.ts
@@ -1,5 +1,5 @@
 import * as assert from 'assert'
-import { DateFromNumber } from '../src/DateFromNumber'
+import { DateFromNumber } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 import { either } from 'fp-ts/lib/Either'
 
diff --git a/test/DateFromUnixTime.ts b/test/DateFromUnixTime.ts
index 1ab3eda..a30a74e 100644
--- a/test/DateFromUnixTime.ts
+++ b/test/DateFromUnixTime.ts
@@ -1,5 +1,5 @@
 import * as assert from 'assert'
-import { DateFromUnixTime } from '../src/DateFromUnixTime'
+import { DateFromUnixTime } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 import { either } from 'fp-ts/lib/Either'
 
diff --git a/test/IntFromString.ts b/test/IntFromString.ts
index 335ae71..d2f89cf 100644
--- a/test/IntFromString.ts
+++ b/test/IntFromString.ts
@@ -1,4 +1,4 @@
-import { IntFromString } from '../src/IntFromString'
+import { IntFromString } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 import * as t from 'io-ts'
 
diff --git a/test/NonEmptyString.ts b/test/NonEmptyString.ts
index 224cead..92f7680 100644
--- a/test/NonEmptyString.ts
+++ b/test/NonEmptyString.ts
@@ -1,5 +1,5 @@
 import * as assert from 'assert'
-import { NonEmptyString } from '../src/NonEmptyString'
+import { NonEmptyString } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 
 describe('NonEmptyString', () => {
diff --git a/test/NumberFromString.ts b/test/NumberFromString.ts
index de43b95..45838a3 100644
--- a/test/NumberFromString.ts
+++ b/test/NumberFromString.ts
@@ -1,5 +1,5 @@
 import { assertSuccess, assertFailure } from './helpers'
-import { NumberFromString } from '../src/NumberFromString'
+import { NumberFromString } from '../src'
 
 describe('NumberFromString', () => {
   it('decode', () => {
diff --git a/test/UUID.ts b/test/UUID.ts
index cb67313..1c99404 100644
--- a/test/UUID.ts
+++ b/test/UUID.ts
@@ -1,4 +1,4 @@
-import { UUID } from '../src/UUID'
+import { UUID } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 
 describe('UUID', () => {
diff --git a/test/date.ts b/test/date.ts
index 61f21cf..0d866a1 100644
--- a/test/date.ts
+++ b/test/date.ts
@@ -1,4 +1,4 @@
-import { date } from '../src/date'
+import { date } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 
 describe('Date', () => {
diff --git a/test/either.ts b/test/either.ts
index 4cb110c..4f4d06a 100644
--- a/test/either.ts
+++ b/test/either.ts
@@ -1,7 +1,7 @@
 import * as assert from 'assert'
 import { left, right } from 'fp-ts/lib/Either'
 import * as t from 'io-ts'
-import { either } from '../src/either'
+import { either } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 
 describe('either', () => {
diff --git a/test/fromNewtype.ts b/test/fromNewtype.ts
index 4a71b40..b8b8e4e 100644
--- a/test/fromNewtype.ts
+++ b/test/fromNewtype.ts
@@ -1,6 +1,6 @@
 import * as assert from 'assert'
 import * as t from 'io-ts'
-import { fromNewtype } from '../src/fromNewtype'
+import { fromNewtype } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 import { Newtype, iso } from 'newtype-ts'
 
diff --git a/test/fromNullable.ts b/test/fromNullable.ts
index 6ac857d..fd2fc85 100644
--- a/test/fromNullable.ts
+++ b/test/fromNullable.ts
@@ -1,6 +1,6 @@
 import * as assert from 'assert'
 import * as t from 'io-ts'
-import { fromNullable } from '../src/fromNullable'
+import { fromNullable } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 
 it('fromNullable', () => {
diff --git a/test/getLenses.ts b/test/getLenses.ts
index cd74eaf..fd9efd0 100644
--- a/test/getLenses.ts
+++ b/test/getLenses.ts
@@ -1,6 +1,6 @@
 import * as assert from 'assert'
 import * as t from 'io-ts'
-import { getLenses } from '../src/getLenses'
+import { getLenses } from '../src'
 import { Lens } from 'monocle-ts'
 
 describe('getLenses', () => {
diff --git a/test/mapOutput.ts b/test/mapOutput.ts
index 5977918..28b3720 100644
--- a/test/mapOutput.ts
+++ b/test/mapOutput.ts
@@ -1,6 +1,6 @@
 import * as assert from 'assert'
 import * as t from 'io-ts'
-import { mapOutput } from '../src/mapOutput'
+import { mapOutput } from '../src'
 
 describe('mapOutput', () => {
   it('name', () => {
diff --git a/test/nonEmptyArray.ts b/test/nonEmptyArray.ts
index 5cbfd9b..ae34152 100644
--- a/test/nonEmptyArray.ts
+++ b/test/nonEmptyArray.ts
@@ -1,4 +1,4 @@
-import { nonEmptyArray } from '../src/nonEmptyArray'
+import { nonEmptyArray } from '../src'
 import * as t from 'io-ts'
 import { cons } from 'fp-ts/lib/NonEmptyArray'
 import * as assert from 'assert'
diff --git a/test/option.ts b/test/option.ts
index b545507..d458651 100644
--- a/test/option.ts
+++ b/test/option.ts
@@ -1,8 +1,8 @@
 import * as assert from 'assert'
 import { none, some } from 'fp-ts/lib/Option'
 import * as t from 'io-ts'
-import { NumberFromString } from '../src/NumberFromString'
-import { option } from '../src/option'
+import { NumberFromString } from '../src'
+import { option } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 
 describe('option', () => {
diff --git a/test/optionFromNullable.ts b/test/optionFromNullable.ts
index ccc69c5..483b669 100644
--- a/test/optionFromNullable.ts
+++ b/test/optionFromNullable.ts
@@ -1,8 +1,8 @@
 import { assertSuccess, assertFailure } from './helpers'
-import { optionFromNullable } from '../src/optionFromNullable'
+import { optionFromNullable } from '../src'
 import * as t from 'io-ts'
 import * as assert from 'assert'
-import { NumberFromString } from '../src/NumberFromString'
+import { NumberFromString } from '../src'
 import { none, some } from 'fp-ts/lib/Option'
 
 describe('optionFromNullable', () => {
diff --git a/test/readonlyNonEmptyArray.ts b/test/readonlyNonEmptyArray.ts
index e542520..56b402f 100644
--- a/test/readonlyNonEmptyArray.ts
+++ b/test/readonlyNonEmptyArray.ts
@@ -1,7 +1,7 @@
 import * as assert from 'assert'
 import { cons } from 'fp-ts/lib/NonEmptyArray'
 import * as t from 'io-ts'
-import { readonlyNonEmptyArray } from '../src/readonlyNonEmptyArray'
+import { readonlyNonEmptyArray } from '../src'
 import { assertFailure, assertSuccess } from './helpers'
 
 describe('readonlyNonEmptyArray', () => {
diff --git a/test/readonlySetFromArray.ts b/test/readonlySetFromArray.ts
index 97c16ca..018984d 100644
--- a/test/readonlySetFromArray.ts
+++ b/test/readonlySetFromArray.ts
@@ -1,4 +1,4 @@
-import { readonlySetFromArray } from '../src/readonlySetFromArray'
+import { readonlySetFromArray } from '../src'
 import * as t from 'io-ts'
 import * as assert from 'assert'
 import { assertFailure, assertSuccess } from './helpers'
diff --git a/test/regexp.ts b/test/regexp.ts
index a4345d2..d0b4a48 100644
--- a/test/regexp.ts
+++ b/test/regexp.ts
@@ -1,4 +1,4 @@
-import { regexp } from '../src/regexp'
+import { regexp } from '../src'
 import { assertSuccess, assertFailure } from './helpers'
 
 describe('RegExp', () => {
diff --git a/test/setFromArray.ts b/test/setFromArray.ts
index c336a12..7c36319 100644
--- a/test/setFromArray.ts
+++ b/test/setFromArray.ts
@@ -1,4 +1,4 @@
-import { setFromArray } from '../src/setFromArray'
+import { setFromArray } from '../src'
 import * as t from 'io-ts'
 import * as assert from 'assert'
 import { assertFailure, assertSuccess } from './helpers'
diff --git a/test/withFallback.ts b/test/withFallback.ts
index 97b29c3..b6f43de 100644
--- a/test/withFallback.ts
+++ b/test/withFallback.ts
@@ -1,6 +1,6 @@
 import * as assert from 'assert'
 import * as t from 'io-ts'
-import { withFallback } from '../src/withFallback'
+import { withFallback } from '../src'
 import { assertSuccess } from './helpers'
 
 describe('withFallback', () => {
diff --git a/test/withMessage.ts b/test/withMessage.ts
index 5c84a0f..6a7a5db 100644
--- a/test/withMessage.ts
+++ b/test/withMessage.ts
@@ -1,6 +1,6 @@
 import * as t from 'io-ts'
 import { assertFailure } from './helpers'
-import { withMessage } from '../src/withMessage'
+import { withMessage } from '../src'
 
 describe('withMessage', () => {
   it('should set the error message', () => {