Skip to content

Commit

Permalink
fix dtslint
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Jul 7, 2024
1 parent 6c28bc4 commit 8a83bd3
Show file tree
Hide file tree
Showing 52 changed files with 656 additions and 680 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"no-unused-vars": "off",
Expand Down
8 changes: 4 additions & 4 deletions dtslint/ts3.5/Applicative.ts → dtslint/Applicative.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as _ from '../../src/Applicative'
import * as E from '../../src/Either'
import * as S from '../../src/Semigroup'
import * as R from '../../src/Reader'
import * as _ from '../src/Applicative'
import * as E from '../src/Either'
import * as R from '../src/Reader'
import * as S from '../src/Semigroup'

//
// getApplicativeComposition
Expand Down
43 changes: 21 additions & 22 deletions dtslint/ts3.5/Apply.ts → dtslint/Apply.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import * as _ from '../../src/Apply'
import { URIS, Kind } from '../../src/HKT'
import * as RTE from '../../src/ReaderTaskEither'
import * as E from '../../src/Either'
import { pipe } from '../../src/function'
import * as Fu from '../../src/Functor'
import * as _ from '../src/Apply'
import * as E from '../src/Either'
import { pipe } from '../src/function'
import * as Fu from '../src/Functor'
import { Kind, URIS } from '../src/HKT'
import * as RTE from '../src/ReaderTaskEither'

//
// apS
//

export const apS = <F extends URIS>(F: _.Apply1<F>) => (
s: Kind<F, string>,
n: Kind<F, number>
): Kind<F, { s: string; n: number }> => {
const apS = _.apS(F)
const bindTo = Fu.bindTo(F)
return pipe(s, bindTo('s'), apS('n', n))
}
export const apS =
<F extends URIS>(F: _.Apply1<F>) =>
(s: Kind<F, string>, n: Kind<F, number>): Kind<F, { s: string; n: number }> => {
const apS = _.apS(F)
const bindTo = Fu.bindTo(F)
return pipe(s, bindTo('s'), apS('n', n))
}

//
// sequenceS
Expand All @@ -35,9 +34,9 @@ declare const sequenceS4: E.Either<boolean, void>

const sequenceSf1 = _.sequenceS(E.either)

// $ExpectError
// @ts-expect-error
sequenceSf1({})
// $ExpectError
// @ts-expect-error
sequenceSf1({ sequenceS1, sequenceS4 })

sequenceSf1({ sequenceS1, sequenceS2, sequenceS3 }) // $ExpectType Either<string, { sequenceS1: number; sequenceS2: string; sequenceS3: boolean; }>
Expand All @@ -49,9 +48,9 @@ declare const sequenceS7: RTE.ReaderTaskEither<{ a: number }, string, boolean>
declare const sequenceS8: RTE.ReaderTaskEither<{ a: number }, boolean, void>
declare const sequenceS9: RTE.ReaderTaskEither<{ a: string }, string, void>

// $ExpectError
// @ts-expect-error
sequenceSf2({ sequenceS5, sequenceS8 })
// $ExpectError
// @ts-expect-error
sequenceSf2({ sequenceS5, sequenceS9 })

sequenceSf2({ sequenceS5, sequenceS6, sequenceS7 }) // $ExpectType ReaderTaskEither<{ a: number; }, string, { sequenceS5: number; sequenceS6: string; sequenceS7: boolean; }>
Expand All @@ -68,18 +67,18 @@ sequenceSf2({ sequenceS5, sequenceS6, sequenceS7 }) // $ExpectType ReaderTaskEit

const sequenceTf1 = _.sequenceT(E.either)

// $ExpectError
// @ts-expect-error
sequenceTf1([])
// $ExpectError
// @ts-expect-error
sequenceTf1(sequenceS1, sequenceS4)

sequenceTf1(sequenceS1, sequenceS2, sequenceS3) // $ExpectType Either<string, [number, string, boolean]>

const sequenceTf2 = _.sequenceT(RTE.readerTaskEither)

// $ExpectError
// @ts-expect-error
sequenceTf2(sequenceS5, sequenceS8)
// $ExpectError
// @ts-expect-error
sequenceTf2(sequenceS5, sequenceS9)

sequenceTf2(sequenceS5, sequenceS6, sequenceS7) // $ExpectType ReaderTaskEither<{ a: number; }, string, [number, string, boolean]>
22 changes: 11 additions & 11 deletions dtslint/ts3.5/Array.ts → dtslint/Array.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as _ from '../../src/Array'
import { identity, pipe } from '../../src/function'
import * as N from '../../src/number'
import { Ord } from '../../src/Ord'
import * as E from '../../src/Either'
import * as _ from '../src/Array'
import * as E from '../src/Either'
import { identity, pipe } from '../src/function'
import * as N from '../src/number'
import { Ord } from '../src/Ord'

