Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
La propiedad 'transición' no existe en el tipo 'Selección<BaseType, {}, nulo, indefinido>'

Quiero usar d3js en angular2, pero cuando quiero agregar una transición cuando el elemento cambia, ocurre un error: Property 'transition' does not exist on type 'Selection<BaseType, {}, null, undefined>' Uso angular-cli para generar proyecto, y la versión de angular es 4.0.0, y d3js es 4.8.0

Aquí está mi typings.d.ts :

 declare module 'd3' { export * from 'd3-array'; export * from 'd3-axis'; export * from 'd3-brush'; export * from 'd3-chord'; export * from 'd3-collection'; export * from 'd3-color'; export * from 'd3-dispatch'; export * from 'd3-drag'; export * from 'd3-dsv'; export * from 'd3-ease'; export * from 'd3-force'; export * from 'd3-format'; export * from 'd3-geo'; export * from 'd3-hierarchy'; export * from 'd3-interpolate'; export * from 'd3-path'; export * from 'd3-polygon'; export * from 'd3-quadtree'; export * from 'd3-queue'; export * from 'd3-random'; export * from 'd3-request'; export * from 'd3-scale'; export * from 'd3-selection'; export * from 'd3-shape'; export * from 'd3-time'; export * from 'd3-time-format'; export * from 'd3-timer'; export * from 'd3-transition'; export * from 'd3-voronoi'; export * from 'd3-zoom';

}

Aquí está mi app.component.ts

 import * as d3 from 'd3'; ...... d3.select(this).select("path").transition().attr("d", function(d) { console.log(d); return arc2(<any>d); })

Si elimino transition() , funciona bien.

¿Cómo resolverlo? Gracias

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

He arreglado mi código por:

 import { select as d3Select } from 'd3-selection'; import { transition as d3Transition } from 'd3-transition'; d3Select.prototype.transition = d3Transition;

y luego use d3Select en su código en lugar de seleccionar

puede seguir:https://github.com/DefinitelyTyped/DefinitelyTyped/issues/16176

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!