Skip to content

Commit

Permalink
Merge pull request #41 from hanyf/master
Browse files Browse the repository at this point in the history
fix typescript cannot infer from mappedState
  • Loading branch information
alexander-heimbuch authored May 11, 2024
2 parents 57db8d0 + 30c8e63 commit b714fff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/map-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { injectStore } from './tokens.js'
import { objectMapper, applyMappers } from './helper.js'
import { MapOptions, PropertyMappers } from './types.js'

export function mapState<T>(...args: MapOptions) {
export function mapState<T>(...args: MapOptions): T & Partial<any> {
const defaultGetter = (prop: string) => (state: { [key: string]: any }) => get(state, prop)

const store = injectStore()
Expand All @@ -28,5 +28,5 @@ export function mapState<T>(...args: MapOptions) {

onUnmounted(unsubscribe)

return bindings as T;
return bindings as T
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
},
"include": ["./src/index.ts"]
"include": ["./src/*.ts"]
}

0 comments on commit b714fff

Please sign in to comment.