declare const us: Array<unknown>
declare const ns: Array<number>
Expand Down Expand Up @@ -177,7 +177,7 @@ pipe(
prns,
_.filter(
(
x // $ExpectType number
_x // $ExpectType number
) => true
)
)
Expand All @@ -195,8 +195,8 @@ pipe(
prns,
_.filterWithIndex(
(
i, // $ExpectType number
x // $ExpectType number
_i, // $ExpectType number
_x // $ExpectType number
) => true
)
)
Expand All @@ -216,7 +216,7 @@ pipe(
prns,
_.partition(
(
x // $ExpectType number
_x // $ExpectType number
) => true
)
)
Expand All @@ -236,8 +236,8 @@ pipe(
prns,
_.partitionWithIndex(
(
i, // $ExpectType number
x // $ExpectType number
_i, // $ExpectType number
_x // $ExpectType number
) => true
)
)
Expand Down
6 changes: 3 additions & 3 deletions dtslint/ts3.5/Console.ts → dtslint/Console.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as _ from '../../src/Console'
import { flow, pipe } from '../../src/function'
import * as TE from '../../src/TaskEither'
import * as _ from '../src/Console'
import { flow, pipe } from '../src/function'
import * as TE from '../src/TaskEither'

// $ExpectType TaskEither<never, string>
pipe(TE.right('a'), TE.chainFirst(flow(_.error, TE.fromIO)))
Expand Down
2 changes: 1 addition & 1 deletion dtslint/ts3.5/Const.ts → dtslint/Const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from '../../src/Const'
import * as _ from '../src/Const'

//
// contramap
Expand Down
14 changes: 7 additions & 7 deletions dtslint/ts3.5/Either.ts → dtslint/Either.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as _ from '../../src/Either'
import { pipe, flow, identity } from '../../src/function'
import * as RA from '../../src/ReadonlyArray'
import * as _ from '../src/Either'
import { flow, identity, pipe } from '../src/function'
import * as RA from '../src/ReadonlyArray'

