Narrower (literal) type for Function.prototype.name if function is const #32527
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
ES6 function name, const assertions,
as const
, function as constSuggestion
I would like to see the
name
property of functions to be available at compile time if the given function is aconst
expression, e.g.:Use Cases
My use case is a function like shown above, where I would like to have static type checking available, without having to specify the extra parameter that specifies the function name to replace, e.g. compare:
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: