Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: address types of ArrayCsvStringifierParams and ObjectCsvStringifierParams #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

baseballyama
Copy link

It's unclear from which version of TypeScript this error started occurring, but at least in version 5.7.2, the following error appears, so I have made the necessary adjustments.

../../../node_modules/.pnpm/[email protected]/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         });
    ~~~~~~~~~

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

 40         const csvStringifier = this.csvStringifierFactory.createObjectCsvStringifier({
                                                                                         ~
 41             header: params.header,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
 45             alwaysQuote: params.alwaysQuote
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 46         });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant