GHC 2021-07-30

2 comments.

, https://git.io/JBggA in adaltas/node-csv
Btw, somewhat related, it might be a good idea to mention browser support in the documentation? https://csv.js.org/stringify/ only seems to mention `csv-stringify`, `csv-stringify/lib/sync` and `csv-stringify/lib/es5`, none of which works in the browser due to the use of Node's Buffer API. I almost gave up before I noticed the undocumented `browser` module, which does work.

I apologize if I missed something.

, https://git.io/JBggx in adaltas/node-csv
Type declaration files missing for csv-stringify/lib/browser/sync
=================================================================

**Describe the bug**

`csv-stringfy` 5.6.2

```ts
import csvStringify from 'csv-stringify/lib/browser/sync';
```

doesn't work in TypeScript since the type declarations are missing.

I had to add my own `csv-stringify.d.ts`:

```ts
declare module 'csv-stringify/lib/browser/sync' {
  import { Input, Options } from 'csv-stringify';

  function stringify(input: Input, options?: Options): string;
  export = stringify;
}
```

**To Reproduce**

Just try to import 'csv-stringify/lib/browser/sync' in any TypeScript project.

**Additional context**

Looking at the directory structure of the npm package, it's clear that `lib/browser/*.js` don't have corresponding `.d.ts` declaration files.

```
$ tree node_modules/csv-stringify/
node_modules/csv-stringify/
├── CHANGELOG.md
├── LICENSE
├── README.md
├── lib
│   ├── browser
│   │   ├── index.js
│   │   └── sync.js
│   ├── es5
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── sync.d.ts
│   │   └── sync.js
│   ├── index.d.ts
│   ├── index.js
│   ├── sync.d.ts
│   └── sync.js
└── package.json
```