Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
TedPattison
Microsoft Employee
Microsoft Employee

Using typing utility versus npm install @types

Hi all,

I just wanted to gather some feedback from the team and from any other devs who would like to respond. All the Microsoft documentation and samples about adding D3 typed definition files to a custom visual project use the typings utility. Here is what the instructions are on the Power BI Visuals repo in GitHub:

 

# First, install D3 v3.5.5 because Power BI does not yet support D3 v4
npm install [email protected] --save

 

# Next, install typings utility
npm install typings -g

 

# Next, install typings files for D3
typings install --save --global dt~d3     <- Error as it attempts install D3 v4 typings file

 

# In the GitHub issues list for the repo, I found that workaround that works
typings install --save --global dt~d3#0.0.0+20160907005744

 

While the typings utility works these days, looking forward it seems like this utility is being phased out in general node.js and npm development and developers are now standardizing on using the regular npm install command to install typed definition files from the Definitely Typed project.

 

Here the steps that I am using to create a new custom visual project with support for D3 programming.

 

pbiviz new barchart
cd barchart
npm install d3@3 --save
npm install @types/d3@3 --save

 

Once you have one that, modify the externalJS setting in pbiviz.json file

"externalJS": [
  "node_modules/d3/d3.js"
]

 

Then update the files section of the tsconfig.json file.
"files": [
    ".api/v1.5.0/PowerBI-visuals.d.ts",
    "src/visual.ts",
    "node_modules/@types/d3/index.d.ts"

]

 

It use to take me a while to configure all this and now it takes less than a minute. I am able to also add any other JS library and the PowerBI utility libraries for things like formatting in the same fashion.

 

So here are my two questions for everyone.

  1. Has anyone else tried moving away from the typings utility?
  2. Does anyone see any potential problems with me using (and telling others to use) the npm install @types approach instead of using the typings utility?

Thanks for any feedback you can provide.

 

Ted

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

Hello @TedPattison,

 

Thanks for your feedback.

The powerbi-visuals-tools (PBIVIZ) <1.5.0 doesn't support @types packages due to using TypeScript 1.8.x.

We've have updated TypeScript version in PBIVIZ tools and it's 2.1.6 now.

 

In other words, there's no risk to use @types with the latest version of PBIVIZ tools.

We've already been using @types since PBIVIZ 1.5.0 release. We're going to update our documentation soon.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

[email protected]

View solution in original post

1 REPLY 1
v-viig
Community Champion
Community Champion

Hello @TedPattison,

 

Thanks for your feedback.

The powerbi-visuals-tools (PBIVIZ) <1.5.0 doesn't support @types packages due to using TypeScript 1.8.x.

We've have updated TypeScript version in PBIVIZ tools and it's 2.1.6 now.

 

In other words, there's no risk to use @types with the latest version of PBIVIZ tools.

We've already been using @types since PBIVIZ 1.5.0 release. We're going to update our documentation soon.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

[email protected]

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors