Skip to content

Commit

Permalink
refactor(app/store): rm type test
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Sep 29, 2024
1 parent 0995ebf commit fcf14c2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
12 changes: 1 addition & 11 deletions src/app/store/persistence/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { createSelector } from '@reduxjs/toolkit'
import type { Test as TypeTest } from 'ts-toolbelt'

import { ary, isPlainObject, merge, mergeSafe, type PlainObject } from '@/common/utils'
import { controllerSlice } from '@/features/controller/controllerSlice'
import { editorSlice } from '@/features/editor/editorSlice'

import { createCombinedProvider } from './combinedProvider'
import type { PersistenceProvider } from './types'

const provider = createCombinedProvider(ary(merge<PlainObject>, 2))(isPlainObject, {})

Expand Down Expand Up @@ -38,12 +36,4 @@ export const selectStateToPersist = createSelector(

type StateToPersist = ReturnType<typeof selectStateToPersist>

export const writeStateToPersistence: PersistenceProvider<StateToPersist>['write'] = provider.write

if (import.meta.env.NEVER) {
const { checkType, checkTypes } = await import('@/common/utils')
checkTypes([
checkType<keyof PreloadedState, keyof StateToPersist, TypeTest.Pass>(),
checkType<keyof StateToPersist, keyof PreloadedState, TypeTest.Pass>(),
])
}
export const writeStateToPersistence = (state: StateToPersist) => provider.write(state)
9 changes: 0 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import { VitePWA as pwa } from 'vite-plugin-pwa'

import { description, name, version } from './package.json'

interface ImportMetaEnvDefinition {
[key: `import.meta.env.${string}`]: string | boolean
}

const importMetaEnv: ImportMetaEnvDefinition = {
'import.meta.env.NEVER': false,
}

export default defineConfig(async () => {
const exec = promisify(child_process.exec)

Expand All @@ -43,7 +35,6 @@ export default defineConfig(async () => {
chunkSizeWarningLimit: 1000,
},
define: {
...importMetaEnv,
...globalConstants,
},
plugins: [
Expand Down

0 comments on commit fcf14c2

Please sign in to comment.