Skip to content

Commit

Permalink
fix [email protected] errors, closes #656, closes #647 (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Aug 29, 2022
1 parent 63eea02 commit 9e8ef0e
Show file tree
Hide file tree
Showing 28 changed files with 11,233 additions and 165 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
**Note**: Gaps between patch versions are faulty/broken releases.
**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice.

# 2.2.18

- **Bug Fix**
- fix `[email protected]` errors, closes #656, closes #647 (@gcanti)

# 2.2.17

- **Bug Fix**
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Codec.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ Added in v2.2.3
**Signature**

```ts
export declare function literal<A extends readonly [Literal, ...Array<Literal>]>(
export declare function literal<A extends readonly [L, ...ReadonlyArray<L>], L extends S.Literal = S.Literal>(
...values: A
): Codec<unknown, A[number], A[number]>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Decoder.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ Added in v2.2.8
**Signature**
```ts
export declare const literal: <A extends readonly [S.Literal, ...S.Literal[]]>(
export declare const literal: <A extends readonly [L, ...L[]], L extends S.Literal = S.Literal>(
...values: A
) => Decoder<unknown, A[number]>
```
Expand Down
12 changes: 7 additions & 5 deletions docs/modules/Guard.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ Added in v2.2.0
**Signature**
```ts
export declare const literal: <A extends readonly [Literal, ...Literal[]]>(...values: A) => Guard<unknown, A[number]>
export declare const literal: <A extends readonly [L, ...L[]], L extends S.Literal = S.Literal>(
...values: A
) => Guard<unknown, A[number]>
```
Added in v2.2.0
Expand All @@ -267,7 +269,7 @@ Added in v2.2.0
**Signature**
```ts
export declare const Schemable: Schemable1<'io-ts/Guard'>
export declare const Schemable: S.Schemable1<'io-ts/Guard'>
```
Added in v2.2.8
Expand Down Expand Up @@ -297,7 +299,7 @@ Added in v2.2.0
**Signature**
```ts
export declare const WithRefine: WithRefine1<'io-ts/Guard'>
export declare const WithRefine: S.WithRefine1<'io-ts/Guard'>
```
Added in v2.2.8
Expand All @@ -307,7 +309,7 @@ Added in v2.2.8
**Signature**
```ts
export declare const WithUnion: WithUnion1<'io-ts/Guard'>
export declare const WithUnion: S.WithUnion1<'io-ts/Guard'>
```
Added in v2.2.8
Expand All @@ -317,7 +319,7 @@ Added in v2.2.8
**Signature**
```ts
export declare const WithUnknownContainers: WithUnknownContainers1<'io-ts/Guard'>
export declare const WithUnknownContainers: S.WithUnknownContainers1<'io-ts/Guard'>
```
Added in v2.2.8
Expand Down
6 changes: 4 additions & 2 deletions docs/modules/Kleisli.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,10 @@ Added in v2.2.7
export declare function literal<M extends URIS2, E>(
M: MonadThrow2C<M, E>
): <I>(
onError: (i: I, values: readonly [Literal, ...Array<Literal>]) => E
) => <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kleisli<M, I, E, A[number]>
onError: (i: I, values: readonly [S.Literal, ...ReadonlyArray<S.Literal>]) => E
) => <A extends readonly [L, ...ReadonlyArray<L>], L extends S.Literal = S.Literal>(
...values: A
) => Kleisli<M, I, E, A[number]>
```

Added in v2.2.7
Expand Down
12 changes: 9 additions & 3 deletions docs/modules/Schemable.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ Added in v2.2.0
```ts
export interface Schemable<S> {
readonly URI: S
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => HKT<S, A[number]>
readonly literal: <A extends readonly [L, ...ReadonlyArray<L>], L extends Literal = Literal>(
...values: A
) => HKT<S, A[number]>
readonly string: HKT<S, string>
readonly number: HKT<S, number>
readonly boolean: HKT<S, boolean>
Expand Down Expand Up @@ -86,7 +88,9 @@ Added in v2.2.3
```ts
export interface Schemable1<S extends URIS> {
readonly URI: S
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind<S, A[number]>
readonly literal: <A extends readonly [L, ...ReadonlyArray<L>], L extends Literal = Literal>(
...values: A
) => Kind<S, A[number]>
readonly string: Kind<S, string>
readonly number: Kind<S, number>
readonly boolean: Kind<S, boolean>
Expand Down Expand Up @@ -116,7 +120,9 @@ Added in v2.2.3
```ts
export interface Schemable2C<S extends URIS2, E> {
readonly URI: S
readonly literal: <A extends readonly [Literal, ...Array<Literal>]>(...values: A) => Kind2<S, E, A[number]>
readonly literal: <A extends readonly [L, ...ReadonlyArray<L>], L extends Literal = Literal>(
...values: A
) => Kind2<S, E, A[number]>
readonly string: Kind2<S, E, string>
readonly number: Kind2<S, E, number>
readonly boolean: Kind2<S, E, boolean>
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/TaskDecoder.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ Added in v2.2.8
**Signature**
```ts
export declare const literal: <A extends readonly [S.Literal, ...S.Literal[]]>(
export declare const literal: <A extends readonly [L, ...L[]], L extends S.Literal = S.Literal>(
...values: A
) => TaskDecoder<unknown, A[number]>
```
Expand Down
4 changes: 3 additions & 1 deletion docs/modules/Type.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ Added in v2.2.3
**Signature**
```ts
export declare const literal: <A extends readonly [S.Literal, ...S.Literal[]]>(...values: A) => Type<A[number]>
export declare const literal: <A extends readonly [L, ...L[]], L extends S.Literal = S.Literal>(
...values: A
) => Type<A[number]>
```
Added in v2.2.3
Expand Down
30 changes: 3 additions & 27 deletions docs/modules/index.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,39 +650,15 @@ Keeps the codec "kind".
```ts
export declare function alias<A, O, P, I>(
codec: PartialType<P, A, O, I>
): <
// tslint:disable-next-line: deprecation
AA extends Exact<A, AA>,
// tslint:disable-next-line: deprecation
OO extends Exact<O, OO> = O,
// tslint:disable-next-line: deprecation
PP extends Exact<P, PP> = P,
II extends I = I
>() => PartialType<PP, AA, OO, II>
): <AA extends A, OO extends O = O, PP extends P = P, II extends I = I>() => PartialType<PP, AA, OO, II>
export declare function alias<A, O, P, I>(
// tslint:disable-next-line: deprecation
codec: StrictType<P, A, O, I>
): <
// tslint:disable-next-line: deprecation
AA extends Exact<A, AA>,
// tslint:disable-next-line: deprecation
OO extends Exact<O, OO> = O,
// tslint:disable-next-line: deprecation
PP extends Exact<P, PP> = P,
II extends I = I
>() => // tslint:disable-next-line: deprecation
): <AA extends A, OO extends O = O, PP extends P = P, II extends I = I>() => // tslint:disable-next-line: deprecation
StrictType<PP, AA, OO, II>
export declare function alias<A, O, P, I>(
codec: InterfaceType<P, A, O, I>
): <
// tslint:disable-next-line: deprecation
AA extends Exact<A, AA>,
// tslint:disable-next-line: deprecation
OO extends Exact<O, OO> = O,
// tslint:disable-next-line: deprecation
PP extends Exact<P, PP> = P,
II extends I = I
>() => InterfaceType<PP, AA, OO, II>
): <AA extends A, OO extends O = O, PP extends P = P, II extends I = I>() => InterfaceType<PP, AA, OO, II>
```
Added in v1.1.0
Expand Down
42 changes: 42 additions & 0 deletions dtslint/ts3.5/Decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,48 @@ export type TypeOfNumberFromString = _.TypeOf<typeof NumberFromString>
// $ExpectType string
export type InputOfNumberFromString = _.InputOf<typeof NumberFromString>

//
// literal
//

// $ExpectType Decoder<unknown, "A">
_.literal('A')

// $ExpectType Decoder<unknown, "A" | "B">
_.literal('A', 'B')

// $ExpectType Decoder<unknown, "A">
_.union(_.literal('A'))

// $ExpectType Decoder<unknown, "A" | "B">
_.union(_.literal('A'), _.literal('B'))

// $ExpectType Decoder<unknown, { a: "A"; }>
_.struct({
a: _.literal('A')
})

// $ExpectType Decoder<unknown, { a: "A"; } & { b: "B"; }>
pipe(
_.struct({
a: _.literal('A')
}),
_.intersect(
_.struct({
b: _.literal('B')
})
)
)

import * as S from '../../src/Schemable'
declare const literal: <A extends readonly [L, ...ReadonlyArray<L>], L extends S.Literal = S.Literal>(
...values: A
) => _.Decoder<unknown, A[number]>
// $ExpectType Decoder<unknown, { a: "A"; }>
_.struct({
a: literal('A')
})

//
// fromStruct
//
Expand Down
2 changes: 2 additions & 0 deletions dtslint/ts3.5/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type OfTest = TypeOf<typeof OfTest> // $ExpectType { a: string; b: { c: n
make((S) => S.literal())
make((S) => S.literal('a')) // $ExpectType Schema<"a">
make((S) => S.literal('a', 'b', null)) // $ExpectType Schema<"a" | "b" | null>
make((S) => S.literal<['a']>('a')) // $ExpectType Schema<"a">

//
// string
Expand Down Expand Up @@ -57,6 +58,7 @@ make((S) => S.nullable(S.string)) // $ExpectType Schema<string | null>
//

make((S) => S.struct({ a: S.string, b: S.struct({ c: S.number }) })) // $ExpectType Schema<{ a: string; b: { c: number; }; }>
make((S) => S.struct({ a: S.literal('a') })) // $ExpectType Schema<{ a: "a"; }>

//
// partial
Expand Down
4 changes: 2 additions & 2 deletions dtslint/ts3.5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ type AliasTest2 = t.OutputOf<typeof C5>['a'] // $ExpectType string
type AliasTest3 = t.OutputOf<typeof C5>['b'] // $ExpectType string
// $ExpectError
const C6 = t.alias(C1)<C1, C1>()
// $ExpectError
const C7 = t.alias(C1)<C1WithAdditionalProp, C1O>()
// // $ExpectError
// bug fix: 647 const C7 = t.alias(C1)<C1WithAdditionalProp, C1O>()
const C8 = t.alias(C1)<C1, C1O>()
type AliasTest4 = t.TypeOf<typeof C8> // $ExpectType C1
type AliasTest5 = t.OutputOf<typeof C8> // $ExpectType C1O
Expand Down
Loading

0 comments on commit 9e8ef0e

Please sign in to comment.