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

@eventOptions decorator doesn't allow passive to be set #325

Closed
CaptainCodeman opened this issue Nov 30, 2018 · 1 comment
Closed

@eventOptions decorator doesn't allow passive to be set #325

CaptainCodeman opened this issue Nov 30, 2018 · 1 comment
Assignees
Milestone

Comments

@CaptainCodeman
Copy link

The current @eventOptions decorator doesn't allow passive to be set so the following will fail to compile.

@eventOptions({passive: true})
private _handleInteraction(e: Event) {
    this.mdcFoundation.handleInteraction(e);
}

Live Demo

Attempt to build the material-components-web-components project.

Steps to Reproduce

Follow instructions in above repo to build locally

Expected Results

Code compiles

Actual Results

Code does not compile with errors such as:

packages/tab-scroller/src/mwc-tab-scroller.ts:57:18 - error TS2345: Argument of type '{ passive: boolean; }' is not assignable to parameter of type 'EventListenerOptions'.
  Object literal may only specify known properties, and 'passive' does not exist in type 'EventListenerOptions'.

57   @eventOptions({passive: true})

Browsers Affected

Not applicable

Versions

  • lit-element: v0.14.0
@CaptainCodeman
Copy link
Author

In case it wasn't clear, this currently prevents the material-components-web-components elements project being built.

@sorvell sorvell added this to the 1.0.0 milestone Dec 12, 2018
@sorvell sorvell self-assigned this Dec 12, 2018
sorvell pushed a commit that referenced this issue Dec 12, 2018
Fixes #325.

Despite this supposedly being in TypeScirpt (microsoft/TypeScript#9548), it's not, so we augment the type here.

Also adds tests for `once` and `passive` options.
kevinpschaaf pushed a commit that referenced this issue Dec 15, 2018
* Adds passive/once to EventListenerOptions type

Fixes #325.

Despite this supposedly being in TypeScirpt (microsoft/TypeScript#9548), it's not, so we augment the type here.

Also adds tests for `once` and `passive` options.

* Update changelog and format.

* Update to use `AddEventListenerOptions`

* Fix passive event listener test so that it's actually skipped on unsupported browsers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants