Skip to content

Commit 39a4388

Browse files
committed
feat(csv-parse): ts type encoding with BufferEncoding
1 parent ef84fb2 commit 39a4388

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

packages/csv-parse/dist/cjs/index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export type CastingDateFunction = (value: string, context: CastingContext) => Da
3838

3939
export type ColumnOption = string | undefined | null | false | { name: string };
4040

41+
/*
42+
Note, could not `extends stream.TransformOptions` because encoding can be
43+
BufferEncoding and undefined as well as null which is not defined in the
44+
extended type.
45+
*/
4146
export interface Options {
4247
/**
4348
* If true, the parser will attempt to convert read data types to native types.
@@ -90,7 +95,7 @@ export interface Options {
9095
/**
9196
* Set the source and destination encoding, a value of `null` returns buffer instead of strings.
9297
*/
93-
encoding?: string | null;
98+
encoding?: BufferEncoding | undefined;
9499
/**
95100
* Set the escape character, one character only, defaults to double quotes.
96101
*/

packages/csv-parse/dist/esm/index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export type CastingDateFunction = (value: string, context: CastingContext) => Da
3838

3939
export type ColumnOption = string | undefined | null | false | { name: string };
4040

41+
/*
42+
Note, could not `extends stream.TransformOptions` because encoding can be
43+
BufferEncoding and undefined as well as null which is not defined in the
44+
extended type.
45+
*/
4146
export interface Options {
4247
/**
4348
* If true, the parser will attempt to convert read data types to native types.
@@ -90,7 +95,7 @@ export interface Options {
9095
/**
9196
* Set the source and destination encoding, a value of `null` returns buffer instead of strings.
9297
*/
93-
encoding?: string | null;
98+
encoding?: BufferEncoding | undefined;
9499
/**
95100
* Set the escape character, one character only, defaults to double quotes.
96101
*/

packages/csv-parse/lib/index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export type CastingDateFunction = (value: string, context: CastingContext) => Da
3838

3939
export type ColumnOption = string | undefined | null | false | { name: string };
4040

41+
/*
42+
Note, could not `extends stream.TransformOptions` because encoding can be
43+
BufferEncoding and undefined as well as null which is not defined in the
44+
extended type.
45+
*/
4146
export interface Options {
4247
/**
4348
* If true, the parser will attempt to convert read data types to native types.
@@ -90,7 +95,7 @@ export interface Options {
9095
/**
9196
* Set the source and destination encoding, a value of `null` returns buffer instead of strings.
9297
*/
93-
encoding?: string | null;
98+
encoding?: BufferEncoding | undefined;
9499
/**
95100
* Set the escape character, one character only, defaults to double quotes.
96101
*/

0 commit comments

Comments
 (0)