Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json: fix "types" path #353

Closed
wants to merge 1 commit into from
Closed

package.json: fix "types" path #353

wants to merge 1 commit into from

Conversation

tharvik
Copy link
Contributor

@tharvik tharvik commented Sep 14, 2020

Current release do not correclty reference type declarations in package.json. Using the index.d.ts from peer fixes it.

btw, can you please do a new NPM release when merged, as published version is not usable from TypeScript.

@tharvik
Copy link
Contributor Author

tharvik commented Sep 14, 2020

Hum, the build are failing as vis-dev-utils expect the type path to explicitly be declarations/index.d.ts, it would need a fix there also but keeping the two in sync might more easily be done by a maintainer.

@Thomaash
Copy link
Member

Hi @tharvik,

could you tell me what exactly you're doing? Because declarations/index.d.ts corresponds to vis-graph3d and peer/index.d.ts to vis-graph3d/peer. They're not the same.

@tharvik
Copy link
Contributor Author

tharvik commented Sep 15, 2020

Hello @Thomaash,

could you tell me what exactly you're doing?

declarations/index.d.ts doesn't exists in the 6.0.0 NPM archive so tsc fails to compile in strict mode.

#!/bin/sh -eu

mkdir vis && cd vis

npm init --yes
npm install typescript vis-graph3d

cat > index.ts <<EOF
import { Graph3d } from 'vis-graph3d'
EOF

npx tsc --strict index.ts

gives me

index.ts:1:25 - error TS7016: Could not find a declaration file for module 'vis-graph3d'. '[...]/vis/node_modules/vis-graph3d/peer/umd/vis-graph3d.js' implicitly has an 'any' type.
  Try `npm install @types/vis-graph3d` if it exists or add a new declaration (.d.ts) file containing `declare module 'vis-graph3d';`

Because declarations/index.d.ts corresponds to vis-graph3d and peer/index.d.ts to vis-graph3d/peer. They're not the same.

Ho, I though it was as most field in the package.json reference peer, what's the difference then?
I tried with import { Graph3d } from 'vis-graph3d/peer' and it works, but I find it weird to mix import { DataSet } from 'vis-data' (no /peer) with the peer import. Maybe that's intented?

@stale
Copy link

stale bot commented Nov 14, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Nov 14, 2020
@tharvik
Copy link
Contributor Author

tharvik commented Nov 16, 2020

@Thomaash I still have the same issue, what can I do to help with it?

@stale stale bot removed the wontfix This will not be worked on label Nov 16, 2020
@vis-bot
Copy link
Collaborator

vis-bot commented Dec 16, 2020

🎉 This issue has been resolved in version 6.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tharvik tharvik deleted the fix-types-declaration branch January 11, 2021 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants