esm-dev / esm.sh

A fast, smart, & global CDN for modern(es2015+) web development.
https://esm.sh
MIT License
3.14k stars 151 forks source link

Different inferred type when importing - fp-ts #300

Open baoshan opened 2 years ago

baoshan commented 2 years ago

Failing module

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

gnlow commented 2 years ago

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

// https://esm.sh/v86/fp-ts@2.12.1/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