-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow list or string in concat arguments
- Loading branch information
1 parent
dfd40fa
commit 0cb66d0
Showing
8 changed files
with
144 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,13 @@ | |
} | ||
}, | ||
"engines": { | ||
"node": ">=20" | ||
"node": ">=16" | ||
}, | ||
"packageManager": "[email protected]+sha256.17ca6e08e7633b624e8f870db81a78f46afe119de62bcaf0a7407574139198fc", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "npm run lint:ci && npm run test:checkJs && npm run test:unit", | ||
"test:unit": "tap run && tap report --show-full-coverage", | ||
"test:unit": "tap run --allow-incomplete-coverage", | ||
"test:checkJs": "tsc --checkJs --project ./jsconfig.json", | ||
"prettier": "prettier --write \"**/*.{js,ts}\"", | ||
"lint": "eslint --fix \"./*.js\"", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { IStringList } from './StringLiteralList.js'; | ||
|
||
export function stringList<T extends string>( | ||
export function stringList<T extends string = never>( | ||
...strings: T[] | ||
): Readonly<IStringList<Record<T, T>[T]>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
/// <reference path="types.d.ts" /> | ||
|
||
import { StringLiteralList } from './StringLiteralList.js'; | ||
import { SL } from './StringLiteralList.js'; | ||
|
||
/** @type {import('./stringList.js').stringList} */ | ||
export function stringList(...strings) { | ||
if (strings.some((el) => typeof el !== 'string')) { | ||
throw new Error(`Not a string in stringList ${strings[0]}`); | ||
} | ||
// @ts-expect-error[2322] | ||
return Object.freeze(new StringLiteralList(...strings)); | ||
return Object.freeze(new SL(...strings)); | ||
} |
Oops, something went wrong.