Skip to content

Crash in compareSignaturesRelated from @types/jest-in-case #30171

Closed
@sandersn

Description

@sandersn

From the nightly DT run.

  1. Clone DT, go to types/jest-in-case, run tsc:
✔ jest-in-case  [master|✔]$ tsl
/home/nathansa/ts/built/local/tsc.js:88011
                throw e;
                ^

TypeError: Cannot read property 'length' of undefined
    at Object.unescapeLeadingUnderscores (/home/nathansa/ts/built/local/tsc.js:12932:19)
    at compareSignaturesRelated (/home/nathansa/ts/built/local/tsc.js:41802:103)
    at signatureRelatedTo (/home/nathansa/ts/built/local/tsc.js:43198:24)
    at signaturesRelatedTo (/home/nathansa/ts/built/local/tsc.js:43169:30)
    at structuredTypeRelatedTo (/home/nathansa/ts/built/local/tsc.js:42875:39)
    at recursiveTypeRelatedTo (/home/nathansa/ts/built/local/tsc.js:42624:64)
    at isRelatedTo (/home/nathansa/ts/built/local/tsc.js:42247:38)
    at checkTypeRelatedTo (/home/nathansa/ts/built/local/tsc.js:42029:26)
    at checkTypeRelatedToAndOptionallyElaborate (/home/nathansa/ts/built/local/tsc.js:41354:24)
    at checkApplicableSignature (/home/nathansa/ts/built/local/tsc.js:49718:26)
// @Filename: index.d.ts
declare const global: NodeJS.Global;
interface Config {
    name?: string;
    only?: boolean;
    skip?: boolean;
    [key: string]: any;
}
type Tester<Opts> = (opts: Opts, done: jest.DoneCallback) => any;
type TestCases<Opts> = ReadonlyArray<Opts> | { [name: string]: Opts };
declare function cases<Opts extends Config>(title: string, tester: Tester<Opts>, testCases: TestCases<Opts>): void;
export = cases;
// @Filename: jest-in-case-tests.ts
// (this is only the piece of the tests required to cause the crash)
import cases = require("jest-in-case");
test('array', () => {
    const tester = jest.fn(opts => {
        expect(add(opts.augend, opts.addend)).toBe(opts.total);
    });
    cases(title, tester, testCases);
});

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueHigh Priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions