Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FunctionLike = SignatureDeclaration#22365

Merged
1 commit merged into
mastermicrosoft/TypeScript:masterfrom
fnlikemicrosoft/TypeScript:fnlikeCopy head branch name to clipboard
Mar 9, 2018
Merged

FunctionLike = SignatureDeclaration#22365
1 commit merged into
mastermicrosoft/TypeScript:masterfrom
fnlikemicrosoft/TypeScript:fnlikeCopy head branch name to clipboard

Conversation

@ghost

@ghost ghost commented Mar 6, 2018

Copy link
Copy Markdown

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

@weswigham weswigham left a comment

Copy link
Copy Markdown
Member

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 😛

@DanielRosenwasser DanielRosenwasser left a comment

Copy link
Copy Markdown
Member

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

ghost commented Mar 9, 2018

Copy link
Copy Markdown
Author

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.