gdsestimating / dxf-parser

A javascript parser for DXF files. It reads DXF file strings into one large javascript object with more readable properties and a more logical structure.
MIT License
453 stars 140 forks source link

Compilation issue with ParseHelpers #84

Open PavolSvidran opened 2 years ago

PavolSvidran commented 2 years ago

Hi, iam updating packages in my project and after dxf-parser update i got compilation error:

Error: node_modules/dxf-parser/src/ParseHelpers.ts:112:4 - error TS2322: Type '{ customStrings: string[]; applicationName: string; } | {}' is not assignable to type '{ customStrings: string[]; applicationName: string; }'. Type '{}' is missing the following properties from type '{ customStrings: string[]; applicationName: string; }': customStrings, applicationName

112 entity.extendedData = entity.extendedData || {};

image

as you can see IEntity.extendedData has 2 required params but you are assigning {} in some case.

Can you fix it ASAP, i want to update this package because it is now in TS with types but i cannot do it with compilation error.

Btw best solution should be to use somethink like DxfEntityAny instead of IEntity.

export type DxfEntityAny = I3DfaceEntity|IArcEntity|IAttdefEntity|ICircleEntity|IDimensionEntity|IEllipseEntity|IInsertEntity|ILineEntity| ILwpolylineEntity|IMtextEntity|IPointEntity|IPolylineEntity|ISolidEntity|ISplineEntity|ITextEntity| IVertexEntity;

bzuillsmith commented 2 years ago

Ah, yes. I see. Interesting that didn't come up for me. Must be some kind of stricter compilation option?

After reading more about XData, I see our solution is not quite right. https://ezdxf.readthedocs.io/en/stable/tutorials/custom_data.html#tut-custom-data

I think we need to make deprecate customStrings and just create an array of (group code, value) tuples. We don't know the meaning of these codes in the context of XData so we have to provide the raw data.

PavolSvidran commented 2 years ago

Hi, when you estimate that this error will be fixed?

PavolSvidran commented 9 months ago

Can you fix it for now with simple replacement of: