DefinitelyTyped/types/objects-to-csv/objects-to-csv-tests.ts
Tom Plant 4c83502843
Add @types/objects-to-csv (#45973)
* Added types for objects-to-csv

* removed leftover type

* Updated after running npm test properly
2020-07-10 06:39:07 -07:00

13 lines
494 B
TypeScript

import ObjectsToCsv = require('objects-to-csv');
const SAMPLE_ASCII = [
{ code: 'HK', name: 'Hong Kong' },
{ code: 'KLN', name: 'Kowloon' },
{ code: 'NT', name: 'New Territories' },
];
const ascii = new ObjectsToCsv(SAMPLE_ASCII); // $ExpectType ObjectsToCsv
const asciiFile = ascii.toDisk('name'); // $ExpectType Promise<string>
const asciiString = ascii.toString(); // $ExpectType Promise<string>
const convertAscii = ascii.convert(SAMPLE_ASCII); // $ExpectType Promise<string>