Search code examples
javascriptnode.jstypescriptexpressazure-ai

TSLint is throwing 'error TS2459: Module '"@azure/core-tracing"' declares 'Span' locally, but it is not exported.' and other errors


I have no idea where to start with fixing this error. The output doesn't really tell me a whole lot except that it sounds like something is wrong with the '@azure/ai-text-analytics' install. I've npm uninstall'd it twice and reinstalled it twice. It's giving the same error so I guess it isn't the install?

The full error I get:

node_modules/@azure/core-http/types/latest/src/createSpanLegacy.d.ts:1:10 - error TS2459: Module '"@azure/core-tracing"' declares 'Span' locally, but it is not exported.

1 import { Span } from "@azure/core-tracing";
           ~~~~

  node_modules/@azure/core-tracing/types/core-tracing.d.ts:6:10
    6 import { Span } from '@opentelemetry/api';
               ~~~~
    'Span' is declared here.

node_modules/@azure/core-http/types/latest/src/webResource.d.ts:9:23 - error TS2305: Module '"@azure/core-tracing"' has no exported member 'Context'.

9 import { SpanOptions, Context } from "@azure/core-tracing";
                        ~~~~~~~


Found 2 errors.

Obviously none of those files are my own code so I don't have anything else to show that I can think of.


Solution

  • I received help on GitHub support. Here's the link to the answer.

    I did more debugging and it looks like the TypeScript compiler is trying to build the d.ts files inside node_modules which is causing the build failure. Looks like using the paths option in your tsconfig.json file caused this issue and when I removed it, the project built just fine with [email protected].