esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

Different inferred type when importing - fp-ts

Open baoshan opened this issue 2 years ago • 1 comments

Failing module

  • GitHub: https://github.com/gcanti/fp-ts
  • npm: https://www.npmjs.com/package/fp-ts

Inferred type of result is different when using esm.sh & Deno:

import { sequenceT } from "fp-ts/Apply";
import { getApplicativeValidation, right } from "fp-ts/Either";
import { getSemigroup } from "fp-ts/NonEmptyArray";
const f = getApplicativeValidation(getSemigroup<string>());
const result = sequenceT(f)(right(""));

Error message

Inferred type (esm.sh & Deno):

const result: Kind4<F, S, R, E, { [K in keyof T]: [T[K]] extends [Kind4<F, S, R, E, infer A>] ? A : never; }>

Inferred type (tsc):

const result: Either<NonEmptyArray<string>, [string]>

Additional info

  • esm.sh version: V76
  • Deno version: deno 1.20.4 (release, aarch64-apple-darwin)

baoshan avatar Apr 05 '22 13:04 baoshan

It seems d.ts files are addressing wrong path to HKT.

// https://esm.sh/v86/[email protected]/lib/Apply.d.ts
import { HKT, ... } from './HKT/HKT.d.ts'

Currently it is pointing ./HKT/HKT.d.ts , which gives /* fake(empty) types */.

It should be ../HKT.d.ts

gnlow avatar Jul 11 '22 11:07 gnlow