Comments (5)
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.
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.
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:
from pwa-helpers.
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
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwa-helpers.