Skip to content

Commit a3d1801

Browse files
committed
fix(types): fix types to accept spread or list of strings
1 parent 71ba6cc commit a3d1801

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/refs.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export default class $Refs<S extends JSONSchema = JSONSchema> {
3131
*
3232
* @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
3333
*/
34-
paths(...types: string[]): string[] {
35-
const paths = getPaths(this._$refs, types);
34+
paths(...types: (string | string[])[]): string[] {
35+
const paths = getPaths(this._$refs, types.flat());
3636
return paths.map((path) => {
3737
return convertPathToPosix(path.decoded);
3838
});
@@ -45,9 +45,9 @@ export default class $Refs<S extends JSONSchema = JSONSchema> {
4545
*
4646
* @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
4747
*/
48-
values(...types: string[]): S {
48+
values(...types: (string | string[])[]): S {
4949
const $refs = this._$refs;
50-
const paths = getPaths($refs, types);
50+
const paths = getPaths($refs, types.flat());
5151
return paths.reduce<Record<string, any>>((obj, path) => {
5252
obj[convertPathToPosix(path.decoded)] = $refs[path.encoded].value;
5353
return obj;

0 commit comments

Comments
 (0)