NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.6k stars 309 forks source link

TS2314: Generic type 'Array<T>' requires 1 type argument #74

Closed tomasbruckner closed 6 years ago

tomasbruckner commented 6 years ago

Hello,

When I try to import fast-xml-parse in TypeScript, it throws TS2314 error.

Input

Please include your sample code or steps to reproduce here

// index.ts
import { parse } from "fast-xml-parser"

parse('<html></html>')

Output

$ tsc index.ts 
node_modules/fast-xml-parser/src/parser.d.ts(34,25): error TS2314: Generic type 'Array<T>' requires 1 type argument(s).

Expected data

No error is thrown.

Additional info

$ tsc -v
Version 2.7.2
amitguptagwl commented 6 years ago

type script in not fully implemented in fast-xml-parser yet. Please refer #71 .If it cause any issue. I can remove parser.d.ts from fxp.

tomasbruckner commented 6 years ago

@amitguptagwl it should be fixed with PR #75 If I understood NIMN schema correctly, Array contains either object or string. Can anybody confirm?

amitguptagwl commented 6 years ago

@tomasbruckner Thanks for the PR. For the Nimn format, an array can contain either a string or object or an array.

tomasbruckner commented 6 years ago

@amitguptagwl Could you please publish the lastest version to NPM? I still see 3.3.8 on NPM site and I need the bug fix in my project :)

amitguptagwl commented 6 years ago

Done :)

tomasbruckner commented 6 years ago

Thanks!