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

Updating Common Types Package #1

Open
itrew opened this issue Nov 7, 2018 · 5 comments
Open

Updating Common Types Package #1

itrew opened this issue Nov 7, 2018 · 5 comments

Comments

@itrew
Copy link
Owner

itrew commented Nov 7, 2018

This issue is for keeping track of experimental updates to the common types package. Work is being done on the 'update-common-types' branch.

Overview

File organization

Certain types have been split out from index.ts into their own separate files for more a little more organization and easier maintenance.

Suffix Convention

In order to be more explicit in what values are stored with coordinates, I have adapted a convention from other ESRI products that adds a suffix to the name of the geometry type. This allows for typescript to check that the hasZ and hasM properties on an object are correctly set for an object. The following rules apply:

  • If the object is 2-dimensional and does not have M values on the vertices, no suffix is added e.g. IMultipoint.
  • If the object is 3-dimensional (has vertical coordinates) and does not contain M values on the vertices, a 'Z' suffix is added e.g. IMultipointZ.
  • If the object is 2-dimensional and has M values on the vertices, an 'M' suffix is added e.g. IMultipointM.
  • If the object is 3-dimensional (has vertical coordinates) and has M values on the vertices, a 'ZM' suffix is added e.g. IMultipointZM.
  • If the type is a union type that covers multidimensional types, an 'Any' suffix is added e.g. MultipointAny.

This naming convention has been applied to Points, Positions, Multipoints, Curves, Polylines, Polygons, Geometries (generic type), & Feature Sets.

Typescript Generics

A lot of the types have had generics added to them to allow for developers to be a little more explicit if they so desire. When being more explicit, you can also gain the benefits of intellisense for correct property suggestions. Find out more information about the generics implementation in the 'New Features' section.

Breaking Updates to Existing References

  1. Converted interface ISpatialReference to type SpatialReference.
    The type SpatialReference is now a union of the IWKIDSpatialReference & IWKTSpatialReference interfaces. See Spatial References in the 'New Features' section.

    • Reason: Instead of having a single interface that combines the shapes of both spatial reference interfaces into a single one, there is now a single union type. This allows each spatial reference interface's shape to be more explicit.
  2. Renamed interface IGeometry to IGeometryBase.
    See Geometries in the 'New Features' section for more details on alternatives.

    • Reason: The IGeometry interface name implied a more comprehensive type than it actually was.
  3. Removed type ElipticArc.

    • Reason: 'Eliptic' is spelled incorrectly, and it was simply a pointer to the IArc type. Was not referenced anywhere else.
  4. Renamed type JsonCurve to CurveAny.
    See Curves in the 'New Features' section.

    • Reason: To follow the pattern used for geometry types (PointAny, MultipointAny, etc.), the same convention was applied to curve segments.
  5. Renamed IPolylineWithCurves to ICurvedPolyline

    • Reason: After applying the pattern for geometries that includes Z or M suffixes, it looks cleaner than having something like IPolylineZMWithCurves.
  6. Renamed IPolygonWithCurves to ICurvedPolygon

    • Reason: After applying the pattern for geometries that includes Z or M suffixes, it looks cleaner than having something like IPolygonZMWithCurves.
  7. Renamed type Position2D to Position.
    See Positions in the 'New Features' section for more information.

    • Reason: Type Position is now considered strictly 2-dimensional with PositionAny taking the generic position type.
  8. Renamed the following string literal types:
    esriFieldType to EsriFieldType
    esriGeometryType to EsriGeometryType
    esriUnits to EsriUnits

    • Reason: To follow a more consistent naming convention with all types and interfaces starting with a capital letter.

