uni-helper / uni-app-types

为 uni-app 内置组件提供 TypeScript 类型
https://uni-helper.js.org/uni-app-types
MIT License
83 stars 14 forks source link

types declare #18

Closed edazh closed 1 year ago

edazh commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @uni-helper/uni-app-types@0.2.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@uni-helper/uni-app-types/types/events/index.d.ts b/node_modules/@uni-helper/uni-app-types/types/events/index.d.ts
index 68a11b2..69a5d0a 100644
--- a/node_modules/@uni-helper/uni-app-types/types/events/index.d.ts
+++ b/node_modules/@uni-helper/uni-app-types/types/events/index.d.ts
@@ -56,7 +56,7 @@ export interface BaseEvent<
   /**
    * @desc 事件绑定的当前组件的一些属性值集合
    */
-  currentTarget?: Target<CurrentTargetDataset>;
+  currentTarget?: EventTarget<CurrentTargetDataset>;
   [key: string]: any;
 }

@@ -72,7 +72,7 @@ export interface CustomEvent<
   /**
    * @desc 额外信息
    */
-  detail?: Detail;
+  detail: Detail;
   [key: string]: any;
 }

This issue body was partially generated by patch-package.

ModyQyW commented 1 year ago

Can you please specify your problem?

ModyQyW commented 1 year ago

I think I just know what you mean.

Target doesn't exist. Fixed in v0.3.1. Please try.

uni-app doesn't ensure detail exists. So there should be a ?. Please use detail with optional chaining.