Giter Club home page Giter Club logo

Comments (5)

thepassle avatar thepassle commented on June 5, 2024

Why does typescript error on this exactly? These are just sideeffectul imports, I would expect typescript to just be compatible with regular JS

Edit: as a sidenote, I'm not sure how lazy loading pwa-install-button will work out, because it depends on the beforeinstallprompt being fired. If you lazyload the component, it becomes a race condition, and theres theoretically a possibility you'll miss it. Not sure if this will actually lead to any problems in your case, just be aware.

from pwa-helpers.

abdonrd avatar abdonrd commented on June 5, 2024

Ops! I forget to add the log! Is this:

Could not find a declaration file for module 'pwa-helper-components/pwa-install-button.js'. '/Users/abdonrd/.../pwa-starter/node_modules/pwa-helper-components/pwa-install-button.js' implicitly has an 'any' type.
  Try `npm install @types/pwa-helper-components` if it exists or add a new declaration (.d.ts) file containing `declare module 'pwa-helper-components/pwa-install-button.js';`ts(7016)

from pwa-helpers.

abdonrd avatar abdonrd commented on June 5, 2024

Edit: as a sidenote, I'm not sure how lazy loading pwa-install-button will work out, because it depends on the beforeinstallprompt being fired. If you lazyload the component, it becomes a race condition, and theres theoretically a possibility you'll miss it. Not sure if this will actually lead to any problems in your case, just be aware.

Interesting! 🤔

After update to static import is just a VSCode note, and not an error in the TS compiler:

Screenshot 2020-04-26 at 14 17 36

from pwa-helpers.

thepassle avatar thepassle commented on June 5, 2024

For pwa-update-available it should be fine to lazyload btw, because it'll just check if theres an existing and waiting serviceworker (which means theres an update available).

But I still dont understand why TS would fail on that. The import doesnt return anything, it just registers the web component. I'm not really looking forward to jump through a lot of hoops to generate declaration files/add a build step to this project just because TS doesn't support regular JS 🙁 This seems like a big problem with TS to me. I may not understand TS well enough and I could be wrong, but this is the impression I have.

On the other hand, you could wonder if it even makes sense to lazy load these components. They're both only around 30 LoC (thats unminified/gzipped), maybe the cost of lazy loading (connecting to network etc) is more expensive than just including them in your bundle anyway.

from pwa-helpers.

thepassle avatar thepassle commented on June 5, 2024

You should be able to enable allowJs in your tsconfig, I'll close this for now

from pwa-helpers.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.