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.

@azure/core-tracing@1.0.1: Type alias 'Resolved' circularly references itself.

See original GitHub issue

Describe the bug

tsc

node_modules/@azure/core-rest-pipeline/node_modules/@azure/core-tracing/types/core-tracing.d.ts:81:21 - error TS2456: Type alias 'Resolved' circularly references itself.

81 export declare type Resolved<T> = T extends {
                       ~~~~~~~~

node_modules/@azure/core-rest-pipeline/node_modules/@azure/core-tracing/types/core-tracing.d.ts:83:41 - error TS2315: Type 'Resolved' is not generic.

83 } ? F extends (value: infer V) => any ? Resolved<V> : never : T;
                                           ~~~~~~~~~~~

node_modules/@azure/core-rest-pipeline/node_modules/@azure/core-tracing/types/core-tracing.d.ts:131:212 - error TS2315: Type 'Resolved' is not generic.

131     }, Callback extends (updatedOptions: Options, span: Omit<TracingSpan, "end">) => ReturnType<Callback>>(name: string, operationOptions: Options

To Reproduce pacakge.json

{
  "name": "repro",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@azure/core-rest-pipeline": "^1.8.1",
    "typescript": "^3.9.10"
  }
}

index.ts

import { Resolved } from "./node_modules/@azure/core-tracing"
let r: Resolved<string>;

tsconfigs.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "outDir": "dist",
    "rootDir": ".",
    "sourceMap": true,
    "strict": false
  }
}
  1. npm install
  2. npm run build

Expected behavior Project should build successfully.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
maorlegercommented, May 11, 2022

Hi @nmarinel and @hund030 - It looks like our Resolved type uses features that are available in TypeScript >= 4.1, specifically https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#recursive-conditional-types

We are looking into options for downleveling the types to support TypeScript 3.x but in the interim if you can use TypeScript 4.1 or later this error should be resolved.

3reactions
hund030commented, May 9, 2022

I just workaround this issue by adding

    "skipLibCheck": true,

in my tsconfig.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type alias circularly references itself · Issue #14174 - GitHub
I'm trying to create a type that circularly references itself, but in a way that it makes sense - or at least it...
Read more >
Type alias circularly references itself - Stack Overflow
Per the documentation, a type alias can refer to itself in a property, but not anywhere else on the right side of the...
Read more >
Resolved type alias - Microsoft Learn
A narrower version of TypeScript 4.5's Awaited type which Recursively unwraps the "awaited type", emulating the behavior of await.
Read more >
Error TS2456: Type alias 'Awaited' circularly references itself
I have an error when adding angular instansearch module: Error: ../../../node_modules/instantsearch.js/es/types/utils.d.ts:12:21 - error ...
Read more >
TypeScript interface vs. type - pawelgrzybek.com
Equivalent with type alias results with Type alias circularly references itself compiler error. Recursively chained type aliases result in ...
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