Skip to content

Commit

Permalink
improve test typings
Browse files Browse the repository at this point in the history
  • Loading branch information
huang2002 committed Feb 10, 2019
1 parent d1f93b6 commit 7d1f3f7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
6 changes: 3 additions & 3 deletions test/src/Counter.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
interface CounterStore {
type CounterStore = HUI.Store<{
value: number;
}
}, {}>;

const Counter = HUI.define<{}, HUI.Store<CounterStore, {}>, HUI.EmptyStore>('Counter', {
const Counter = HUI.define<{}, CounterStore, HUI.EmptyStore>('Counter', {

state: ['value'],

Expand Down
10 changes: 4 additions & 6 deletions test/src/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
interface DialogStore {
type DialogStore = HUI.Store<{
on: boolean;
}

interface DialogStoreHandlers {
}, {
toggle: () => void;
}
}>;

const Dialog = HUI.define<{}, HUI.Store<DialogStore, DialogStoreHandlers>, HUI.EmptyStore>('Dialog', {
const Dialog = HUI.define<{}, DialogStore, HUI.EmptyStore>('Dialog', {

state: ['on'],

Expand Down
6 changes: 3 additions & 3 deletions test/src/TestInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ interface TestInputProps {
children: string;
}

interface TestInputStore {
type TestInputStore = HUI.Store<{
input?: HTMLInputElement;
value: string;
}
}, {}>;

const TestInput = HUI.define<TestInputProps, HUI.Store<TestInputStore>, HUI.EmptyStore>('TestInput', {
const TestInput = HUI.define<TestInputProps, TestInputStore, HUI.EmptyStore>('TestInput', {

state: ['value'],

Expand Down
6 changes: 3 additions & 3 deletions test/src/ThrowTest.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
interface ThrowTestStore {
type ThrowTestStore = HUI.Store<{
msg: string;
}
}, {}>;

const ThrowTest = HUI.define<{}, HUI.Store<ThrowTestStore>, HUI.EmptyStore>('ThrowTest', {
const ThrowTest = HUI.define<{}, ThrowTestStore, HUI.EmptyStore>('ThrowTest', {

state: ['msg'],

Expand Down
10 changes: 4 additions & 6 deletions test/src/Timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ interface TimerProps {
start?: number;
}

interface TimerStore {
type TimerStore = HUI.Store<{
time: number;
}

interface TimerStoreHandlers {
}, {
setInterval: (interval: number) => any;
}
}>;

const Timer = HUI.define<TimerProps, HUI.Store<TimerStore, TimerStoreHandlers>, HUI.EmptyStore>('Timer', {
const Timer = HUI.define<TimerProps, TimerStore, HUI.EmptyStore>('Timer', {

state: ['time'],

Expand Down

0 comments on commit 7d1f3f7

Please sign in to comment.