diff --git a/lib/helpers/table-name.js b/lib/helpers/table-name.js index 8731f39c..1586d10e 100644 --- a/lib/helpers/table-name.js +++ b/lib/helpers/table-name.js @@ -127,7 +127,6 @@ npm.utils.addInspection(TableName, function () { }); /** - * * @interface Table * @description * Structure for any table name/path. @@ -140,12 +139,20 @@ npm.utils.addInspection(TableName, function () { * @see {@link helpers.TableName TableName}, {@link helpers._TN _TN} */ +/** + * @external TemplateStringsArray + * @see https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_es5_d_.templatestringsarray.html + */ + /** * @function helpers._TN * @description * Table-Name helper function, to convert any `"schema.table"` string * into `{schema, table}` object. It also works as a template-tag function. * + * @param {string|TemplateStringsArray} path + * Table-name path, as a simple string or a template string (with parameters). + * * @example * const {ColumnSet, _TN} = pgp.helpers; * @@ -158,13 +165,13 @@ npm.utils.addInspection(TableName, function () { * * @returns {Table} * - * @see {@link helpers.TableName TableName} + * @see {@link helpers.TableName TableName}, {@link external:TemplateStringsArray TemplateStringsArray} */ -function _TN(a, ...args) { - if (Array.isArray(a) && a.raw) { - a = a.map((b, i) => b + (i < args.length ? args[i] ?? '' : '')).join(''); - } // else 'a' is a string - const [schema, table] = a.split('.'); +function _TN(path, ...args) { + if (Array.isArray(path) && path.raw) { + path = path.map((b, i) => b + (i < args.length ? args[i] ?? '' : '')).join(''); + } // else 'path' is a string + const [schema, table] = path.split('.'); if (table === undefined) { return {table: schema}; } diff --git a/typescript/pg-promise.d.ts b/typescript/pg-promise.d.ts index 34cd3ba3..3f7df79f 100644 --- a/typescript/pg-promise.d.ts +++ b/typescript/pg-promise.d.ts @@ -708,8 +708,8 @@ declare namespace pgPromise { ColumnSet: typeof ColumnSet TableName: typeof TableName - _TN(data: TemplateStringsArray, ...args: Array): ITable - _TN(s: string) :ITable + _TN(path: TemplateStringsArray, ...args: Array): ITable + _TN(path: string) :ITable } interface IGenericPromise {