Skip to content

Consolidate FragmentsModel / SingleThreadedFragmentsModel return types #216

@ShaMan123

Description

@ShaMan123

Description 📝

There are methods that do not share the same signature between FragmentsModel / SingleThreadedFragmentsModel.
This is undesirable, making the writing of helper functions accepting a model arg awkward.

export async function hashItemsWithGeometry(
  model: SingleThreadedFragmentsModel | FragmentsModel,
  precision = GEOMETRY_FLOATING_POINT_PRECISION
) {
  const value: number[] | Item[] = await model.getItemsWithGeometry(); // awkward
  await model.getItemsIdsWithGeometry(); // doesn't exist on SingleThreadedFragmentsModel, viable solution if exists
}

Suggested solution 💡

Consolidate signatures so that both classes have an identical (or almost identical) interface (I think SingleThreadedFragmentsModel can remain sync though)

Alternative ⛕

I could use instanceof to differentiate between the 2

Additional context ☝️

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureSomething new that we could do

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions