Skip to content

Commit

Permalink
fix(types): fix types to accept spread or list of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jonluca committed Mar 6, 2024
1 parent 71ba6cc commit a3d1801
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export default class $Refs<S extends JSONSchema = JSONSchema> {
*
* @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
*/
paths(...types: string[]): string[] {
const paths = getPaths(this._$refs, types);
paths(...types: (string | string[])[]): string[] {
const paths = getPaths(this._$refs, types.flat());
return paths.map((path) => {
return convertPathToPosix(path.decoded);
});
Expand All @@ -45,9 +45,9 @@ export default class $Refs<S extends JSONSchema = JSONSchema> {
*
* @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
*/
values(...types: string[]): S {
values(...types: (string | string[])[]): S {
const $refs = this._$refs;
const paths = getPaths($refs, types);
const paths = getPaths($refs, types.flat());
return paths.reduce<Record<string, any>>((obj, path) => {
obj[convertPathToPosix(path.decoded)] = $refs[path.encoded].value;
return obj;
Expand Down

0 comments on commit a3d1801

Please sign in to comment.