Skip to content

Commit 60e7080

Browse files
committed
0.2.1
增加类型声明
1 parent e9e0486 commit 60e7080

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
22
"name": "@4a/retry",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"type": "module",
55
"files": ["dist"],
66
"main": "./dist/retry.umd.cjs",
77
"module": "./dist/retry.js",
88
"scripts": {
99
"dev": "vite",
10-
"build": "vue-tsc && vite build",
1110
"preview": "vite preview",
1211
"test": "vitest --run",
13-
"coverage": "NODE_ENV=development vitest run --coverage"
12+
"build": "vue-tsc && vite build && npm run type",
13+
"type": "tsc src/lib/retry.ts --lib es2015,dom --declarationDir dist --emitDeclarationOnly --declaration",
14+
"coverage": "NODE_ENV=development vitest run --coverage",
15+
"prepack": "npm run build",
16+
"prepublish": "npm run build"
1417
},
1518
"exports": {
1619
".": {

src/lib/retry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Retry
33
*
4-
* @author gavinning
4+
* @author gavinning <[email protected]>
55
* @description 失败自动重试,可用于http请求重试,或其他需要重试的逻辑
66
*
77
*/
88

9-
type AnyFunction<T> = (...args: any[]) => T
9+
export type AnyFunction<T> = (...args: any[]) => T
1010

1111
export class Retry<R = any> {
1212
private i: number

tsconfig.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
"target": "ES2020",
44
"useDefineForClassFields": true,
55
"module": "ESNext",
6-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
6+
"lib": ["ES2015", "ES2020", "DOM", "DOM.Iterable"],
77
"skipLibCheck": true,
88

9+
"declaration": true,
10+
"declarationDir": "dist",
11+
"emitDeclarationOnly": true,
12+
913
/* Bundler mode */
1014
"moduleResolution": "bundler",
1115
"allowImportingTsExtensions": true,
1216
"resolveJsonModule": true,
1317
"isolatedModules": true,
14-
"noEmit": true,
1518
"jsx": "preserve",
1619

1720
/* Linting */

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default defineConfig({
3232
globals: {
3333
vue: 'Vue',
3434
},
35+
exports: "named"
3536
},
3637
},
3738
}

0 commit comments

Comments
 (0)