Non-breaking Updates to Existing References

  1. Changed the shape of IField.
    Changed type of domain? from any to string. Removed exactMatch?.

    • Reason: The domain property should reference a domain name identified by a string. I didn't find any more documentation on exactMatch to keep it at this level. It may be better suited on something that extends IField.
  2. IFeatureSet no longer extends IHasZM as it is now strictly a 2-dimensional feature set.
    See Feature Sets in the 'New Features' section for more info.

    • Reason: Following the convention of Z/M/ZM/Any suffixes outlined in the overview.
  3. IMultipoint no longer extends IHasZM as it is now strictly a 2-dimensional multipoint.
    See Multipoints in the 'New Features' section for more info.

    • Reason: Following the convention of Z/M/ZM/Any suffixes outlined in the overview.
  4. IPoint no longer extends IHasZM as it is now strictly a 2-dimensional point.
    See Points in the 'New Features' section for more info.

    • Reason: Following the convention of Z/M/ZM/Any suffixes outlined in the overview.
  5. IPolyline no longer extends IHasZM as it is now strictly a 2-dimensional polyline.
    See Polylines in the 'New Features' section for more info.

    • Reason: Following the convention of Z/M/ZM/Any suffixes outlined in the overview.
  6. IPolygon no longer extends IHasZM as it is now strictly a 2-dimensional polygon.
    See Polygons in the 'New Features' section for more info.

    • Reason: Following the convention of Z/M/ZM/Any suffixes outlined in the overview.
  7. Type Position is now strictly 2-dimensional.
    See Positions in the 'New Features' section for more info.

    • Reason: Following the convention of Z/M/ZM/Any suffixes outlined in the overview.

New features

Generics

As mentioned in the overview, a number of the interfaces have been updated to include generic type parameters, allowing developers to be more explicit if they so desire. This has the added benefit of stricter type checking, potentially reduced runtime errors, and more accurate intellisense tips. The generics have default values included in them so they are not always required but can be handy if they are used. For example, it can help guard instances like adding a polygon feature to a point feature set, or assigning an incompatible spatial reference. Consider the following example:

// Create a polygon.
const examplePolygon: IPolygon = {
  rings: [[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]],
  spatialReference: {
    wkid: 3857
  }
}

// Adding the polygon to a feature set with generic guarding.
// The third generic specifies that the feature set should contain point features.
const exampleFeatureSetWithGuard: IFeatureSet<any, any, IPoint> = {
  // Error: Type 'esriGeometryPolygon' cannot be assigned to type 'esriGeometryPoint'.
  // This is due to a conditional type that assigns the correct geometryType string to the
  // specified feature set geometry generic.
  geometryType: 'esriGeometryPolygon',
  spatialReference: {
    wkid: 3857
  },
  fields: [],
  features: [
    {
      // Error: Type IPolygon cannot be assigned to type IPoint.
      geometry: examplePolygon,
      attributes: {}
    }
  ]
}

// Adding the polygon to a feature set without generic guarding.
// Would end up with a runtime error most likely.
const exampleFeatureSetWithoutGuard: IFeatureSet = {
  // No error since no geometry type generic was specified.
  geometryType: 'esriGeometryPoint',
  spatialReference: {
    wkid: 3857
  },
  fields: [],
  features: [
    {
      // No error given even though it's incompatible with the geometryType property.
      geometry: examplePolygon,
      attributes: {}
    }
  ]
}

The following generic types were added where applicable:

  • SpatialReference - Adds the ability to define the spatial reference for a feature set, geometry, or extent.
  • Position - For base types only, but it allows the position array types to be defined. This isn't meant to be used externally for any effect.
  • Curve Or Position - For base types only, but it allows the position array types to be defined. This isn't meant to be used externally for any effect. Replaces the position generic on geometries with curves.
  • Feature Attributes - Adds the ability to define the shape of a feature's attribute object. This generic can be applied to a feature, field (to make sure a field key is in the feature attribute object), or a feature set.
  • Geometry Type - Adds the ability to define the type of geometry that a spatial feature or a feature set contains.

Spatial References

In order to make the two shapes of a spatial reference interface explicit, the existing ISpatialReference was broken into the two different types discussed here, the WKID and WKT formats. These two new interfaces are IWKIDSpatialReference and IWKTSpatialReference. To make things a little easier, the union type SpatialReference was added as a replacement for the old ISpatialReference interface.

IWKIDSpatialReference

A spatial reference built off of a well-known ID.

interface IWKIDSpatialReference {
    wkid: number;
    latestWkid?: number;
    vcsWkid?: number;
    latestVcsWkid?: number;
};

IWKTSpatialReference

A spatial reference defined in the well-known text format.

interface IWKTSpatialReference {
    wkt: string;
};

SpatialReference

A convenient union type for when the shape of the spatial reference object isn't known.

type SpatialReference = IWKIDSpatialReference | IWKTSpatialReference;

Positions

These are the types that make up the points for multipoints, paths for polylines, and rings for polygons. These types typically won't be used outside of the geometry type definitions in the library, as they are pretty basic. They are, however, important to ensure that the geometry type has the correct position type.

// A generic position type.
type PositionAny = Position
  | PositionZ
  | PositionM
  | PositionZM;

