question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 13: Unable to build Cannot find namespace 'TopoJSON'

See original GitHub issue

When trying to build a project with ng serve I get the following errors

Error: node_modules/@unovis/angular/dist/lib/components/topojson-map/topojson-map.component.d.ts:56:16 - error TS2503: Cannot find namespace 'TopoJSON'.

56     topojson?: TopoJSON.Topology;
                  ~~~~~~~~


Error: node_modules/@unovis/ts/components/topojson-map/config.d.ts:9:16 - error TS2503: Cannot find namespace 'TopoJSON'.

9     topojson?: TopoJSON.Topology;
                 ~~~~~~~~

I’ve added TopoJSON to my package.json but the issue persists. I’ve added the following packages:

"@types/topojson-specification": "^1.0.2",
"topojson": "^3.0.2",
"topojson-client": "^3.1.0",

However, updating the types in the files to Any fixes the issue. Or just importing TopoJSON into the file explicitly. Is there something I’m missing in setting up the package? I figure that my tsconfig setup can also be the issue but just wanted to check if you guys have seen this before


Had one more error that was fixed by adding @types/lodash

Error: node_modules/@unovis/ts/core/component/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'lodash'.

1 /// <reference types="lodash" />
                        ~~~~~~

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rokotyancommented, Dec 22, 2022

@AhmedHalat Great and thanks for writing about your fix!

When you explicitly set types in your tsconfig, only those types will be visible to the compiler. That’s why you had to add "topojson-client" there explicitly. Here is an excerpt from TSConfig docs:

By default all visible ”@types” packages are included in your compilation. … … If types is specified, only packages listed will be included in the global scope.

We’ll add a few words about it to our docs too.

1reaction
rokotyancommented, Dec 20, 2022

@AhmedHalat Ok, I’ll need to look deeper into the issue. I’ll keep you posted!

Read more comments on GitHub >

github_iconTop Results From Across the Web

maplibre v2.0.0 typings angular 13 · Issue #776 - GitHub
I now see this too in my project. As a workaround, you can set skipLibCheck: true in tsconfig.json file. In order to truly...
Read more >
Cannot find namespace 'MyApp' after Angular and Typescript ...
I have a type definition file where all dto objects for my app are exposed to global scope. DtosGenerator.d.ts declare module MyApp.Rest.
Read more >
@types/geojson - npm
Start using @types/geojson in your project by running `npm i ... There are 370 other projects in the npm registry using @types/geojson.
Read more >
angular/angular-cli - Gitter
I tried resolving by reading up on SO, and they've recommended to add some paths to angular-cli.json, but I can't find it on...
Read more >
Cannot find namespace 'WebMidi' in Angular - CircleCI Discuss
What I've done: added "types": ["WebMidi"] under "compilerOptions" in all of my ts configuration files including tests.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found