webcomponents.dev icon indicating copy to clipboard operation
webcomponents.dev copied to clipboard

Bundled types fail to load

Open tpluscode opened this issue 4 years ago • 1 comments

📖 Reproduction steps

Add any of the below lines to a TS module:

  • import * as mwcComponents from '@hydrofoil/shaperone-wc-material/components'
  • import * as mwcComponents from '@hydrofoil/shaperone-wc-material/components.js'
  • import * as MaterialRenderStrategy from '@hydrofoil/shaperone-wc-material/renderer'
  1. Save

They are all existing modules and resolve fine

🙁 Current Behavior

The import gets highlighted with errors like Cannot find module '@hydrofoil/shaperone-wc-material/components' or its corresponding type declarations.

wcd tries to dereference https://srv.divriots.com/typings/@hydrofoil/[email protected]/components?typings which fails because it looks for @types/* package

Command failed: /app/node_modules/.bin/npm install --no-audit --no-fund --production=false npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fhydrofoil__shaperone-wc-material - Not found npm ERR! 404 npm ERR! 404 '@types/hydrofoil__shaperone-wc-material@latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 It was specified as a dependency of '9dca6c0588e5088f5162d4921d11d1b02185d963' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! A complete log of this run can be found in: npm ERR! /home/.npm/_logs/2021-11-19T14_57_46_040Z-debug.log

🙂 Expected Behavior

Bundled types should be loaded as seen in https://unpkg.com/browse/@hydrofoil/[email protected]/components.d.ts

🔗 Link to the component

No response

🌐 What browser(s) are you seeing the problem on?

Chrome

Browser version(s)

No response

tpluscode avatar Nov 19 '21 15:11 tpluscode

This package is missing types declaration in package.json as per https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package

We could infer typings from <main>.d.ts though, not sure if vscode/typescript are supporting that (doc says no, but implementation may differ).

gluck avatar Nov 19 '21 15:11 gluck