//A 2-dimensional position.
type Position = [number, number];

//A 3-dimensional position.
type PositionZ = [number, number, number];

//A 2-dimensional position with M value.
type PositionM = [number, number, number?];

//A 3-dimensional position with M value.
type PositionZM = [number, number, number, number?];

Curves

Like positions, these are the types that can included in curvePaths for curved polylines, and curveRings for curved polygons. They are a union of the 4 different type of arcs (IArc, ICircularArc, IBezierCurve and IOldCircularArc). Again, these types typically won't be used outside of the geometry type definitions in the library.

// A generic curve type.
type CurveAny = IArc
  | IBezierCurve
  | ICircularArc
  | IOldCircularArc;

// A 2-dimensional curve.
type Curve = IArc<Position>
  | IBezierCurve<Position>
  | ICircularArc<Position>
  | IOldCircularArc<Position>;

// A 3-dimensional curve.
type CurveZ = IArc<PositionZ>
  | IBezierCurve<PositionZ>
  | ICircularArc<PositionZ>
  | IOldCircularArc<PositionZ>;

// A 2-dimensional curve with M values.
type CurveM = IArc<PositionM>
  | IBezierCurve<PositionM>
  | ICircularArc<PositionM>
  | IOldCircularArc<PositionM>;

// A 3-dimensional curve with M values.
type CurveZM = IArc<PositionZM>
  | IBezierCurve<PositionZM>
  | ICircularArc<PositionZM>
  | IOldCircularArc<PositionZM>;

Points

The IPoint interface has been limited to a simple 2-dimensional point location after following the naming convention discussed in the overview. Several additional interfaces have been added following the same naming convention to cover points with either Z or M values.

// A generic point.
type PointAny<
  SR extends SpatialReference = SpatialReference
> = IEmptyPoint<SR>
  | IPoint<SR>
  | IPointZ<SR>
  | IPointM<SR>
  | IPointZM<SR>;

// A point with no location in space.
interface IEmptyPoint<
  SR extends SpatialReference = SpatialReference
> extends IPointBase<SR> {
  x: "NaN" | null;
}

// A 2-dimensional point.
interface IPoint<
  SR extends SpatialReference = SpatialReference
> extends IPointBase<SR> {
  x: number;
  y: number;
}

// A 3-dimensional point.
interface IPointZ<
  SR extends SpatialReference = SpatialReference
> extends IPoint<SR> {
  z: number;
}

// A 2-dimensional point with M values.
interface IPointM<
  SR extends SpatialReference = SpatialReference
> extends IPoint<SR> {
  m: number | null;
}

// A 3-dimensional point with M values.
interface IPointZM<
  SR extends SpatialReference = SpatialReference
> extends IPointZ<SR>, IPointM<SR> {}

Multipoints

Like the other geometry types, the IMultipoint interface has been limited to a simple 2-dimensional multipoint location after following the naming convention discussed in the overview. Several additional interfaces have been added following the same naming convention to cover multipoints with either Z or M values.

// A generic multipoint.
type PointAny<
  SR extends SpatialReference = SpatialReference
> = IEmptyPoint<SR>
  | IPoint<SR>
  | IPointZ<SR>
  | IPointM<SR>
  | IPointZM<SR>;

// A multipoint with no location in space.
interface IEmptyMultipoint<
  SR extends SpatialReference = SpatialReference
> extends IMultipointBase<SR> {
  points: [];
}

// A 2-dimensional multipoint.
interface IMultipoint<
  SR extends SpatialReference = SpatialReference
> extends IMultipointBase<SR, Position>, IZDisabled, IMDisabled {}

// A 3-dimensional multipoint.
interface IMultipointZ<
  SR extends SpatialReference = SpatialReference
> extends IMultipointBase<SR, PositionZ>, IZEnabled, IMDisabled {}

// A 2-dimensional multipoint with M values.
interface IMultipointM<
  SR extends SpatialReference = SpatialReference
> extends IMultipointBase<SR, PositionM>, IZDisabled, IMEnabled {}

// A 3-dimensional multipoint with M values.
interface IMultipointZM<
  SR extends SpatialReference = SpatialReference
> extends IMultipointBase<SR, PositionZM>, IZEnabled, IMEnabled {}

Polylines

