Skip to content

Declaration file generated reports error on compilation while there were no errors reported during generation #5659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sheetalkamat opened this issue Nov 13, 2015 · 3 comments · Fixed by #6278
Assignees
Labels
Bug A bug in TypeScript Domain: Literal Types Unit types including string literal types, numeric literal types, Boolean literals, null, undefined Fixed A PR has been merged for this issue

Comments

@sheetalkamat
Copy link
Member

Test case: https://github.com/Microsoft/TypeScript/blob/master/tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint01.ts#L11

Repro:
Compile a.ts with --d
No errors reported
Compile a.d.ts generated, reports error

a.ts:

function foo<T extends "foo">(f: (x: T) => T) {
    return f;
}

function bar<T extends "foo" | "bar">(f: (x: T) => T) {
    return f;
}

let f = foo(x => x);
let fResult = f("foo");

let g = foo((x => x));
let gResult = g("foo");

let h = bar(x => x);
let hResult = h("foo");
hResult = h("bar");
@mhegazy mhegazy added the Bug A bug in TypeScript label Dec 2, 2015
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Dec 2, 2015
@DanielRosenwasser
Copy link
Member

Oof. Specifically, the errors are:

$ tsc .\c.d.ts
c.d.ts(3,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
c.d.ts(5,16): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.

Luckily we're removing restrictions on specialized signatures.

@DanielRosenwasser
Copy link
Member

Actually, something is making this consider itself a specialized signature, so I'm going to fix this first.

@DanielRosenwasser
Copy link
Member

This is due issues I'm trying to address in #6143. The error is on f and g, not on foo and bar.

@DanielRosenwasser DanielRosenwasser added the Domain: Literal Types Unit types including string literal types, numeric literal types, Boolean literals, null, undefined label Jan 4, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 2, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Literal Types Unit types including string literal types, numeric literal types, Boolean literals, null, undefined Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants