Definitelytyped: d3-shape Cannot find name 'CanvasPathMethods'

Created on 10 Oct 2018  路  7Comments  路  Source: DefinitelyTyped/DefinitelyTyped

@tomwanzek @gustavderdrache @borisyankov

  • [X ] I tried using the @types/d3-format package and had problems.
  • [X ] I tried using the latest stable version of tsc.

Before TS upgrade: (no errors)

  • typescript 2.8.4
  • d3-format": "1.3.2"

After TS upgrade:

  • "typescript": "3.1.1"

Error message:

node_modules/@types/d3-shape/index.d.ts
(2273,19): Cannot find name 'CanvasPathMethods'.

Most helpful comment

I have the same issue after upgrading to angular 7 with typescript 3.1.1.
I think the problem is with @types/d3-shapes. Is there a fix to this?

All 7 comments

From what I can tell, the @types/d3-format package doesn't depend on @types/d3-shape, so it's likely that some other dependency (either in your package.json or pulled as a dependency of something else) is causing this problem for you.

That having been said, you're in luck! It looks like this issue was corrected in version 1.2.4 of @types/d3-shape - see this PR and the published index.d.ts on unpkg. Once you've updated that, you should be on your merry way.

You're right about other dependency pulling in @types/d3-shapes. No longer an issue for me. Thanks!

I have the same issue after upgrading to angular 7 with typescript 3.1.1.
I think the problem is with @types/d3-shapes. Is there a fix to this?

Problem come from TypeScript 3.1. They renamed CanvasPathMethods to CanvasPath. Use CanvasPath under TypeScript 3.1. If you need to support also older TypeScript versions, use d3. CanvasPath_D3Shape. See d3-shape/index.d.ts.

I'm not referencing the types directly but instead am using a library that depends on them: d3-ng2-service.
So I'm not entirely sure how to fix this, any help would be appreciated...

The package d3-ng2-service may need an update for TypeScript 3.1. Though I don't think it should: package.json.

Make sure your packages are all up to date by removing node_modules and run npm install.

@denisname thank you for that hint. I too had d3-ng2-service depend on @types/d3-shape but because of yarn.lock file didn't update to a later version (1.2.7) which has the fix. all good now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

demisx picture demisx  路  3Comments

alisabzevari picture alisabzevari  路  3Comments

lilling picture lilling  路  3Comments

JWT
svipas picture svipas  路  3Comments

jgoz picture jgoz  路  3Comments