diegohaz / constate

React Context + State

Home Page:https://codesandbox.io/s/github/diegohaz/constate/tree/master/examples/counter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move type declarations to root dir

ingver opened this issue · comments

In current version (1.0.0) type declarations are published under dist/ts/src and when importing for example by the default VS Code action, the result is:

image

Besides unfancy look, it leads to error during compilation

Module not found: Error: Can't resolve 'constate/dist/ts/src' in 'C:\source\project\src'
...
commented

That's a bug in VSCode/IntelliSense, isn't it?

Does it work if you manually remove /dist/ts/src?

That's a bug in VSCode/IntelliSense, isn't it?

Not sure. Should it work another way? If .d.ts file is in /dist/ts/src, why should it point to /?

Does it work if you manually remove /dist/ts/src?

Yep, it works. But I must manually write import or edit every auto-import statement.

commented

If .d.ts file is in /dist/ts/src, why should it point to /?

Honestly, I'm not sure how VSCode parses it, but the types field in package.json is pointing to dist/ts/src:

"types": "dist/ts/src",

That should be enough to VSCode understand it. That's why I think it's a bug in VSCode.