Like the other geometry types, the IPolyline interface has been limited to a simple 2-dimensional polyline location after following the naming convention discussed in the overview. Several additional interfaces have been added following the same naming convention to cover polylines with either Z or M values. The IPolylineWithCurves interface has been renamed to to ICurvePolyline for consistent use of the suffix rule.

// A generic polyline.
type PolylineAny<
  SR extends SpatialReference = SpatialReference
> = IEmptyPolyline<SR>
  | IPolyline<SR>
  | IPolylineZ<SR>
  | IPolylineM<SR>
  | IPolylineZM<SR>
  | ICurvePolyline<SR>
  | ICurvePolylineZ<SR>
  | ICurvePolylineM<SR>
  | ICurvePolylineZM<SR>;

// A polyline with no location in space.
interface IEmptyPolyline<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR> {
  paths: [];
}

// A 2-dimensional polyline.
interface IPolyline<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, Position>, IZDisabled, IMDisabled {}

// A 3-dimensional polyline.
interface IPolylineZ<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, PositionZ>, IZEnabled, IMDisabled {}

// A 2-dimensional polyline with M values.
interface IPolylineM<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, PositionM>, IZDisabled, IMEnabled {}

// A 3-dimensional polyline with M values.
interface IPolylineZM<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, PositionZM>, IZEnabled, IMEnabled {}

// A curved 2-dimensional polyline.
interface IPolyline<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, Position | Curve>, IZDisabled, IMDisabled {}

// A curved 3-dimensional polyline.
interface IPolylineZ<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, PositionZ | CurveZ>, IZEnabled, IMDisabled {}

// A curved 2-dimensional polyline with M values.
interface IPolylineM<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, PositionM | CurveM>, IZDisabled, IMEnabled {}

// A curved 3-dimensional polyline with M values.
interface IPolylineZM<
  SR extends SpatialReference = SpatialReference
> extends IPolylineBase<SR, PositionZM | CurveZM>, IZEnabled, IMEnabled {}

Polygons

Like the other geometry types, the IPolygon interface has been limited to a simple 2-dimensional polygon location after following the naming convention discussed in the overview. Several additional interfaces have been added following the same naming convention to cover polygons with either Z or M values. The IPolygonWithCurves interface has been renamed to to ICurvePolygon for consistent use of the suffix rule.

// A generic polygon.
type PolygonAny<
  SR extends SpatialReference = SpatialReference
> = IEmptyPolygon<SR>
  | IPolygon<SR>
  | IPolygonZ<SR>
  | IPolygonM<SR>
  | IPolygonZM<SR>
  | ICurvePolygon<SR>
  | ICurvePolygonZ<SR>
  | ICurvePolygonM<SR>
  | ICurvePolygonZM<SR>;

// A polygon with no location in space.
interface IEmptyPolygon<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR> {
  rings: [];
}

// A 2-dimensional polygon.
interface IPolygon<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, Position>, IZDisabled, IMDisabled {}

// A 3-dimensional polygon.
interface IPolygonZ<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, PositionZ>, IZEnabled, IMDisabled {}

// A 2-dimensional polygon with M values.
interface IPolygonM<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, PositionM>, IZDisabled, IMEnabled {}

// A 3-dimensional polygon with M values.
interface IPolygonZM<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, PositionZM>, IZEnabled, IMEnabled {}

// A curved 2-dimensional polygon.
interface IPolygon<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, Position | Curve>, IZDisabled, IMDisabled {}

// A curved 3-dimensional polygon.
interface IPolygonZ<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, PositionZ | CurveZ>, IZEnabled, IMDisabled {}

// A curved 2-dimensional polygon with M values.
interface IPolygonM<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, PositionM | CurveM>, IZDisabled, IMEnabled {}

// A curved 3-dimensional polygon with M values.
interface IPolygonZM<
  SR extends SpatialReference = SpatialReference
> extends IPolygonBase<SR, PositionZM | CurveZM>, IZEnabled, IMEnabled {}

Envelopes

In addition to the interface IEnvelope, the interface IEmptyEnvelope was added. This is for envelopes that have no location in space. A union between these two types was also added as EnvelopeAny.

// A generic envelope.
type EnvelopeAny<
  SR extends SpatialReference = SpatialReference
> = IEmptyEnvelope<SR>
  | IEnvelope<SR>;

// An envelope with no location in space.
interface IEmptyEnvelope<
  SR extends SpatialReference = SpatialReference
> extends IEnvelopeBase<SR> {
  xmin: "NaN" | null;
}

