Polymer / pwa-helpers

Small helper methods or mixins to help you build web apps.
BSD 3-Clause "New" or "Revised" License
439 stars 48 forks source link

interface LazyStore extends Store #44

Closed elf-pavlik closed 5 years ago

elf-pavlik commented 5 years ago

with this change snippet below works

import { lazyReducerEnhancer, LazyStore } from 'pwa-helpers/lazy-reducer-enhancer.js'

const store = createStore(
  state => state,
  devCompose(lazyReducerEnhancer(combineReducers))
) as LazyStore

without it I get in my application error Property 'getState' does not exist on type 'LazyStore'.


This change is Reviewable

googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
elf-pavlik commented 5 years ago

:memo:

googlebot commented 5 years ago

CLAs look good, thanks!

elf-pavlik commented 5 years ago

It seems this will not work :disappointed:

Should I close this PR and create an issue for those Typescript annotations? Possibly it just needs better documentation.

I also stumbled upon error Argument of type 'LazyStore' is not assignable to parameter of type 'Store<{}, AnyAction>'. Property 'dispatch' is missing in type 'LazyStore'

trying to do

class AppShell extends connect(store)(LitElement)
keanulee commented 5 years ago

You shouldn't need as LazyStore at all - the demo store in this repo (https://github.com/Polymer/pwa-helpers/blob/master/src/demo/store.ts#L50), as well as pwa-starter-kit#typescript, works correctly.