If you know how to fix the issue, make a pull request instead.
@types/xxxx package and had problems.Definitions by: in index.d.ts) so they can respond.If you do not mention the authors the issue will be ignored.
Hi,
I have an issue while using the latest (1.0.6) @types / geojson, which is a part of @types / d3. In version 1.0.5. it was fine. This issue happens when I run npm run webpack-dev-server -- --config config/webpack.dev.js --open --progress --profile --watch --content-base src/. Webpack can be compiled successfully but having the following errors:
[at-loader] Checking finished with 5 errors
[at-loader] ./node_modules/@types/geojson/index.d.ts:94:54
TS1005: ',' expected.
[at-loader] ./node_modules/@types/geojson/index.d.ts:104:64
TS1005: ',' expected.
[at-loader] ./node_modules/@types/geojson/index.d.ts:94:56
TS2368: Type parameter name cannot be 'any'
[at-loader] ./node_modules/@types/geojson/index.d.ts:104:66
TS2368: Type parameter name cannot be 'any'
[at-loader] ./node_modules/@types/geojson/index.d.ts:106:21
TS2314: Generic type 'Feature<G, P, any>' requires 3 type argument(s).
Thank you
Ben
I'm also facing with the same issue, is there any way to restrict the version of type declarations in @types/d3
@benedict1986 @rohitb4: I think you use an outdated version of the TypeScript transpiler (tsc).
With #20932 we introduced an optional generic for the data in the properties of features. Now you are able to specify the type of the data optionally. These optional generics are only supported in TypeScript 2.3 and higher.
Try to update TypeScript like this:
npm i -g typescript
# OR (if you don't have the access rights)
sudo npm i -g typescript@latest
# In addition in your project folder
npm i --save-dev typescript@latest
...and run again your command again.
Please close this issue, if it works after the update!
If you still have problems please write the version of your globally installed TypeScript transpiler (run tsc --version) and the version of typescript you specify in your (development-) dependencies of the package.json file...
FYI: The nickname other author of this library is @cobster, not jacob-bruun...
I had the same issue in an angular project using d3-ng2-service.
I updated typescript from 2.2.2 to 2.6.1 (as suggested by atd-schubert) which fixed the problem.
Thanks, @atd-schubert, I updated typescript to 2.6.1 and the errors are fixed now.
I upgrade typescript to 2.4.0 and got the error fixed.
Removed the typing for 'P' and angular-cli did not complain about it..

to

@pnsvk: The following code is correct:
export interface Feature<G extends GeometryObject, P = any> extends GeoJsonObject {...}
You just have to update your TypeScript version to fix the error! If you get an error that contains P, any (with comma) instead of P = any (with equal) than it is just because of the older versions (< 2.3) of TypeScript. These versions does not support optional generics. The advantage of optional generics is, that P is as default of type any. You just have to specify P if you want to have more type-safety for your properties property in a feature otherwise it will work like the old type definition.
We had a similar issue, upgrading typescript to 2.4.0 as @gnusiva suggested seemed to do the trick.
--export interface Feature Change the respective code like this it is working for me
--export interface FeatureCollection
-- features: Array
"@types/d3": "4.10.0",
"@types/geojson": "1.0.5",
"@types/d3-collection": "1.0.5",
A recent change to d3-geo is the latest transitive dependency to break my continuous integration build even though I've frozen the @types/d3 package in my project's package.json. I've noticed that the package maintainers have helpfully tagged the maximum build versions by typescript minor version. I had hoped that I could freeze at typescript 2.2 by simply using the "ts2.2" tag for @types/d3 but it still pulls down the autogenerated package.json with "*" versions for all the dependencies.
"@types/d3": "ts2.2",
"@types/d3-geo": "ts2.2",
"@types/geojson": "ts2.2",
"@types/d3-collection": "ts2.2",
That change works for me until another dependency happens to do something that breaks when using the typescript 2.2 compiler.
In the long run, I think it would be beneficial to add a committed package.json for d3 that freezes the dependency versions at the top-level tag so that consumers can simply choose the tag that is appropriate for their typescript version.
@benedict1986 Can you close this issue?
@andy-ms Or you can close this issue, if you want to tidy up a bit... ;)
Most helpful comment
@benedict1986 @rohitb4: I think you use an outdated version of the TypeScript transpiler (
tsc).With #20932 we introduced an optional generic for the data in the
propertiesof features. Now you are able to specify the type of the data optionally. These optional generics are only supported in TypeScript 2.3 and higher.Try to update TypeScript like this:
...and run again your command again.
Please close this issue, if it works after the update!
If you still have problems please write the version of your globally installed TypeScript transpiler (run
tsc --version) and the version oftypescriptyou specify in your (development-) dependencies of thepackage.jsonfile...