Skip to content

Commit

Permalink
fix: 调整package.json导出配置,解决vue-tsc类型报错
Browse files Browse the repository at this point in the history
  • Loading branch information
agileago committed Sep 1, 2023
1 parent 87078c4 commit 947a107
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 17 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'no-empty': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
},
}
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"main": "dist/vue3-oop.js",
"module": "dist/vue3-oop.mjs",
"types": "types/index.d.ts",
"exports": {
".": {
"import": "./dist/vue3-oop.mjs",
"require": "./dist/vue3-oop.js"
}
},
"scripts": {
"dev": "vite",
"build": "vite build",
Expand Down
4 changes: 2 additions & 2 deletions src/decorators/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function handler(targetThis: Record<any, any>) {
const list = getProtoMetadata<EagerType>(
targetThis,
Computed.MetadataKey,
true
true,
)
if (!list || !list.length) return
for (const item of list) {
Expand All @@ -39,7 +39,7 @@ function handler(targetThis: Record<any, any>) {
},
{
flush: option === true ? 'sync' : option,
}
},
)
} else {
keyVal = computed({
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface HookDecorator {
function handler(targetThis: any) {
const list = getProtoMetadata<(Lifecycle | Lifecycle[])[]>(
targetThis,
Hook.MetadataKey
Hook.MetadataKey,
)
if (!list?.length) return
for (const item of list) {
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface LinkDecorator {
function handler(targetThis: Record<any, any>) {
const list = getProtoMetadata<string | undefined>(
targetThis,
Link.MetadataKey
Link.MetadataKey,
)
if (!list || !list.length) return
for (const item of list) {
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/mut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function handler(targetThis: Record<string | symbol, any>) {
export function defMut(
targetThis: Record<string | symbol, any>,
key: string | symbol,
options: any
options: any,
) {
let keyVal: Ref
if (options === true) {
Expand Down
4 changes: 2 additions & 2 deletions src/decorators/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function createDecorator<T = void>(name: string, allowRepeat = false) {
export function getProtoMetadata<T = void>(
target: any,
key: symbol | string,
withDesc = false
withDesc = false,
): MetadataStore<T>[] {
const proto = Object.getPrototypeOf(target)
if (!proto) return []
Expand All @@ -58,7 +58,7 @@ export function getProtoMetadata<T = void>(
}
export function getDeepOwnDescriptor(
proto: any,
key: string | symbol
key: string | symbol,
): PropertyDescriptor | null {
if (!proto) return null
const desc = Object.getOwnPropertyDescriptor(proto, key)
Expand Down
4 changes: 2 additions & 2 deletions src/extends/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Object.defineProperty(VueComponent, '__vccOpts', {
props: defaultProps || {},
// 放到emits的on函数会自动缓存
emits: (emits || []).concat(
getEmitsFromProps(CompConstructor.defaultProps || {})
getEmitsFromProps(CompConstructor.defaultProps || {}),
),
setup,
}
Expand Down Expand Up @@ -202,7 +202,7 @@ export function useForwardRef() {
export function mergeRefs(...values: VNodeRef[]) {
return function (
ref: Element | ComponentPublicInstance | null,
refs: Record<string, any>
refs: Record<string, any>,
) {
for (const r of values) {
if (typeof r === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getCurrentApp() {
return getCurrentInstance()?.appContext.app
}
export function getEmitsFromProps(
defaultProps: Record<string, any> | string[]
defaultProps: Record<string, any> | string[],
) {
const keys = Array.isArray(defaultProps)
? defaultProps
Expand Down
2 changes: 1 addition & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type ModelProps<T extends {}> = Exclude<

export type WithVModel<
T extends {},
U extends keyof T = ModelProps<T>
U extends keyof T = ModelProps<T>,
> = TransformModelValue<{
[k in U as `v-model:${k & string}`]?: T[k] | [T[k], string[]]
}>
Expand Down

0 comments on commit 947a107

Please sign in to comment.