mirror of
https://github.com/jlengrand/open-wc.git
synced 2026-03-10 08:31:19 +00:00
feat: add types + linting & improve intellisense
This commit is contained in:
@@ -5,21 +5,23 @@ import { elementUpdated } from './elementUpdated.js';
|
||||
* Setups an element synchronously from the provided string template and puts it in the DOM.
|
||||
* Allows to specify properties via an object or a function taking the element as an argument.
|
||||
*
|
||||
* @template {Element} T - Is an element or a node
|
||||
* @param {string} template
|
||||
* @returns {Element}
|
||||
* @returns {T}
|
||||
*/
|
||||
export function stringFixtureSync(template) {
|
||||
const wrapper = fixtureWrapper();
|
||||
wrapper.innerHTML = template;
|
||||
return wrapper.children[0];
|
||||
return /** @type {T} */ (wrapper.children[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups an element asynchronously from the provided string template and puts it in the DOM.
|
||||
* Allows to specify properties via an object or a function taking the element as an argument.
|
||||
*
|
||||
* @template {Element} T - Is an element or a node
|
||||
* @param {string} template
|
||||
* @returns {Promise<Element>}
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
export async function stringFixture(template) {
|
||||
const el = stringFixtureSync(template);
|
||||
|
||||
Reference in New Issue
Block a user