Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: DOMAttributes interface missing onTransitionStart and onTransitionCancel events #4643

Closed
3 tasks done
nwhittaker opened this issue Jul 31, 2023 · 5 comments · Fixed by #4645
Closed
3 tasks done
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@nwhittaker
Copy link

Prerequisites

Stencil Version

4.0.2

Current Behavior

Cannot use JSX to attach transitioncancel and transitionstart event handlers.

Expected Behavior

Can use JSX to attach transitionstart and transitioncancel event handlers.

System Info

System: node 18.16.1
    Platform: darwin (22.6.0)
   CPU Model: Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (16 cpus)
    Compiler: ~/my-first-stencil-project/node_modules/@stencil/core/compiler/stencil.js
       Build: 1690208707
     Stencil: 4.0.2 😈
  TypeScript: 5.0.4
      Rollup: 2.42.3
      Parse5: 7.1.2
      Sizzle: 2.42.3
      Terser: 5.19.1

Steps to Reproduce

  1. Checkout the nwhittaker/stencil repo.
  2. Switch to the bugs/jsx-events-transition branch.
  3. Run npm start and see TypeScript errors in terminal

Code Reproduction URL

https://github.com/nwhittaker/stencil

Additional Information

Terminal output:

my-first-stencil-project % npm start

> my-first-stencil-project@0.0.1 start
> stencil build --dev --watch --serve

[22:04.7]  @stencil/core
[22:04.9]  v4.0.2 😈
[22:06.1]  build, my-first-stencil-project, dev mode, started ...
[22:06.1]  transpile started ...
[22:07.6]  transpile finished in 1.53 s

[ ERROR ]  TypeScript: src/components/my-component/my-component.tsx:11:12
           Type '{ onTransitionCancel: () => void; }' is not assignable to type
           'HTMLAttributes<HTMLDivElement>'.Property 'onTransitionCancel' does not exist on type
           'HTMLAttributes<HTMLDivElement>'. Did you mean 'onTransitionEnd'?

     L10:  return [
     L11:    <div onTransitionCancel={() => {}} />,
     L12:    <div onTransitionCancelCapture={() => {}} />,

[ ERROR ]  TypeScript: src/components/my-component/my-component.tsx:12:12
           Type '{ onTransitionCancelCapture: () => void; }' is not assignable to type
           'HTMLAttributes<HTMLDivElement>'.Property 'onTransitionCancelCapture' does not exist on type
           'HTMLAttributes<HTMLDivElement>'. Did you mean 'onTransitionEndCapture'?

     L11:  <div onTransitionCancel={() => {}} />,
     L12:  <div onTransitionCancelCapture={() => {}} />,
     L13:  <div onTransitionEnd={() => {}} />,

[ ERROR ]  TypeScript: src/components/my-component/my-component.tsx:15:12
           Type '{ onTransitionStart: () => void; }' is not assignable to type
           'HTMLAttributes<HTMLDivElement>'.Property 'onTransitionStart' does not exist on type
           'HTMLAttributes<HTMLDivElement>'. Did you mean 'onAnimationStart'?

     L14:  <div onTransitionEndCapture={() => {}} />,
     L15:  <div onTransitionStart={() => {}} />,
     L16:  <div onTransitionStartCapture={() => {}} />,

[ ERROR ]  TypeScript: src/components/my-component/my-component.tsx:16:12
           Type '{ onTransitionStartCapture: () => void; }' is not assignable to type
           'HTMLAttributes<HTMLDivElement>'.Property 'onTransitionStartCapture' does not exist on type
           'HTMLAttributes<HTMLDivElement>'. Did you mean 'onAnimationStartCapture'?

     L15:    <div onTransitionStart={() => {}} />,
     L16:    <div onTransitionStartCapture={() => {}} />,
     L17:  ]

[22:07.6]  build failed, watching for changes... in 1.54 s
@ionitron-bot ionitron-bot bot added the triage label Jul 31, 2023
@rwaskiewicz rwaskiewicz added the Bug: Validated This PR or Issue is verified to be a bug within Stencil label Jul 31, 2023
@ionitron-bot ionitron-bot bot removed the triage label Jul 31, 2023
@rwaskiewicz
Copy link
Member

Thanks @nwhittaker! I was able to reproduce this with the provided repro case, and have labeled it to get ingested into our internal backlog. Thanks again!

rwaskiewicz added a commit that referenced this issue Jul 31, 2023
this commit adds function declarations for the following events:
- [`onTransitionCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event)
- [`onTransitionRun`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionrun_event)
- [`onTransitionStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionstart_event)

note that `onTransitionCancel` was  not natively supported by Chrome &
Edge until v87. this version falls _after_ stencil's currently supported
version of v79+ for both. this commit does not transpile code for the
event/provide a polyfill for versions of Chrome/Edge released before
2020.11.17

fixes: #4643
@rwaskiewicz
Copy link
Member

@nwhittaker I've put up #4645, which should fix this issue. If you're able to, would you mind giving a dev-build of Stencil a try to help me verify the fix?

npm i @stencil/core@4.0.3-dev.1690838047.8cfce58

Thanks!

@nwhittaker
Copy link
Author

@rwaskiewicz, I verified on my branch that the TypeScript errors clear up with that dev-build, thanks!

@rwaskiewicz
Copy link
Member

Excellent, thanks! I'll queue this up for merge now, and should be going out in the next Stencil release

github-merge-queue bot pushed a commit that referenced this issue Aug 1, 2023
this commit adds function declarations for the following events:
- [`onTransitionCancel`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitioncancel_event)
- [`onTransitionRun`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionrun_event)
- [`onTransitionStart`](https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionstart_event)

note that `onTransitionCancel` was  not natively supported by Chrome &
Edge until v87. this version falls _after_ stencil's currently supported
version of v79+ for both. this commit does not transpile code for the
event/provide a polyfill for versions of Chrome/Edge released before
2020.11.17

fixes: #4643
@rwaskiewicz
Copy link
Member

The fix associated with this issue has been included in this morning's 4.0.4 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants