csv-writer icon indicating copy to clipboard operation
csv-writer copied to clipboard

[Bug]: Remove typescript files from build

Open what1s1ove opened this issue 1 year ago • 1 comments

Because the package is published together with TypeScript files (which is bad practice), various errors occur depending on the build tool.

image

For example, the problem in this issue https://github.com/ryu1kn/csv-writer/issues/92. Another example is when I want to enable the exactOptionalPropertyTypes option in the TypeScript config, it complains about the use of TS files in the node_modules folder, which we cannot fix.

image
node_modules/csv-writer/src/lib/csv-writer-factory.ts:30:85 - error TS2379: Argument of type '{ header: string[] | undefined; fieldDelimiter: string | undefined; recordDelimiter: string | undefined; alwaysQuote: boolean | undefined; }' is not assignable to parameter of type 'ArrayCsvStringifierParams' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  Types of property 'header' are incompatible.
    Type 'string[] | undefined' is not assignable to type 'string[]'.
      Type 'undefined' is not assignable to type 'string[]'.

 30         const csvStringifier = this.csvStringifierFactory.createArrayCsvStringifier({
                                                                                        ~
 31             header: params.header,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
 34             alwaysQuote: params.alwaysQuote
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 35         });
    ~~~~~~~~~

Please consider publishing the package with only JS files, along with type declarations (d.ts files).

what1s1ove avatar Oct 28 '23 10:10 what1s1ove