ionic-team / ionic-team/ionic-framework

bug: Angular - Argument of type 'Event' is not assignable to parameter of type 'CustomEvent<XXX>'.

Đang mở
#24,245 16 bình luận 6 reaction 0 người được giao Xem trên GitHub
package: angular type: bug
Ngôn ngữ chính
TypeScript
Star
52.7k
Fork
13.3k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
51

Mô tả

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

- [ ] v4.x
- [X] v5.x
- [X] v6.x

### Current Behavior

Wrong definition type breaks the app.

### Expected Behavior

Having the right definition type

### Steps to Reproduce

- Create a new ionic project: `ionic start test-ionic`
- Framework: Angular
- Starter template: tabs

Copy/paste the code sample (html and ts) from https://ionicframework.com/docs/api/reorder-group in `tab1.page.(html|ts)`. Then in your IDE you'll notice the given error:

> Argument of type 'Event' is not assignable to parameter of type 'CustomEvent'. Type 'Event' is missing the following properties from type 'CustomEvent': detail, initCustomEventngtsc(2345)

Try to build the app: `ionic build --prod`, it won't build (same error).

It does this with other events as well...

Same issue occurs on ionic 6 rc3

### Code Reproduction URL

https://github.com/JumBay/ionic-event-type-issue

### Ionic Info

$ ionic info
[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module '@capacitor/ios/package'

Require stack:
- /usr/local/lib/node_modules/@ionic/cli/lib/project/index.js
- /usr/local/lib/node_modules/@ionic/cli/lib/index.js
- /usr/local/lib/node_modules/@ionic/cli/index.js
- /usr/local/lib/node_modules/@ionic/cli/bin/ionic
[WARN] Error loading @capacitor/android package.json: Error: Cannot find module '@capacitor/android/package'

Require stack:
- /usr/local/lib/node_modules/@ionic/cli/lib/project/index.js
- /usr/local/lib/node_modules/@ionic/cli/lib/index.js
- /usr/local/lib/node_modules/@ionic/cli/index.js
- /usr/local/lib/node_modules/@ionic/cli/bin/ionic

Ionic:

Ionic CLI : 6.18.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.9.1
@angular-devkit/build-angular : 12.1.4
@angular-devkit/schematics : 12.1.4
@angular/cli : 12.1.4
@ionic/angular-toolkit : 4.0.0

Capacitor:

Capacitor CLI : 3.3.2
@capacitor/android : not installed
@capacitor/core : 3.3.2
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v14.18.1 (/usr/local/bin/node)
npm : 6.14.15
OS : macOS Monterey

### Additional Information

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with the reorder-group documentation example and the tab1.page.html and tab1.page.ts files in the linked reproduction repository. Run ionic build --prod to reproduce the type error, then trace the event definition used by the Angular component. Done means the sample compiles with the documented event handler and the build completes without this error.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.