Skip to content

Commit

Permalink
update enum type
Browse files Browse the repository at this point in the history
  • Loading branch information
rawpixel-vincent committed Mar 29, 2024
1 parent 099592c commit fd75951
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "string-literal-list",
"version": "1.20.0",
"version": "1.21.0",
"description": "an array for string literal",
"main": "stringList.cjs",
"module": "stringList.js",
Expand Down
11 changes: 9 additions & 2 deletions stringList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ import mutableMin from './stringList.min.js';

import strictMin from './strict.min.js';

/** @type {typeof import('./stringList.js')['sl']} */
// @ts-expect-error
const mutableMinStringListCjs = mutableMin.stringList;
/** @type {typeof import('./strict.js')['sl']} */
// @ts-expect-error
const strictMinStringListCjs = strictMin.stringList;

import { createRequire } from 'module';
const require = createRequire(import.meta.url);
/** @type {typeof import('./stringList.js')['sl']} */
Expand Down Expand Up @@ -47,11 +54,11 @@ const functions = [
},
{
type: 'mutableMin',
stringList: mutableMin.stringList,
stringList: mutableMinStringListCjs,
},
{
type: 'immutableMin',
stringList: strictMin.stringList,
stringList: strictMinStringListCjs,
},
];

Expand Down
2 changes: 1 addition & 1 deletion types/list.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export interface IStringList<
// Readonly overrides
readonly length: [Unsorted] extends [true] ? number : Tuple['length'];
readonly [n: number]: Tuple[number] | undefined;
readonly enum: { [P in Tuple[number]]: P };
readonly enum: { [P in Tuple[number]]: P } & { [P: string]: Tuple[number] };

// Supported Methods
at(n: number): Tuple[number] | undefined;
Expand Down

0 comments on commit fd75951

Please sign in to comment.