Skip to content

Commit fd30b95

Browse files
committed
feat: add types dir
1 parent bdb3188 commit fd30b95

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

src/apis/todo.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,6 @@
1-
const { request } = useRequest()
2-
3-
/**
4-
* Todo item type.
5-
*/
6-
export interface TodoItem {
7-
/**
8-
* Todo item id.
9-
*/
10-
id: number
11-
/**
12-
* Todo item title.
13-
*/
14-
title: string
15-
/**
16-
* Todo item completed.
17-
*
18-
* @default false
19-
*/
20-
completed: boolean
21-
/**
22-
* Todo item user id.
23-
*/
24-
userId: number
25-
}
1+
import type { TodoItem, TodoList } from '@/types/todo'
262

27-
/**
28-
* Todo list type.
29-
*/
30-
export type TodoList = TodoItem[]
3+
const { request } = useRequest()
314

325
/**
336
* Get todo list.

src/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</route>
1111

1212
<script lang="ts" setup>
13-
import type { TodoList } from '@/apis/todo'
13+
import type { TodoList } from '@/types/todo'
1414
1515
const { t } = useI18n()
1616

src/types/todo.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Todo item type.
3+
*/
4+
export interface TodoItem {
5+
/**
6+
* Todo item id.
7+
*/
8+
id: number
9+
/**
10+
* Todo item title.
11+
*/
12+
title: string
13+
/**
14+
* Todo item completed.
15+
*
16+
* @default false
17+
*/
18+
completed: boolean
19+
/**
20+
* Todo item user id.
21+
*/
22+
userId: number
23+
}
24+
25+
/**
26+
* Todo list type.
27+
*/
28+
export type TodoList = TodoItem[]

0 commit comments

Comments
 (0)