- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
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
Is there any reason shorthand property names ({ a }, etc.) don't allow type casting around the names? It would be a mildly useful feature.
Code
The following object literals are all intended to compile to { foo: foo }:
function take(arg: { foo: string }) { }
let foo: string;
// Allowed
take({ foo });
take({ foo: foo });
take({ foo: foo as string });
take({ foo: <string>foo });
// Syntax errors
take({ <string>foo });
take({ foo as string });Expected behavior:
These should all compile to the same thing.
Actual behavior:
The lines with type casting in the names are syntax errors.
jwbay, ChiriVulpes, monolithed and jablko
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