diff --git a/lib/asset-css.js b/lib/asset-css.js index b883226..2b9daca 100644 --- a/lib/asset-css.js +++ b/lib/asset-css.js @@ -42,6 +42,7 @@ export default class PodiumAssetCss { #hreflang; #prefix; #title; + /** @type {string} */ #value; #media; #type; @@ -53,19 +54,19 @@ export default class PodiumAssetCss { /** * @constructor * @param {object} options - * @param {boolean | string | null} [options.crossorigin] - * @param {string | null} [options.hreflang=""] - * @param {boolean | null} [options.prefix=false] - * @param {boolean | null} [options.disabled=false] - * @param {string | null} [options.pathname=""] - * @param {string | null} [options.title=""] - * @param {string | null} [options.media=""] - * @param {string | null} [options.type="text/css"] - * @param {string | null} [options.rel="stylesheet"] - * @param {string | null} [options.as=""] - * @param {string | null} [options.value] - * @param {string | null} [options.strategy] - * @param {string | null} [options.scope] + * @param {boolean | string} [options.crossorigin] + * @param {string} [options.hreflang=""] + * @param {boolean} [options.prefix=false] + * @param {boolean} [options.disabled=false] + * @param {string} [options.pathname=""] + * @param {string} [options.title=""] + * @param {string} [options.media=""] + * @param {string} [options.type="text/css"] + * @param {string} [options.rel="stylesheet"] + * @param {string} [options.as=""] + * @param {string} [options.value] + * @param {string} [options.strategy] + * @param {string} [options.scope] */ constructor({ crossorigin = undefined, @@ -89,7 +90,7 @@ export default class PodiumAssetCss { this.#pathname = pathname; this.#prefix = prefix; - this.#value = value; + this.#value = /** @type {string} */ (value); this.#crossorigin = crossorigin; this.#disabled = disabled; diff --git a/lib/asset-js.js b/lib/asset-js.js index c0ecc1e..29c95b8 100644 --- a/lib/asset-js.js +++ b/lib/asset-js.js @@ -44,6 +44,7 @@ export default class PodiumAssetJs { #pathname; #nomodule; #prefix; + /** @type {string} */ #value; #async; #defer; @@ -55,19 +56,19 @@ export default class PodiumAssetJs { /** * @constructor * @param {object} options - * @param {string | null} [options.referrerpolicy] - * @param {boolean | string | null} [options.crossorigin] - * @param {string | null} [options.integrity] - * @param {string | null} [options.pathname] - * @param {boolean | null} [options.nomodule=false] - * @param {boolean | null} [options.prefix=false] - * @param {string | null} [options.value] - * @param {boolean | null} [options.async=false] - * @param {boolean | null} [options.defer=false] - * @param {string | null} [options.type="default"] - * @param {array} [options.data] - * @param {string | null} [options.strategy] - * @param {string | null} [options.scope] + * @param {string} [options.referrerpolicy] + * @param {boolean | string} [options.crossorigin] + * @param {string} [options.integrity] + * @param {string} [options.pathname] + * @param {boolean} [options.nomodule=false] + * @param {boolean} [options.prefix=false] + * @param {string} [options.value] + * @param {boolean} [options.async=false] + * @param {boolean} [options.defer=false] + * @param {string} [options.type="default"] + * @param {Array<{ key: string, value?: unknown }>} [options.data] + * @param {string} [options.strategy] + * @param {string} [options.scope] */ constructor({ referrerpolicy = '', @@ -92,7 +93,7 @@ export default class PodiumAssetJs { this.#pathname = pathname; this.#prefix = prefix; - this.#value = value; + this.#value = /** @type {string} */ (value); this.#referrerpolicy = referrerpolicy; this.#crossorigin = crossorigin; @@ -239,10 +240,9 @@ export default class PodiumAssetJs { .filter(([key, value]) => value && key !== 'value') .flatMap(([key, value]) => { if (key === 'data') { - // @ts-ignore - return value.map( - ({ key, value }) => `data-${key}=${value}`, - ); + return /** @type {Array<{ key: string, value?: unknown }>} */ ( + value + ).map(({ key, value }) => `data-${key}=${value}`); } return [`${key}=${value}`]; }); diff --git a/lib/assets.js b/lib/assets.js index e5953d2..df7ea1a 100644 --- a/lib/assets.js +++ b/lib/assets.js @@ -3,8 +3,12 @@ import { EventEmitter } from 'node:events'; export class Assets extends EventEmitter { #expectedAssets = new Set(); #receivedAssets = new Map(); - #js; - #css; + + /** @type {Array} */ + #js = []; + + /** @type {Array} */ + #css = []; // pointless constructor with super to appease TS which cryptically errors otherwise. constructor() { diff --git a/lib/html-document.js b/lib/html-document.js index 1e40ce7..06a3e8a 100644 --- a/lib/html-document.js +++ b/lib/html-document.js @@ -13,7 +13,7 @@ export const document = (incoming, body = '', head = '') => { incoming.view.locale || incoming.context['podium-locale'] || incoming.context.locale || - incoming.params.locale || + incoming.params?.locale || 'en-US'; // backwards compatibility for scripts and styles @@ -28,13 +28,17 @@ export const document = (incoming, body = '', head = '') => { - ${styles.map(utils.buildLinkElement).join('\n ')} + ${ + // @ts-expect-error We filter out strings before this + styles.map(utils.buildLinkElement).join('\n ') + } ${scripts .filter( (script) => typeof script !== 'string' && script.strategy === 'beforeInteractive', ) + // @ts-expect-error We filter out strings before this .map(utils.buildScriptElement) .join('\n ')} ${incoming.view.title ? incoming.view.title : ''} @@ -49,6 +53,7 @@ export const document = (incoming, body = '', head = '') => { script.strategy === 'afterInteractive' || !script.strategy, ) + // @ts-expect-error We filter out strings before this .map(utils.buildScriptElement) .join('\n ')} ${scripts diff --git a/lib/html-utils.js b/lib/html-utils.js index 0beabca..9d7a475 100644 --- a/lib/html-utils.js +++ b/lib/html-utils.js @@ -71,6 +71,7 @@ export const buildScriptAttributes = (obj) => { * @returns {object} */ export const buildReactScriptAttributes = (obj) => { + /** @type {Record} */ const attrs = {}; for (const { key, value } of buildScriptAttributes(obj)) { if (key === 'crossorigin') attrs.crossOrigin = value || ''; @@ -145,6 +146,7 @@ export const buildLinkAttributes = (obj) => { * @returns {object} */ export const buildReactLinkAttributes = (obj) => { + /** @type {Record} */ const attrs = {}; for (const { key, value } of buildLinkAttributes(obj)) { if (key === 'crossorigin') attrs.crossOrigin = value || ''; diff --git a/lib/html.js b/lib/html.js index c86e410..1e6fc79 100644 --- a/lib/html.js +++ b/lib/html.js @@ -3,7 +3,7 @@ import escapeHtml from 'escape-html'; /** * Escape an untrusted string so it can be safely included in HTML. * - * @param {unknown} string + * @param {string | null | undefined} string * @returns {string} */ export function escape(string) { @@ -38,7 +38,7 @@ export function html(strings, ...values) { /** @type {DangerouslyIncludeUnescapedHTML} */ (value).content, ); } else { - result.push(escape(value)); + result.push(escape(String(value))); } } result.push(strings.at(-1)); @@ -61,6 +61,9 @@ export function html(strings, ...values) { export class DangerouslyIncludeUnescapedHTML { #content; + /** + * @param {{ __content: string}} param0 + */ constructor({ __content }) { this.#content = __content; } diff --git a/lib/http-incoming.js b/lib/http-incoming.js index e4454ce..7fe5ce8 100644 --- a/lib/http-incoming.js +++ b/lib/http-incoming.js @@ -3,9 +3,16 @@ import { Assets } from './assets.js'; const inspect = Symbol.for('nodejs.util.inspect.custom'); +/** + * @param {unknown} request + * @returns {URL} + */ const urlFromRequest = (request) => { + // @ts-expect-error const protocol = request?.protocol || 'http'; + // @ts-expect-error const host = request?.headers?.host || 'localhost'; + // @ts-expect-error const url = request?.url || ''; return new URL(url, `${protocol.replace(':', '')}://${host}`); }; @@ -135,15 +142,21 @@ export default class HttpIncoming { podlets.forEach((podlet) => { if (podlet.css) { - podlet.css.forEach((item) => { - this.#css.push(item); - }); + podlet.css.forEach( + /** @param {import("./asset-css.js").CssAsset} item */ + (item) => { + this.#css.push(item); + }, + ); } if (podlet.js) { - podlet.js.forEach((item) => { - this.#js.push(item); - }); + podlet.js.forEach( + /** @param {import("./asset-js.js").JavaScriptAsset} item */ + (item) => { + this.#js.push(item); + }, + ); } }); } diff --git a/lib/utils.js b/lib/utils.js index 4aecb81..4b52907 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -114,15 +114,20 @@ export const uriRelativeToAbsolute = (input = '', base = '', extra = '') => { * @returns {object} The http response object */ export const setAtLocalsPodium = (response = {}, property, value) => { + // @ts-expect-error We know response is an object if (!response.locals) { + // @ts-expect-error We know response is an object response.locals = {}; } + // @ts-expect-error We know response is an object if (!response.locals.podium) { + // @ts-expect-error We know response is an object response.locals.podium = {}; } if (isString(property) && property !== '') { + // @ts-expect-error We know response is an object response.locals.podium[property] = value; } @@ -133,20 +138,23 @@ export const setAtLocalsPodium = (response = {}, property, value) => { * Get the value from a property on .locals.podium on an HTTP response object. * Ensures that .locals.podium exists on the http response object. * - * @param {object} [response] An HTTP response object. + * @param {unknown} [response] An HTTP response object. * @param {string} [property] Property for the value. * @returns {object | null} The property, or `null` if it does not exist. */ export const getFromLocalsPodium = (response = {}, property) => { + // @ts-expect-error We know response is an object if (!response.locals) { return null; } + // @ts-expect-error We know response is an object if (!response.locals.podium) { return null; } if (isString(property) && property !== '') { + // @ts-expect-error We know response is an object return response.locals.podium[property]; } @@ -175,8 +183,8 @@ export const duplicateOnLocalsPodium = ( /** * Serialize a context object into an HTTP header object, calling the function if a context value is callable. * - * @param {object} [headers={}] An HTTP headers object the context will be copied to. - * @param {object} [context={}] A context object to copy from. + * @param {Record} [headers={}] An HTTP headers object the context will be copied to. + * @param {Record string)>} [context={}] A context object to copy from. * @param {unknown} [arg=""] An argument value passed on to the function if a context value is a function. * @returns {object} An object with deserialized context properties and values. * @@ -193,14 +201,18 @@ export const duplicateOnLocalsPodium = ( * ``` */ export const serializeContext = (headers = {}, context = {}, arg = '') => { + /** @type {Record} */ const localHeaders = headers; Object.keys(context).forEach((key) => { if (isString(context[key])) { - localHeaders[key] = context[key]; + localHeaders[key] = /** @type {string} */ (context[key]); } if (isFunction(context[key])) { - localHeaders[key] = context[key](arg); + const contextFn = /** @type {((arg: unknown) => string)} */ ( + context[key] + ); + localHeaders[key] = contextFn(arg); } }); return localHeaders; @@ -209,7 +221,7 @@ export const serializeContext = (headers = {}, context = {}, arg = '') => { /** * Deserialize a context object from an HTTP header object. * - * @param {object} [headers={}] An HTTP headers object the context will be extracted from. + * @param {Record} [headers={}] An HTTP headers object the context will be extracted from. * @param {string} [prefix="podium"] The prefix used to mark what properties are context properties. * @returns {object} An object with deserialized context properties and values. * @@ -225,6 +237,7 @@ export const serializeContext = (headers = {}, context = {}, arg = '') => { * ``` */ export const deserializeContext = (headers = {}, prefix = 'podium') => { + /** @type {Record} */ const context = {}; Object.keys(headers).forEach((key) => { if (key.startsWith(prefix)) { diff --git a/package-lock.json b/package-lock.json index 021c1fe..29dfbed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,10 +14,11 @@ }, "devDependencies": { "@podium/client": "5.4.5", - "@podium/eslint-config": "1.0.21", + "@podium/eslint-config": "2.0.2", "@podium/schemas": "5.1.2", "@podium/semantic-release-config": "3.0.0", "@podium/typescript-config": "1.0.1", + "@types/escape-html": "1.0.4", "@types/node": "24.10.9", "benchmark": "2.1.4", "eslint": "9.39.3", @@ -25,7 +26,7 @@ "prettier": "3.8.1", "semantic-release": "25.0.2", "tap": "21.5.0", - "typescript": "5.9.3" + "typescript": "6.0.2" } }, "node_modules/@actions/core": { @@ -186,6 +187,28 @@ "node": ">=12" } }, + "node_modules/@e18e/eslint-plugin": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@e18e/eslint-plugin/-/eslint-plugin-0.3.0.tgz", + "integrity": "sha512-hHgfpxsrZ2UYHcicA+tGZnmk19uJTaye9VH79O+XS8R4ona2Hx3xjhXghclNW58uXMk3xXlbYEOMr8thsoBmWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-plugin-depend": "^1.5.0" + }, + "peerDependencies": { + "eslint": "^9.0.0 || ^10.0.0", + "oxlint": "^1.55.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + }, + "oxlint": { + "optional": true + } + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.9.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", @@ -1210,15 +1233,16 @@ } }, "node_modules/@podium/eslint-config": { - "version": "1.0.21", - "resolved": "https://registry.npmjs.org/@podium/eslint-config/-/eslint-config-1.0.21.tgz", - "integrity": "sha512-n9qfIEd0v6GfVngMKwyiCGTJAbq/xU2ilJkC3NiX+rJHdjJcC2ElgknHv7pYfz2I7Mux29AjqP80vzUn+yIAlg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@podium/eslint-config/-/eslint-config-2.0.2.tgz", + "integrity": "sha512-FC+O5utYdb/Xi5Ogk3duXit28kMRHo0UgdFl0iqZvCslw9QeRVBoObKTn8H2MHmkVlPqFK7Ch6WXuGK12falVA==", "dev": true, "license": "ISC", "dependencies": { + "@e18e/eslint-plugin": "0.3.0", "eslint-config-prettier": "10.1.8", "eslint-plugin-prettier": "5.5.5", - "globals": "16.5.0" + "globals": "17.4.0" }, "peerDependencies": { "eslint": ">= 9" @@ -2398,6 +2422,20 @@ "@tapjs/core": "4.4.0" } }, + "node_modules/@tapjs/test/node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/@tapjs/typescript": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/@tapjs/typescript/-/typescript-3.5.0.tgz", @@ -2505,6 +2543,13 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@types/escape-html": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/escape-html/-/escape-html-1.0.4.tgz", + "integrity": "sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -3561,6 +3606,16 @@ "dev": true, "license": "MIT" }, + "node_modules/empathic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.0.tgz", + "integrity": "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -3886,6 +3941,21 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-depend": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-depend/-/eslint-plugin-depend-1.5.0.tgz", + "integrity": "sha512-i3UeLYmclf1Icp35+6W7CR4Bp2PIpDgBuf/mpmXK5UeLkZlvYJ21VuQKKHHAIBKRTPivPGX/gZl5JGno1o9Y0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "empathic": "^2.0.0", + "module-replacements": "^2.10.1", + "semver": "^7.6.3" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.5.5", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.5.tgz", @@ -4470,9 +4540,9 @@ } }, "node_modules/globals": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", - "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "version": "17.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.4.0.tgz", + "integrity": "sha512-hjrNztw/VajQwOLsMNT1cbJiH2muO3OROCHnbehc8eY5JyD2gqz4AcMHPqgaOR59DjgUjYAYLeH699g/eWi2jw==", "dev": true, "license": "MIT", "engines": { @@ -5742,6 +5812,13 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/module-replacements": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/module-replacements/-/module-replacements-2.11.0.tgz", + "integrity": "sha512-j5sNQm3VCpQQ7nTqGeOZtoJtV3uKERgCBm9QRhmGRiXiqkf7iRFOkfxdJRZWLkqYY8PNf4cDQF/WfXUYLENrRA==", + "dev": true, + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -10724,6 +10801,20 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/tshy/node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/ttl-mem-cache": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ttl-mem-cache/-/ttl-mem-cache-4.1.0.tgz", @@ -10801,9 +10892,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz", + "integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package.json b/package.json index 69a211c..2ddd3a3 100644 --- a/package.json +++ b/package.json @@ -41,10 +41,11 @@ }, "devDependencies": { "@podium/client": "5.4.5", - "@podium/eslint-config": "1.0.21", + "@podium/eslint-config": "2.0.2", "@podium/schemas": "5.1.2", "@podium/semantic-release-config": "3.0.0", "@podium/typescript-config": "1.0.1", + "@types/escape-html": "1.0.4", "@types/node": "24.10.9", "benchmark": "2.1.4", "eslint": "9.39.3", @@ -52,10 +53,10 @@ "prettier": "3.8.1", "semantic-release": "25.0.2", "tap": "21.5.0", - "typescript": "5.9.3" + "typescript": "6.0.2" }, "dependencies": { "camelcase": "8.0.0", "escape-html": "1.0.3" } -} \ No newline at end of file +} diff --git a/tests/html-utils.test.js b/tests/html-utils.test.js index 929d584..cf13c28 100644 --- a/tests/html-utils.test.js +++ b/tests/html-utils.test.js @@ -165,14 +165,22 @@ tap.test( '.buildLinkElement() - properties are "null" - should NOT appended attributes to element', (t) => { const obj = new AssetCss({ + // @ts-expect-error Testing bad input crossorigin: null, + // @ts-expect-error Testing bad input disabled: null, + // @ts-expect-error Testing bad input hreflang: null, + // @ts-expect-error Testing bad input title: null, + // @ts-expect-error Testing bad input media: null, value: '/foo', + // @ts-expect-error Testing bad input type: null, + // @ts-expect-error Testing bad input rel: null, + // @ts-expect-error Testing bad input as: null, }); const result = utils.buildLinkElement(obj); @@ -425,13 +433,20 @@ tap.test( '.buildScriptElement() - properties are "null" - should NOT appended attributes to element', (t) => { const obj = new AssetJs({ + // @ts-expect-error Testing bad input referrerpolicy: null, + // @ts-expect-error Testing bad input crossorigin: null, + // @ts-expect-error Testing bad input integrity: null, + // @ts-expect-error Testing bad input nomodule: null, + // @ts-expect-error Testing bad input async: null, + // @ts-expect-error Testing bad input defer: null, value: '/foo', + // @ts-expect-error Testing bad input type: null, }); const result = utils.buildScriptElement(obj); diff --git a/tests/http-incoming.test.js b/tests/http-incoming.test.js index 245cd50..93455ab 100644 --- a/tests/http-incoming.test.js +++ b/tests/http-incoming.test.js @@ -99,6 +99,7 @@ tap.test('PodiumHttpIncoming.request - set value', (t) => { const incoming = new HttpIncoming(ADVANCED_REQ, SIMPLE_RES); t.throws( () => { + // @ts-expect-error Testing bad input incoming.request = 'foo'; }, /Cannot set read-only property./, @@ -112,6 +113,7 @@ tap.test('PodiumHttpIncoming.response - set value', (t) => { const incoming = new HttpIncoming(ADVANCED_REQ, SIMPLE_RES); t.throws( () => { + // @ts-expect-error Testing bad input incoming.response = 'foo'; }, /Cannot set read-only property./, diff --git a/tests/utils.test.js b/tests/utils.test.js index e836925..58696d6 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -820,7 +820,9 @@ tap.test( (t) => { const context = { 'podium-foo': 'bar', - 'podium-bar': (name) => `${name}-test`, + 'podium-bar': + /** @param {unknown} name */ + (name) => `${name}-test`, }; const headers = { diff --git a/tsconfig.json b/tsconfig.json index 19707f1..12c07d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,9 @@ { - "extends": "@podium/typescript-config/module.json", - "include": ["./lib/**/*.js"], - "compilerOptions": { - "outDir": "types" - } + "extends": "@podium/typescript-config/module.json", + "include": ["./lib/**/*.js"], + "compilerOptions": { + "types": ["node", "escape-html"], + "rootDir": "lib", + "outDir": "types" + } } diff --git a/tsconfig.test.json b/tsconfig.test.json index 2bd90d8..c635836 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -1,4 +1,7 @@ { - "extends": "@podium/typescript-config/test.json", - "include": ["./tests/**/*.js"] + "extends": "@podium/typescript-config/test.json", + "include": ["./tests/**/*.js"], + "compilerOptions": { + "rootDir": "." + } }