You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code should also work as a Typescript block as well.
Actual Outcome
TS compiler says _comment does not accept string[]
TS2345: Argument of type '{ _declaration: { _attributes: { version: string; encoding: string; }; }; _comment: string[]; data: { some: string; }; }' is not assignable to parameter of type 'Element | ElementCompact'.
Type '{ _declaration: { _attributes: { version: string; encoding: string; }; }; _comment: string[]; data: { some: string; }; }' is not assignable to type 'ElementCompact'.
Types of property '_comment' are incompatible.
Type 'string[]' is not assignable to type 'string'.
Reproducing steps
Consider the following
This code works as a JS module.
This is also explicitly tested in https://github.com/nashwaan/xml-js/blob/f0376f265c4f299100fb4766828ebf066a0edeec/test/test-items.js#L42C30-L42C30
Expected Outcome
This code should also work as a Typescript block as well.
Actual Outcome
TS compiler says
_comment
does not accept string[]Because,
xml-js/types/index.d.ts
Line 22 in f0376f2
_comment
as string only.Proposed solution
can we make the type definition this intead?
The text was updated successfully, but these errors were encountered: