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

Compilation issue with ParseHelpers #84

Open
PavolSvidran opened this issue Nov 30, 2021 · 3 comments
Open

Compilation issue with ParseHelpers #84

PavolSvidran opened this issue Nov 30, 2021 · 3 comments
Labels

Comments

@PavolSvidran
Copy link

PavolSvidran commented Nov 30, 2021

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
Copy link
Member

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
Copy link
Author

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

@PavolSvidran
Copy link
Author

Can you fix it for now with simple replacement of:

  • entity.extendedData = entity.extendedData || {}; for
  • entity.extendedData = entity.extendedData || {customStrings: [], applicationName: ""}; at lines 131 & 136 in ParseHelpers.ts???

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

No branches or pull requests

2 participants