-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Bug Report
🔎 Search Terms
expando, property assignments, arrow expression, #26368, #44988, #42203
🕗 Version & Regression Information
- This is the behavior in every version I tried since TypeScript 3.1
⏯ Playground Link
Playground link with relevant code
💻 Code
type DescribableFunction = {
description: string;
(someArg: number): boolean;
};
const ok: DescribableFunction = (x: number) => false;
ok.description = 'description';
const ko: DescribableFunction = ((x: number) => false); // error!
// ~~ <-- Property 'description' is missing
ko.description = 'description';
🙁 Actual behavior
ko
is not recognized as a function capable of having expando properties added to it, while ok
is recognized as such.
🙂 Expected behavior
Both ok
and ko
should behave the same way and allow expando properties as implemented in #26368. I don't know if it's common or not to use parentheses in this situation, but it was surprising to me when I ran into this discrepancy. I see from #44988 and #42203 that sometimes parentheses will disrupt things, so this is presumably an unanticipated use case that may not be important enough for anyone to address.
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript