-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Trying to follow the documentation to make use of @listen, I added import {DeclarativeEventListeners} from '@polymer/decorators/lib/declarative-event-listeners.js'; to the top of my file and my element extends DeclarativeEventListeners(PolymerElement). However, when my typescript is compiled, I get:
node_modules/@polymer/decorators/lib/decorators.d.ts:11:32 - error TS7016: Could not find a declaration file for module '@polymer/polymer/polymer-element.js'. '/path/to/node_modules/@polymer/polymer/polymer-element.js' implicitly has an 'any' type.
11 import { PolymerElement } from '@polymer/polymer/polymer-element.js';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
path/to/index.ts:3:41 - error TS7016: Could not find a declaration file for module '@polymer/decorators/lib/declarative-event-listeners.js'. '/path/to/node_modules/@polymer/decorators/lib/declarative-event-listeners.js' implicitly has an 'any' type.
3 import {DeclarativeEventListeners} from '@polymer/decorators/lib/declarative-event-listeners.js';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If I mark the function being decorated as private, I get an additional error:
path/to/index.ts:39:4 - error TS2345: Argument of type 'MyClass' is not assignable to parameter of type 'ElementPrototype & HasEventListener<"myFunction_">'.
Type 'MyClass' is not assignable to type 'HasEventListener<"myFunction_">'.
Property 'myFunction_' is private in type 'MyClass' but not in type 'HasEventListener<"myFunction_">'.
39 @listen('select', document)
~~~~~~~~~~~~~~~~~~~~~~~~~~
I have no such problem marking a function private and annotating it with @observe or marking a property private and annotating with @query.
Metadata
Metadata
Assignees
Labels
No labels