I'm currently using the Power BI Visuals API to transfer my D3 chord diagram into a power bi visual. I've been using the Microsoft Chord GitHub Repo as a starting reference. I'm creating the supporting classes, but I'm getting errors returned in my version even when I use the same code from the microsoft repo.
Looking specifically at the 'columns.ts' file, when I copy the code as is from the github, I get errors on the 'let varName: type = x' lines saying that undefined cannot be assigned to DataViewTable type. But I cloned the entire repository from Microsoft, and I don't get those errors when I import their file directly.
Code is exactly the same. Cloned from GitHub Copied from GitHub to my project
I've tried adding try catch statements, if else checks, and I've also tried the non-null assertion operator where I can - but I still run into issues in the functions that return null. I just don't understand why the same code will provide errors in one location.
You may have
strictNullChecksenabled in yourtsconfig.jsonwhereas it doesn't appear to be enabled in this repo'stsconfig.json.Note: This may also be listed as
strictwhich enablesstrictNullChecksas well as a number of other strict type-checking flagsIf that is the case, their configuration will have looser type checking rules (when it comes to
null/undefinedchecking) than yours, effectively allowing assignment ofnullorundefinedto any other type, even if it is not explicitly stated in the type definition.Typescript Playgrounds:
strictNullChecksenabledstrictNullChecksdisabledIf this is the case, you have the option to:
strictNullChecksand accept the same loose typing rules| nullor| undefinedin variable definitions that could/should handle those values)