Skip to content

Commit

Permalink
chore(ts): add parse generic
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Apr 18, 2023
1 parent 2698e7c commit d258e08
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
import {isString} from './helpers';
import {WorkBook} from './workbook';

export const parse = (mixed: unknown, options: Sheet2JSONOpts & ParsingOptions = {}) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const parse = <T = any[]>(mixed: unknown, options: Sheet2JSONOpts & ParsingOptions = {}) => {
const {dateNF, header = 1, range, blankrows, defval, raw = true, rawNumbers, ...otherOptions} = options;
const workBook = isString(mixed)
? readFile(mixed, {dateNF, raw, ...otherOptions})
Expand All @@ -25,7 +26,7 @@ export const parse = (mixed: unknown, options: Sheet2JSONOpts & ParsingOptions =
const sheet = workBook.Sheets[name];
return {
name,
data: utils.sheet_to_json(sheet, {
data: utils.sheet_to_json<T>(sheet, {
dateNF,
header,
range: typeof range === 'function' ? range(sheet) : range,
Expand Down

0 comments on commit d258e08

Please sign in to comment.