Definitelytyped: @types/geojson is broken

Created on 28 Nov 2017  Â·  26Comments  Â·  Source: DefinitelyTyped/DefinitelyTyped

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/geojson package and had problems.
  • [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ ] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [ ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @Cobster @atd-schubert @JeffJacobson

If you do not mention the authors the issue will be ignored.

The newest version of geojson is: 7946.0.0

Which fails hard, when installing d3-geo, with the following:

ERROR in node_modules/@types/d3-geo/index.d.ts(39,19): error TS2694: Namespace '"C:/Users/user/Desktop/Projects/ansyn/node_modules/@types/d3-geo/node_modules/@types/geojson/index"' has no exported member 'CoordinateReferenceSystem'.

I think it is a bug, and that this version shouldn't have gone up.. (weird version number, bugs)

Most helpful comment

We have just released an interim patch for the d3-geo TS definitions (version 1.9.4). Until completion of an impact assessment and resulting re-factoring of d3-geo, the patch replaced the dependency on CoordinateReferenceSystem with a literal. I.e., _for now_, it retains the crs optional property of the ExtendedGeometryCollection<GeometryType extends GeoGeometryObjects> interface as a conservative strategy.

I am reviewing whether we should start a new issue to consider the change impacts and refactoring, or re-purpose one of the already open ones.

All 26 comments

Same for me. This seems to be related with commit #89667eb5cbee013f697ef1adef6582caa62385f3 by @JeffJacobson where the coordinate reference system was removed from types/geojson...

Thanks for pointing the right direction. It seems like the version then shouldn't be 7946 (as the RFC number).
This kills @types/d3, as it depends on @types/d3-geo, which depends on @types/geojson any...

@knorzel Did you find a workaround? (instead of manually changing the version)

@AmitMY As a temporary workaround, I added "@types/geojson": "<7946.0.0", to my project's package.json to force npm install a previous version of geojson. This is still compatible with the dependecy definitions for d3. However, I did not test yet, if the old versions of geojson introduce other bugs when used with the latest d3...

I added "@types/geojson": "1.0.6" but with no luck, it just installed 2 versions

Try npm uninstall @types/[email protected]. This should uninstall the buggy version...

I face this issue in my angular 2 project. I just put the "@types/geojson:"1.0.6" after "@types/d3": "^4.12.0" for workaround

Same here. How could this happen on such popular repo ...

Can't uninstall via command npm uninstall @types/[email protected]
My error :
npm ERR! path /home/asiko/work/my-softserve/frontend/mySoftServe/node_modules/d3-ng2-service
npm ERR! code EISGIT
npm ERR! git /home/asiko/work/my-softserve/frontend/mySoftServe/node_modules/d3-ng2-service: Appears to be a git repo or submodule.
npm ERR! git /home/asiko/work/my-softserve/frontend/mySoftServe/node_modules/d3-ng2-service
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

@knorzel can you help with it?

Take a look at the beginning of the type definition and according to that on the RFC. The Coordinate Reference System is always WGS84 in GeoJSON now and the interface have been removed.

it has broken our production build all of sudden. please provide a fix at the earliest.

thanks a lot !

This is the dependency in _d3-geo_: "dependencies": { "@types/geojson": "*" } , could be a little more strict. My working copy of @types/geojson was 1.0.0.

I'm having the same issue, tsc broken. As a workaround I'm using "@types/geojson":"^1.0.6" and it works.

"dependencies": {
    "@types/geojson": "*"
  },

This is from @types/highcharts. This could be a little more strict too.

@simonnagel GeoJSON is not a normal software, it is a specification. I don't think it brings any advantage to make the version more strict.

The problem has not its reason in a wrong type-definition of GeoJSON. d3-geo have a crs property in its type-definition. See #21801 for more information...

As a workaround you can try to upgrade in dependencies d3-ng2-service to "d3-ng2-service": "^1.23.0" and downgrade "@types/geojson": "1.0.6", that should work.

I'm still not sure why D3 Geo is in the base D3 typed file and not separate so plugins like geojson are not included automatically

See discussion in PR #21801.

@Martinspire The definitions for d3 correspond to the constituent modules of standard D3 bundle, which includes d3-geo.

We have just released an interim patch for the d3-geo TS definitions (version 1.9.4). Until completion of an impact assessment and resulting re-factoring of d3-geo, the patch replaced the dependency on CoordinateReferenceSystem with a literal. I.e., _for now_, it retains the crs optional property of the ExtendedGeometryCollection<GeometryType extends GeoGeometryObjects> interface as a conservative strategy.

I am reviewing whether we should start a new issue to consider the change impacts and refactoring, or re-purpose one of the already open ones.

@jasonhibbs et al. who asked for tighter version pinning, we tried (see discussion thread here). It seems, the previously available feature to use a package.json stub for version pinning is no longer supported by DefinitelyTyped.

Nice one @tomwanzek ✊

@AndriySikora I got the same error.

Resolved it by removing d3-ng2-service folder in node modules first. Then installed geojson v1.0.6. Then installed d3-ng2-service back.

@meijiao and @AndriySikora I have just published a patch release (1.23.1) of d3-ng2-service. This should address the issue by pulling in the latest version of the d3-geo definitions.

It is still a riddle to me, how the odd npm EISGIT error came about.

EDIT: Corrected patch release number.

@AmitMY can this issue be closed? It should be addressed. Thx, T.

Downgrading @types/d3-geo to 1.9.4 worked for me.

I think that this bug needs to be re-opened due to this commit which reintroduces a dependency on GeoJsonProperties.

nm, I've got something pulling in types/geojson v1.0.6 instead of 7946.0.2.

Was this page helpful?
0 / 5 - 0 ratings