Skip to content

Commit 947a107

Browse files
committed
fix: 调整package.json导出配置,解决vue-tsc类型报错
1 parent 87078c4 commit 947a107

File tree

10 files changed

+12
-17
lines changed

10 files changed

+12
-17
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ module.exports = {
3636
'@typescript-eslint/no-explicit-any': 'off',
3737
'@typescript-eslint/no-floating-promises': 'off',
3838
'no-empty': 'warn',
39+
'@typescript-eslint/no-unused-vars': 'warn',
3940
},
4041
}

package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
"main": "dist/vue3-oop.js",
55
"module": "dist/vue3-oop.mjs",
66
"types": "types/index.d.ts",
7-
"exports": {
8-
".": {
9-
"import": "./dist/vue3-oop.mjs",
10-
"require": "./dist/vue3-oop.js"
11-
}
12-
},
137
"scripts": {
148
"dev": "vite",
159
"build": "vite build",

src/decorators/computed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function handler(targetThis: Record<any, any>) {
1919
const list = getProtoMetadata<EagerType>(
2020
targetThis,
2121
Computed.MetadataKey,
22-
true
22+
true,
2323
)
2424
if (!list || !list.length) return
2525
for (const item of list) {
@@ -39,7 +39,7 @@ function handler(targetThis: Record<any, any>) {
3939
},
4040
{
4141
flush: option === true ? 'sync' : option,
42-
}
42+
},
4343
)
4444
} else {
4545
keyVal = computed({

src/decorators/hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface HookDecorator {
3939
function handler(targetThis: any) {
4040
const list = getProtoMetadata<(Lifecycle | Lifecycle[])[]>(
4141
targetThis,
42-
Hook.MetadataKey
42+
Hook.MetadataKey,
4343
)
4444
if (!list?.length) return
4545
for (const item of list) {

src/decorators/link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface LinkDecorator {
1111
function handler(targetThis: Record<any, any>) {
1212
const list = getProtoMetadata<string | undefined>(
1313
targetThis,
14-
Link.MetadataKey
14+
Link.MetadataKey,
1515
)
1616
if (!list || !list.length) return
1717
for (const item of list) {

src/decorators/mut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function handler(targetThis: Record<string | symbol, any>) {
3333
export function defMut(
3434
targetThis: Record<string | symbol, any>,
3535
key: string | symbol,
36-
options: any
36+
options: any,
3737
) {
3838
let keyVal: Ref
3939
if (options === true) {

src/decorators/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function createDecorator<T = void>(name: string, allowRepeat = false) {
4646
export function getProtoMetadata<T = void>(
4747
target: any,
4848
key: symbol | string,
49-
withDesc = false
49+
withDesc = false,
5050
): MetadataStore<T>[] {
5151
const proto = Object.getPrototypeOf(target)
5252
if (!proto) return []
@@ -58,7 +58,7 @@ export function getProtoMetadata<T = void>(
5858
}
5959
export function getDeepOwnDescriptor(
6060
proto: any,
61-
key: string | symbol
61+
key: string | symbol,
6262
): PropertyDescriptor | null {
6363
if (!proto) return null
6464
const desc = Object.getOwnPropertyDescriptor(proto, key)

src/extends/component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Object.defineProperty(VueComponent, '__vccOpts', {
172172
props: defaultProps || {},
173173
// 放到emits的on函数会自动缓存
174174
emits: (emits || []).concat(
175-
getEmitsFromProps(CompConstructor.defaultProps || {})
175+
getEmitsFromProps(CompConstructor.defaultProps || {}),
176176
),
177177
setup,
178178
}
@@ -202,7 +202,7 @@ export function useForwardRef() {
202202
export function mergeRefs(...values: VNodeRef[]) {
203203
return function (
204204
ref: Element | ComponentPublicInstance | null,
205-
refs: Record<string, any>
205+
refs: Record<string, any>,
206206
) {
207207
for (const r of values) {
208208
if (typeof r === 'string') {

src/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function getCurrentApp() {
2222
return getCurrentInstance()?.appContext.app
2323
}
2424
export function getEmitsFromProps(
25-
defaultProps: Record<string, any> | string[]
25+
defaultProps: Record<string, any> | string[],
2626
) {
2727
const keys = Array.isArray(defaultProps)
2828
? defaultProps

src/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type ModelProps<T extends {}> = Exclude<
4949

5050
export type WithVModel<
5151
T extends {},
52-
U extends keyof T = ModelProps<T>
52+
U extends keyof T = ModelProps<T>,
5353
> = TransformModelValue<{
5454
[k in U as `v-model:${k & string}`]?: T[k] | [T[k], string[]]
5555
}>

0 commit comments

Comments
 (0)