mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
28 lines
731 B
TypeScript
28 lines
731 B
TypeScript
import parseColumns = require('parse-columns');
|
|
|
|
// $ExpectType { [key: string]: string; }[]
|
|
parseColumns('foo');
|
|
// $ExpectType { [key: string]: string; }[]
|
|
parseColumns('foo', { separator: ' ' });
|
|
// $ExpectType { [key: string]: string; }[]
|
|
parseColumns('foo', { headers: ['foo', 'bar'] });
|
|
// $ExpectType { [key: string]: string | number; }[]
|
|
parseColumns('foo', {
|
|
transform(el, header, columnIndex, rowIndex) {
|
|
// $ExpectType string
|
|
el;
|
|
// $ExpectType string
|
|
header;
|
|
// $ExpectType number
|
|
columnIndex;
|
|
// $ExpectType number
|
|
rowIndex;
|
|
|
|
if (columnIndex >= 1 && columnIndex <= 3) {
|
|
return Number(el);
|
|
}
|
|
|
|
return el;
|
|
},
|
|
});
|