emmanueltouzery / prelude-ts

Functional programming, immutable collections and FP constructs for typescript and javascript
ISC License
377 stars 21 forks source link

Package name issue #20

Closed mnn closed 5 years ago

mnn commented 6 years ago

I am trying your library:

import { Vector } from 'prelude.ts';

But I got this error:

src/index.ts:5:24 - error TS2691: An import path cannot end with a '.ts' extension. Consider importing 'prelude' instead.

So I tried only prelude as it suggests and that crashes with this:

src/index.ts:5:24 - error TS2307: Cannot find module 'prelude'.

When I was installing the package I thought the name is a bit weird, but I didn't expect it is not supported by TypeScript.

TS: 3.1.3 prelude.ts: 0.8.1

mnn commented 6 years ago

Found https://github.com/emmanueltouzery/prelude.ts/issues/18#issuecomment-420527325 and the advice in the link works. I still think the name choice is very poor, if it is not supported by TS by default. I almost abandoned trying this library because of this...

emmanueltouzery commented 6 years ago

i don't understand, what is the advice that works? I would assume that if you got the error An import path cannot end with a '.ts' extension that would mean that you didn't run npm install after adding prelude to your dependencies?

What is it that you did to fix it in the end? I didn't expect it to be a hurdle honestly, I'm interested in what was the fix for you.

emmanueltouzery commented 6 years ago

ah the issue would be the module system being es2015. certainly I can add a FAQ entry for that. Maybe I'll consider again renaming.

mnn commented 6 years ago

Adding "moduleResolution": "node" to tsconfig.json. Other libraries were working without that option.

mnn commented 6 years ago

Yes, please at least make a note in FAQ or installation, so others aren't as confused as I was :).