File tree 4 files changed +26
-33
lines changed
4 files changed +26
-33
lines changed Original file line number Diff line number Diff line change 1
- import { defineStore } from './store'
2
1
export {
3
2
setActiveReq ,
4
3
setStateProvider ,
5
4
getRootState ,
6
5
createPinia ,
7
6
} from './rootStore'
8
-
9
- function createStore ( options : Parameters < typeof defineStore > [ 0 ] ) {
10
- console . warn (
11
- '[🍍]: "createStore" has been deprecated and will be removed on the sable release, use "defineStore" instead.'
12
- )
13
- return defineStore ( options )
14
- }
15
-
16
- export { StateTree , StoreGetter , Store } from './types'
17
- export { createStore , defineStore }
7
+ export { defineStore } from './store'
8
+ export { createStore } from './deprecated'
Original file line number Diff line number Diff line change @@ -111,24 +111,3 @@ export type GenericStore = Store<
111
111
Record < string , Method > ,
112
112
Record < string , Method >
113
113
>
114
-
115
- export interface DevtoolHook {
116
- on (
117
- event : string ,
118
- callback : ( targetState : Record < string , StateTree > ) => void
119
- ) : void
120
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
- emit ( event : string , ...payload : any [ ] ) : void
122
- }
123
-
124
- // add the __VUE_DEVTOOLS_GLOBAL_HOOK__ variable to the global namespace
125
- declare global {
126
- interface Window {
127
- __VUE_DEVTOOLS_GLOBAL_HOOK__ ?: DevtoolHook
128
- }
129
- namespace NodeJS {
130
- interface Global {
131
- __VUE_DEVTOOLS_GLOBAL_HOOK__ ?: DevtoolHook
132
- }
133
- }
134
- }
Original file line number Diff line number Diff line change
1
+ import { createStore , expectType } from './'
2
+
3
+ const useDeprecated = createStore ( {
4
+ id : 'name' ,
5
+ state : ( ) => ( { a : 'on' as 'on' | 'off' , nested : { counter : 0 } } ) ,
6
+ getters : {
7
+ upper ( ) {
8
+ return this . a . toUpperCase ( )
9
+ } ,
10
+ } ,
11
+ } )
12
+
13
+ const deprecatedStore = useDeprecated ( )
14
+
15
+ expectType < { a : 'on' | 'off' } > ( deprecatedStore . state )
16
+ expectType < number > ( deprecatedStore . nested . counter )
17
+ expectType < 'on' | 'off' > ( deprecatedStore . a )
18
+
19
+ // @ts -expect-error
20
+ deprecatedStore . nonExistant
21
+
22
+ // @ts -expect-error
23
+ deprecatedStore . nonExistant . stuff
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const useStore = defineStore({
10
10
} ,
11
11
} )
12
12
13
- const store = useStore ( )
13
+ let store = useStore ( )
14
14
15
15
// FIXME: this should not be there anymore
16
16
expectType < { a : 'on' | 'off' } > ( store . state )
You can’t perform that action at this time.
0 commit comments