Skip to content

FunctionLike = SignatureDeclaration #22365

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

Merged
1 commit merged into from
Mar 9, 2018
Merged

FunctionLike = SignatureDeclaration #22365

1 commit merged into from
Mar 9, 2018

Conversation

ghost
Copy link

@ghost ghost commented Mar 6, 2018

FunctionLike and SignatureDeclaration wind up being identical types once all sub-unions are flattened. You can test this out with:

import ts = require("typescript");
let a: ts.FunctionLike = <any>null;
let b: ts.SignatureDeclaration = <any>null;
a = b;
b = a;

My suggested fix would be to just use SignatureDeclaration everywhere.

(Ref: #16988)

@ghost ghost requested a review from weswigham March 6, 2018 21:19
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am willing to believe that this is currently the case, even though it probably wasn't always so 😛

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the appropriate change is to keep FunctionLike and brand the constituents instead?

@ghost ghost force-pushed the fnlike branch from db9d552 to 2f2af6d Compare March 7, 2018 15:58
@ghost
Copy link
Author

ghost commented Mar 9, 2018

Summary of offline discussion with @DanielRosenwasser: We don't need a brand type because SignatureDeclaration is already a union type, which supports narrowing already.

@ghost ghost merged commit 2170f6e into master Mar 9, 2018
@ghost ghost deleted the fnlike branch March 9, 2018 00:31
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants