From 092f169b1d0fe42f75becc0749b54561d5029dd4 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 9 Jan 2020 18:20:15 +0100 Subject: [PATCH] fix: loose TS type for StateTree Fix #47 --- .vscode/settings.json | 5 ++++- __tests__/pinia/stores/user.ts | 2 +- src/types.ts | 30 +----------------------------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 52d6a46d..1a316121 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,8 @@ "eslint.validate": [ "javascript", { "language": "typescript", "autoFix": true } - ] + ], + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + } } diff --git a/__tests__/pinia/stores/user.ts b/__tests__/pinia/stores/user.ts index 67ca840f..4697483a 100644 --- a/__tests__/pinia/stores/user.ts +++ b/__tests__/pinia/stores/user.ts @@ -2,7 +2,7 @@ import { createStore } from '../../../src' export const useUserStore = createStore('user', () => ({ name: 'Eduardo', - isAdmin: true as boolean, + isAdmin: true, })) export function logout() { diff --git a/src/types.ts b/src/types.ts index 58052fb9..ea88e470 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,24 +1,6 @@ import { Ref } from '@vue/composition-api' -interface JSONSerializable { - toJSON(): string -} - -export type StateTreeValue = - | string - | symbol - | number - | boolean - | null - | void - | Function - | StateTree - | StateTreeArray - | JSONSerializable - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface StateTree - extends Record {} +export type StateTree = Record export function isPlainObject( // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -32,16 +14,6 @@ export function isPlainObject( ) } -// symbol is not allowed yet https://github.com/Microsoft/TypeScript/issues/1863 -// export interface StateTree { -// [x: number]: StateTreeValue -// [x: symbol]: StateTreeValue -// [x: string]: StateTreeValue -// } - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -interface StateTreeArray extends Array {} - export interface StoreGetter { (state: S): T } -- 2.47.2