Skip to content

Commit

Permalink
Add return types for toHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Dec 2, 2023
1 parent abc4446 commit d018e35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/element.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

/**
* @typedef {import('lit-html').TemplateResult} TemplateResult
*/
import uniqueId from 'lodash-es/uniqueId.js';
import { render } from 'lit-html';
import EventEmitter from './eventemitter.js';
Expand Down Expand Up @@ -94,6 +98,9 @@ class ElementView extends EventEmitter(HTMLElement) {
return this;
}

/**
* @returns {string|TemplateResult}
*/
toHTML() {
return '';
}
Expand Down
6 changes: 5 additions & 1 deletion src/types/element.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default ElementView;
export type TemplateResult = import('lit-html').TemplateResult;
declare const ElementView_base: {
new (...args: any[]): {
on(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context: any): any;
Expand Down Expand Up @@ -62,7 +63,10 @@ declare class ElementView extends ElementView_base {
* convention is for **render** to always return `this`.
*/
render(): this;
toHTML(): string;
/**
* @returns {string|TemplateResult}
*/
toHTML(): string | TemplateResult;
/**
* Set callbacks, where `this.events` is a hash of
*
Expand Down
2 changes: 1 addition & 1 deletion src/types/element.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d018e35

Please sign in to comment.