Geometries

The original IGeometry interface was just an object with a single spatialReference property. As an alternative, there is now a more generic union type named GeometryAny that encompasses each of the 5 different geometry types. These helper types also follow the dimensional suffix rule for additional typings.

// A generic geometry.
type GeometryAny<
  SR extends SpatialReference = SpatialReference
> = PointAny<SR>
  | MultipointAny<SR>
  | PolylineAny<SR>
  | PolygonAny<SR>
  | EnvelopeAny<SR>;

// A 2-dimensional geometry.
type Geometry<
  SR extends SpatialReference = SpatialReference
> = IPoint<SR>
  | IEmptyPoint<SR>
  | IMultipoint<SR>
  | IEmptyMultipoint<SR>
  | IPolyline<SR>
  | IEmptyPolyline<SR>
  | ICurvePolyline<SR>
  | IPolygon<SR>
  | IEmptyPolygon<SR>
  | ICurvePolygon<SR>;

// A 3-dimensional geometry.
type GeometryZ<
  SR extends SpatialReference = SpatialReference
> = IPointZ<SR>
  | IMultipointZ<SR>
  | IPolylineZ<SR>
  | ICurvePolylineZ<SR>
  | IPolygonZ<SR>
  | ICurvePolygonZ<SR>;

// A 2-dimensional geometry with M values.
type GeometryM<
  SR extends SpatialReference = SpatialReference
> = IPointM<SR>
  | IMultipointM<SR>
  | IPolylineM<SR>
  | ICurvePolylineM<SR>
  | IPolygonM<SR>
  | ICurvePolygonM<SR>;

// A 3-dimensional geometry with M values.
type GeometryZM<
  SR extends SpatialReference = SpatialReference
> = IPointZM<SR>
  | IMultipointZM<SR>
  | IPolylineZM<SR>
  | ICurvePolylineZM<SR>
  | IPolygonZM<SR>
  | ICurvePolygonZM<SR>;

Feature Attributes

To allow for more explicit typings on a feature, the simple IFeatureAttributes was created. This doesn't do much on its own, but when specify it as a generic for feature sets you are able to check types against a features attribute property. For example:

// Define the shape of the attributes interface.
interface IExampleAttributes {
  property1: string,
  property2: number
}

// Create the feature.
const exampleFeature: IFeature<IExampleAttributes> = {
  geometry: {
    x: null,
    spatialReference: {
      wkid: 3857
    }
  },
  attributes: {
    property1: 'example',
    // Error because '1' isn't assignable to number.
    property2: '1'
  }
}

An additional benefit to the IFeatureAttribute generic is that it checks each field in the feature set's fields property for a corresponding field in the attributes interface.

// Create the feature set.
const exampleFeatureSet: IFeatureSet<IExampleAttributes> = {
  features: [
    exampleFeature
  ],
  geometryType: 'esriGeometryPolygon',
  spatialReference: {
    wkid: 3857
  },
  fields: [
    {
      // Error because 'property3' is not a key in IExampleAttributes.
      name: 'property3',
      type: 'esriFieldTypeString'
    }
  ]
}

Feature Sets

In order to keep make sure that the correct values for dimensional properties (hasZ,hasM) are assigned on a feature set, the suffix rule was followed for these as well. One exception to this rule is for IFeatureSetBase, which is designed to be a set of features that do not have any geometry associated with them (e.g. tables).

// A generic feature set.
type FeatureSetAny<
  FA extends IFeatureAttributes = IFeatureAttributes,
  SR extends SpatialReference = SpatialReference
> = IFeatureSetBase<FA>
  | IFeatureSet<FA, SR>
  | IFeatureSetZ<FA, SR>
  | IFeatureSetM<FA, SR>
  | IFeatureSetZM<FA, SR>;

// A non-spatial feature set.
interface IFeatureSetBase<
  FA extends IFeatureAttributes = IFeatureAttributes
> {
  fields: Array<IField<FA>>;
  features: Array<IFeatureBase<FA>>;
  objectIdFieldName?: keyof FA;
  globalIdFieldName?: keyof FA;
  displayFieldName?: keyof FA;
}

// A generic spatial feature set.
interface ISpatialFeatureSet<
  FA extends IFeatureAttributes = IFeatureAttributes,
  SR extends SpatialReference = SpatialReference,
  G extends GeometryAny<SR> = GeometryAny<SR>
