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

Typescript error in PolygonGraphics #6831

Closed
golyalpha opened this issue Jul 24, 2018 · 3 comments
Closed

Typescript error in PolygonGraphics #6831

golyalpha opened this issue Jul 24, 2018 · 3 comments

Comments

@golyalpha
Copy link

golyalpha commented Jul 24, 2018

The outlineColor property of the options object is incorrectly typed.
If I provide the property with a ColorMaterialProperty object, TypeScript is silent, but the outline is not rendered, where as, if I provide it with a Color object, TypeScript screams about missing property isConstant in the object, but Cesium renders the outline successfully.

new PolygonGraphics({
    hierarchy: new PolygonHierarchy(measure.coordinates.map(coords => (
        Cartesian3.fromDegrees(coords[0], coords[1])
    ))),
    height: 0,
    material: fillMat,
    outline: true,
    outlineColor: Color.RED
})

image
fillMat definition:

const fillMat = new ColorMaterialProperty(new Color(1, 1, 1, 0.4));
@hpinkos
Copy link
Contributor

hpinkos commented Jul 24, 2018

Hello @golyalpha, CesiumJS does not officially support TypeScript. There has been some discussion here: #5717

We're always happy to take a pull request to make Cesium easier to use with TypeScript! For example, see this PR with tds-jsdoc fixes: #6767

@hpinkos hpinkos closed this as completed Jul 24, 2018
@mramato
Copy link
Contributor

mramato commented Jul 24, 2018

Just to clarify, we officially support using Cesium in TypeScript applications, we just do not have an official TypeScript definition file. Lots of our users are using TS for development.

In your specific case, outlineColor can either be a Color or a Property that evaluates to a color. It can not be a ColorMaterialProperty as outlineColor is not a Material.

@golyalpha
Copy link
Author

Well, as I said, TS is complaining about missing prop isConstant on the Color object.

ghost pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Jul 28, 2018
* Fix typing error in PolygonGraphics

The property outlineColor of PolygonGraphics can accept both Property and Color types.
[Discussion on AnalyticalGraphicsInc/cesium](CesiumGS/cesium#6831)

* Update version

* Removed the Color type from outlineColor typedef.
briandk pushed a commit to briandk/DefinitelyTyped that referenced this issue Aug 7, 2018
* Fix typing error in PolygonGraphics

The property outlineColor of PolygonGraphics can accept both Property and Color types.
[Discussion on AnalyticalGraphicsInc/cesium](CesiumGS/cesium#6831)

* Update version

* Removed the Color type from outlineColor typedef.
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

3 participants