🔎 Search Terms
circular definition binding inference
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/dev/bug-workbench/?ts=5.4.0-beta#code/PTAEAEDMEsBsFMB2BDAtvAXKAJsgLsgHR4DOAUNKgA4D2ATnqHgJ5XygDeoAIvsqAF9QkOjVSgA5IWBVRAY3gkS9CQG4yIUJVoMmrdhyEixoAETSWbU6tCaAPAFoHoAK6IHcsekSNkibKDwdKJ0oADmNIqgyADuyMxkZPAAHjqMkG5yeNA0iOHweLwEABQAlJxkoFW2YOCkDilsWQ3B9JXVdAUudHmeiCR4dC5ZRcjFhuUk+NAkMFEA2gC66gKJGYhZOb25A0MjfMW4BFij5RztVX0DnKCEd7I0VCSCoAC8OHzq1TWgnXjdeSOyBs31B1XsTlc7k8qG8vn8gVaoQiUVi8Quvy6PQqYKqd0IDyeABoMQIVolNFA4Eg0Jg9GxiORGvRGJZ2AA1ZCwFzsd6GCm1GAIFDoLAPBRKeiMijUFk3MIFUYvYziKTAIFqRLaOVsnHVTnc+AkoyiVUWfSapKpHX6Hh8N56qoARxcfmyLCwBp5K3UZGw8DksGQnWEmWyuVAck6+HgACV4C7FHgAAryRTKOh2eNOgB8xQxVGgbFg0EQdLKbxzoGzJNKWGzvuZuiujHF6foDqj8Bj2Z5A1TNAlGfz3wVhT4ZFKvspQppotAqGQpel2t0XDbktCJpMao3Gc1TcY-sgyBcsFbac308F1JFdJi9AA1kFS3ggieFCvZbpdQBlIIAG5BMIpqSNIi6lpah70uwAD6AAqDrFGyNCQKA-50EBdBTmQQA
💻 Code
(reduced down from a large project as best I could)
// @filename: data.tsimporttype{Data}from'./processor';// import type {} from "./type"; // <-- un-comment and error goes awayexportfunctiongetData(){// @ts-expect-errorreturnconstructData({})satisfies[];}functionconstructData(data: Data){const{ ...props}=data;// return data; // <-- un-comment and error goes awayreturn{
...props,};}// @filename: type.tsexporttypeValue={}// @filename: processor.tsimport{getData}from'./data';importtype{Value,}from'./type';exporttypeData={quantity: Value;};declarefunctioncreateRequestProcessor<Req>(pipeline: ()=>Req,): Req;exportconstprocessor=createRequestProcessor(getData);// @filename: main.tsimport{processor}from'./processor';exportdefaultprocessor;// @filename: workerinterface.tsimporttypeServerfrom'./main';exporttype_T=(typeofServer);🙁 Actual behavior
Errors about circular types
implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
🙂 Expected behavior
Either no error, or a clearer error message. The types don't appear to be circular.
Additional information about the issue
The code that is now erroring was already using // @ts-expect-error to ignore an error. Fixing that hidden error avoids this issue.
Adding an unused import (as commented in the same) also fixes the error. So it seems that TypeScript has gotten into an odd state.
🔎 Search Terms
circular definition binding inference
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/dev/bug-workbench/?ts=5.4.0-beta#code/PTAEAEDMEsBsFMB2BDAtvAXKAJsgLsgHR4DOAUNKgA4D2ATnqHgJ5XygDeoAIvsqAF9QkOjVSgA5IWBVRAY3gkS9CQG4yIUJVoMmrdhyEixoAETSWbU6tCaAPAFoHoAK6IHcsekSNkibKDwdKJ0oADmNIqgyADuyMxkZPAAHjqMkG5yeNA0iOHweLwEABQAlJxkoFW2YOCkDilsWQ3B9JXVdAUudHmeiCR4dC5ZRcjFhuUk+NAkMFEA2gC66gKJGYhZOb25A0MjfMW4BFij5RztVX0DnKCEd7I0VCSCoAC8OHzq1TWgnXjdeSOyBs31B1XsTlc7k8qG8vn8gVaoQiUVi8Quvy6PQqYKqd0IDyeABoMQIVolNFA4Eg0Jg9GxiORGvRGJZ2AA1ZCwFzsd6GCm1GAIFDoLAPBRKeiMijUFk3MIFUYvYziKTAIFqRLaOVsnHVTnc+AkoyiVUWfSapKpHX6Hh8N56qoARxcfmyLCwBp5K3UZGw8DksGQnWEmWyuVAck6+HgACV4C7FHgAAryRTKOh2eNOgB8xQxVGgbFg0EQdLKbxzoGzJNKWGzvuZuiujHF6foDqj8Bj2Z5A1TNAlGfz3wVhT4ZFKvspQppotAqGQpel2t0XDbktCJpMao3Gc1TcY-sgyBcsFbac308F1JFdJi9AA1kFS3ggieFCvZbpdQBlIIAG5BMIpqSNIi6lpah70uwAD6AAqDrFGyNCQKA-50EBdBTmQQA
💻 Code
(reduced down from a large project as best I could)
🙁 Actual behavior
Errors about circular types
🙂 Expected behavior
Either no error, or a clearer error message. The types don't appear to be circular.
Additional information about the issue
The code that is now erroring was already using
// @ts-expect-errorto ignore an error. Fixing that hidden error avoids this issue.Adding an unused import (as commented in the same) also fixes the error. So it seems that TypeScript has gotten into an odd state.