> extends IFeatureSetBase<FA> {
  features: Array<IFeature<FA, G>>;
  geometryType: ConditionalGeometryType<G>;
  spatialReference: SR;
}

// A collection of 2-dimensional features.
interface IFeatureSet<
  FA extends IFeatureAttributes = IFeatureAttributes,
  SR extends SpatialReference = SpatialReference,
  G extends Geometry<SR> = Geometry<SR>
> extends ISpatialFeatureSet<FA, SR, G>, IZDisabled, IMDisabled {}

// A collection of 3-dimensional features.
interface IFeatureSetZ<
  FA extends IFeatureAttributes = IFeatureAttributes,
  SR extends SpatialReference = SpatialReference,
  G extends GeometryZ<SR> = GeometryZ<SR>
> extends ISpatialFeatureSet<FA, SR, G>, IZEnabled, IMDisabled {}

// A collection of 2-dimensional features with M values.
interface IFeatureSetM<
  FA extends IFeatureAttributes = IFeatureAttributes,
  SR extends SpatialReference = SpatialReference,
  G extends GeometryM<SR> = GeometryM<SR>
> extends ISpatialFeatureSet<FA, SR, G>, IZDisabled, IMEnabled {}

// A collection of 3-dimensional features with M values.
interface IFeatureSetZM<
  FA extends IFeatureAttributes = IFeatureAttributes,
  SR extends SpatialReference = SpatialReference,
  G extends GeometryZM<SR> = GeometryZM<SR>
> extends ISpatialFeatureSet<FA, SR, G>, IZEnabled, IMEnabled {}
itrew added a commit that referenced this issue Nov 7, 2018
…al and explicit.

Added functionality in terms of generics to geometry and feature types.
Reorganized types to a more
conventional standard.
Split out like types into their own files.
Changes tracked in #1.

AFFECTS PACKAGES:
@esri/arcgis-rest-common-types

BREAKING CHANGE:
Converted interface ISpatialReference to type SpatialReference.|Shape of interface IFeature shape
moved to ISpatialFeature.|Renamed interface IGeometry to IGeometryBase.|Removed type
ElipticArc.|Renamed type JsonCurve to CurveAny.|Renamed IPolylineWithCurves to
ICurvedPolyline.|Renamed IPolygonWithCurves to ICurvedPolygon.|Renamed type Position2D to
Position.|Renamed the following string literal types: esriFieldType to EsriFieldType,
esriGeometryType to EsriGeometryType,esriUnits to EsriUnits.
@itrew
Copy link
Owner Author

itrew commented Nov 9, 2018

To-do:

  • Rename type IHasZM to HasZM. With the updates, IHasZM is no longer an interface but an intersection type between IHasZ and IHasM so it no longer requires the 'I' prefix. This will be a breaking change.

@JeffJacobson
Copy link

Changed the shape of IField.
Changed type of domain? from any to string. Removed exactMatch?.

Reason: The domain property should reference a domain name identified by a string. I didn't find any more documentation on exactMatch to keep it at this level. It may be better suited on something that extends IField.

exactMatch came from the Web Map Specification, but I'm not sure what it's used for. Also, domain is not a string according to that documentation.

Perhaps the Web Map Specification stuff needs to be separated somehow if it is conflicting with types defined elsewhere in the REST API.

@itrew
Copy link
Owner Author

itrew commented Apr 16, 2019

Wasn't aware of the Web Map Spec. That might make some more sense to split that out so that there is the rest-types and the webmap spec types.

And good catch on the domain's. You are correct. And by the looks of it, it is really only on the layerDefinition object of the webmap spec.

Based on the discussion (Esri#515 (comment)), maybe these updates would be better suited for @types. If that's the case, would you be open to working on this with me?

And if I'm not mistaken, we've actually met. I believe you gave some of us at DFW a demo of some of the work at WSDOT. Crazy stumbling into each other on here.

@JeffJacobson
Copy link

I'd forgotten that I'd done this, but I made a very basic ArcGIS REST API type definition at @types. If I remember correctly I found it difficult to maintain due to the requirement that everything be defined in a single index.d.ts file.

I'm not sure what the best way to handle these types is.

@itrew
Copy link
Owner Author

itrew commented Apr 17, 2019

Ahh gotcha. I've never contributed there so you have more experience than I do. Maybe I'll wait to see how some things shake out with the main repo. It looks like there is talks of creating a -types package.

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

No branches or pull requests

2 participants