microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.63k stars 12.44k forks source link

No information for Error: Debug Failure. No error for last overload signature #35186

Open bene-starzengruber opened 4 years ago

bene-starzengruber commented 4 years ago

TypeScript Version: 3.7.2

Search Terms: Debug Failure, No error for last overload signature, Typescript 3.7.2, Sonar

Code / Error Code is not available - executing entity is sonar runner

As well formatted image image

or as code...

Analyzing 292 typescript file(s) with the following configuration file /jenkins/workspace/Viper/Nova-Web/trunk/nova/packages/Nova/nova-app/tsconfig.json
00:20:19  00:20:18.347 ERROR - /jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:2137
00:20:19  00:20:18.347 ERROR -             throw e;
00:20:19  00:20:18.347 ERROR -             ^
00:20:19  00:20:18.347 ERROR - 
00:20:19  00:20:18.347 ERROR - Error: Debug Failure. No error for last overload signature
00:20:19  00:20:18.347 ERROR -     at resolveCall (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:55202:38)
00:20:19  00:20:18.348 ERROR -     at resolveCallExpression (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:55548:20)
00:20:19  00:20:18.348 ERROR -     at resolveSignature (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:55904:28)
00:20:19  00:20:18.348 ERROR -     at getResolvedSignature (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:55935:26)
00:20:19  00:20:18.348 ERROR -     at getContextualTypeForArgumentAtIndex (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:52352:118)
00:20:19  00:20:18.348 ERROR -     at getContextualTypeForArgument (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:52347:50)
00:20:19  00:20:18.348 ERROR -     at getContextualType (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:52718:28)
00:20:19  00:20:18.348 ERROR -     at getApparentTypeOfContextualType (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:52620:17)
00:20:19  00:20:18.348 ERROR -     at getContextualSignature (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:52924:24)
00:20:19  00:20:18.348 ERROR -     at getContextuallyTypedParameterType (/jenkins/workspace/Viper/Nova-Web/trunk/nova/node_modules/typescript/lib/typescript.js:52200:39)
00:20:19  00:20:18.390 ERROR - External process `node --max-old-space-size=2048 /jenkins/workspace/Viper/Nova-Web/trunk/nova/packages/Nova/nova-app/.sonar/sonarts-bundle/node_modules/tslint-sonarts/bin/tsrunner` returned an empty output. Run with -X for more information

Expected behavior: Should give some additional information what the problem is

Actual behavior: When looking at the error, I have no idea if it's an issue with my application code, with sonar or with typescript itself

RyanCavanaugh commented 4 years ago

It's a crash, so by definition something has broken in an unexpected way 😢

Some code snippet that would reproduce this crash would be extremely helpful - would you be able to share an example? We might be able to deduce what went wrong from staring at the code, but it takes a lot longer

enzy commented 4 years ago

So we use TS 3.7.2 and are getting this error while using @mangoweb/scripts-base v0.0.12

We hit this error when we try to initialize a class which extends our Component.ts

We are able to overcome this error with following ways:

enzy commented 4 years ago

@RyanCavanaugh I made a minimal test case for our version of Debug Failure Error: https://github.com/enzy/ts-scriptsbase-debug-failure

pprice commented 4 years ago

I have another minimal repo for this, with typescript@3.8.3 and @apache-arrow/ts@0.17.0

src/test.ts

import { Table } from "@apache-arrow/ts";

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "outDir": "./dist/"
  }
}
<snip>\node_modules\.pnpm\registry.npmjs.org\typescript\3.8.3\node_modules\typescript\lib\tsc.js:81040
                throw e;
                ^

Error: Debug Failure. No error for last overload signature
    at resolveCall (<snip>\node_modules\.pnpm\registry.npmjs.org\typescript\3.8.3\node_modules\typescript\lib\tsc.js:47385:38)
    at resolveCallExpression (<snip>\node_modules\.pnpm\registry.npmjs.org\typescript\3.8.3\node_modules\typescript\lib\tsc.js:47680:20)
tuomokar commented 3 years ago

I had this with the latest version of TypeScript (currently 4.3.2), but setting the "includes" property in tsconfig.json removed the issue.

ksabry commented 3 years ago

I have encountered this issue in TypeScript 4.4.3, I don't know if further examples are wanted but this minimal repro may be useful since it's standalone (no packages); the error seems to occur no matter the tsconfig options, I tested that it still occurs with no tsconfig at all.

interface CollectionDocument<TIdPrefix extends string> {
    id: `${TIdPrefix}_${string}`;
}

type CollectionDocumentIdPrefix<TCollectionDocument extends CollectionDocument<string>> =
    TCollectionDocument["id"] extends `${infer TIdPrefix}_${string}` ? TIdPrefix : never;

type CollectionSpecs = { [name: string]: CollectionDocument<string>; };

type CollectionSpecNames<TCollectionNames extends string> = TCollectionNames | `History_${TCollectionNames}`;

interface HistoryDocument<TDocument extends CollectionDocument<string>> extends CollectionDocument<`hist_${CollectionDocumentIdPrefix<TDocument>}`> {
    document: TDocument | null;
}

type CollectionFromName<
    TCollectionSpecs extends CollectionSpecs,
    TCollectionName extends CollectionSpecNames<keyof TCollectionSpecs & string>,
> =
    TCollectionName extends `History_${infer TOriginalCollectionName}`
        ? Collection<HistoryDocument<TCollectionSpecs[TOriginalCollectionName]>>
        : Collection<TCollectionSpecs[TCollectionName]>;

class Driver<TCollectionSpecs extends CollectionSpecs = CollectionSpecs> {
    public getCollection<TCollectionName extends CollectionSpecNames<keyof TCollectionSpecs & string>>(): CollectionFromName<TCollectionSpecs, TCollectionName> {
        // This line seems to be the origin of the error, the 'this' argument specifically
        return new Collection<CollectionDocument<string>>(this) as any;
    }
}

class Collection<TDocument extends CollectionDocument<string>> {
    public driver: Driver;
    public document: TDocument;

    public constructor(driver: Driver) {
        this.driver = driver;
    }
}
bagbag commented 2 years ago

An other example:

versions: typescript: 4.5.5 and 4.7.0-dev.20220218 mongodb: 4.4.0

import { Collection } from 'mongodb';
import type { OptionalUnlessRequiredId } from 'mongodb';

export type MongoDocument<T> = OptionalUnlessRequiredId<Omit<T, 'id'> & { _id: string }>;

export type MongoDocumentWithPartialId<T> = OptionalUnlessRequiredId<Omit<T, 'id'> & { _id?: string }>;

export declare function toProjectedEntity<T extends Entity>(document: MongoDocumentWithPartialId<T>): any;

export class MongoBaseRepository<T extends Entity> {
  readonly collection: Collection<any>;

  async loadManyProjectedByFilter(): Promise<any> {
    const documents = await this.collection.find<MongoDocument<T>>({}).toArray();
    return [documents.map(toProjectedEntity)];
  }
}

Only happens if Entity is an non existing type.

Renatopster commented 1 year ago

The point about this issue should be to emit more detailed feedback whenever it happens, so we can troubleshoot it by ourselves. This other issue has a suggestion about how to do that: https://github.com/microsoft/TypeScript/issues/33133#issuecomment-526277334 It would already be a great improvement, but if it were also possible to retrieve the file/line where the call happened, it would be perfect.