//
// getOrElseW
Expand Down Expand Up @@ -122,7 +122,7 @@ pipe(
n,
_.fromPredicate(
(
n // $ExpectType number
_n // $ExpectType number
) => true,
() => false
)
Expand All @@ -147,7 +147,7 @@ pipe(
en,
_.filterOrElse(
(
n // $ExpectType number
_n // $ExpectType number
) => true,
() => false
)
Expand All @@ -157,5 +157,5 @@ pipe(
// exists
//

declare const es: _.Either<string, number>[]
const x = pipe(es, RA.filter(_.exists((n) => n > 0)))
declare const es: Array<_.Either<string, number>>
pipe(es, RA.filter(_.exists((n) => n > 0)))
8 changes: 4 additions & 4 deletions dtslint/ts3.5/Eq.ts → dtslint/Eq.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as _ from '../../src/Eq'
import * as S from '../../src/string'
import * as N from '../../src/number'
import * as B from '../../src/boolean'
import * as B from '../src/boolean'
import * as _ from '../src/Eq'
import * as N from '../src/number'
import * as S from '../src/string'

//
// struct
Expand Down
20 changes: 10 additions & 10 deletions dtslint/ts3.5/Functor.ts → dtslint/Functor.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import * as _ from '../../src/Functor'
import * as RA from '../../src/ReadonlyArray'
import * as E from '../../src/Either'
import * as RTE from '../../src/ReaderTaskEither'
import * as E from '../src/Either'
import * as _ from '../src/Functor'
import * as RTE from '../src/ReaderTaskEither'
import * as RA from '../src/ReadonlyArray'

// $ExpectType <A, B>(f: (a: A) => B) => (fa: readonly (readonly A[])[]) => readonly (readonly B[])[]
const F11 = _.map(RA.Functor, RA.Functor)
export const F11 = _.map(RA.Functor, RA.Functor)

// $ExpectType <A, B>(f: (a: A) => B) => <E>(fa: readonly Either<E, A>[]) => readonly Either<E, B>[]
const F12 = _.map(RA.Functor, E.Functor)
export const F12 = _.map(RA.Functor, E.Functor)

// $ExpectType <A, B>(f: (a: A) => B) => <R, E>(fa: readonly ReaderTaskEither<R, E, A>[]) => readonly ReaderTaskEither<R, E, B>[]
const F13 = _.map(RA.Functor, RTE.Functor)
export const F13 = _.map(RA.Functor, RTE.Functor)

// $ExpectType <A, B>(f: (a: A) => B) => <E>(fa: Either<E, readonly A[]>) => Either<E, readonly B[]>
const F21 = _.map(E.Functor, RA.Functor)
export const F21 = _.map(E.Functor, RA.Functor)

// $ExpectType <A, B>(f: (a: A) => B) => <EF, EG>(fa: Either<EF, Either<EG, A>>) => Either<EF, Either<EG, B>>
const F22 = _.map(E.Functor, E.Functor)
export const F22 = _.map(E.Functor, E.Functor)

// $ExpectType <A, B>(f: (a: A) => B) => <R, E>(fa: ReaderTaskEither<R, E, readonly A[]>) => ReaderTaskEither<R, E, readonly B[]>
const F31 = _.map(RTE.Functor, RA.Functor)
export const F31 = _.map(RTE.Functor, RA.Functor)
4 changes: 2 additions & 2 deletions dtslint/ts3.5/IO.ts → dtslint/IO.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _ from '../../src/IO'
import { pipe } from '../../src/function'
import { pipe } from '../src/function'
import * as _ from '../src/IO'

//
// Do
Expand Down
8 changes: 4 additions & 4 deletions dtslint/ts3.5/IOEither.ts → dtslint/IOEither.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as _ from '../../src/IOEither'
import * as IO from '../../src/IO'
import * as E from '../../src/Either'
import { pipe } from '../../src/function'
import * as E from '../src/Either'
import { pipe } from '../src/function'
import * as IO from '../src/IO'
import * as _ from '../src/IOEither'

//
// getOrElseW
Expand Down
4 changes: 2 additions & 2 deletions dtslint/ts3.5/Identity.ts → dtslint/Identity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _ from '../../src/Identity'
import { pipe } from '../../src/function'
import { pipe } from '../src/function'
import * as _ from '../src/Identity'

//
// Do
Expand Down
20 changes: 11 additions & 9 deletions dtslint/ts3.5/Json.ts → dtslint/Json.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import * as E from '../../src/Either'
import { pipe } from '../../src/function'
import * as _ from '../../src/Json'
import * as E from '../src/Either'
import { pipe } from '../src/function'
import * as _ from '../src/Json'

//
// stringify
//

// $ExpectError
// @ts-expect-error
_.stringify<_.Json>(undefined)
// $ExpectError
_.stringify<_.Json>(() => {})
// $ExpectError
// @ts-expect-error
_.stringify<_.Json>(() => {
return
})
// @ts-expect-error
_.stringify<_.Json>(Symbol())
// $ExpectError
// @ts-expect-error
_.stringify<_.Json>({ a: undefined })
// $ExpectError
// @ts-expect-error
_.stringify<_.Json>({ ...{ a: undefined } })

// tslint:disable-next-line: interface-over-type-literal
Expand Down
22 changes: 11 additions & 11 deletions dtslint/ts3.5/Map.ts → dtslint/Map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as _ from '../../src/Map'
import * as S from '../../src/string'
import * as N from '../../src/number'
import { pipe } from '../../src/function'
import * as E from '../../src/Either'
import * as E from '../src/Either'
import { pipe } from '../src/function'
import * as _ from '../src/Map'
import * as N from '../src/number'
import * as S from '../src/string'

//
// member
Expand Down Expand Up @@ -65,7 +65,7 @@ pipe(
prns,
_.filter(
(
x // $ExpectType number
_x // $ExpectType number
) => true
)
)
Expand All @@ -83,8 +83,8 @@ pipe(
prns,
_.filterWithIndex(
(
k, // $ExpectType string
x // $ExpectType number
_k, // $ExpectType string
_x // $ExpectType number
) => true
)
)
Expand All @@ -104,7 +104,7 @@ pipe(
prns,
_.partition(
(
x // $ExpectType number
_x // $ExpectType number
) => true
)
)
Expand All @@ -124,8 +124,8 @@ pipe(
prns,
_.partitionWithIndex(
(
k, // $ExpectType string
x // $ExpectType number
_k, // $ExpectType string
_x // $ExpectType number
) => true
)
)
Expand Down
8 changes: 4 additions & 4 deletions dtslint/ts3.5/Monoid.ts → dtslint/Monoid.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as _ from '../../src/Monoid'
import * as S from '../../src/string'
import * as N from '../../src/number'
import * as B from '../../src/boolean'
import * as B from '../src/boolean'
import * as _ from '../src/Monoid'
import * as N from '../src/number'
import * as S from '../src/string'

//
// struct
Expand Down
6 changes: 3 additions & 3 deletions dtslint/ts3.5/NonEmptyArray.ts → dtslint/NonEmptyArray.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as _ from '../../src/NonEmptyArray'
import { Ord } from '../../src/Ord'
import { pipe } from '../../src/function'
import { pipe } from '../src/function'
import * as _ from '../src/NonEmptyArray'
import { Ord } from '../src/Ord'

declare const as: Array<string>
declare const neas: _.NonEmptyArray<string>
Expand Down
Loading

0 comments on commit 8a83bd3

Please sign in to comment.