-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
TypeScript gives autocomplete suggestions for object properties and literals when a type is known at the time the object is being created / argument typed, i.e. explicitly declared, inferred or cast.
I've been a long time TypeScript user and have recently started contributing to a large project which is based on Flow and this is the single feature that I miss the most (right next to live-feedback). I have tried multiple Flowtype integrations (Atom/Nuclide, WebStorm, VSCode, SublimeText) and none of them offer this type of autocompletion, so I presume the problem is that the Flow server simply does not offer this information.
These are some of the scenarios that should be supported:
- explicitly declared
type Type = { a: string }
const a: Type = {
// ... autocomplete all properties in Type
}- type known through a nested definition
type OtherType = { a: string }
type Type = { a: OtherType }
const a: Type = {
a: {
// ... autocomplete all properties in OtherType
}
}- type inferred / expected
type Type = { a: string };
function example(param: Type) { };
example({ /* ... autocomplete all properties in Type */ });- type declared indirectly
type Type = { a: string }
function example(): Type {
return {
// ... autocomplete all properties in Type
}
}- type cast
type Type = { a: string }
function example() {
return ({
// ... autocomplete all properties in Type
} : Type)
}davesnx, dfejgelis, johntran, ymeel, lttb and 25 moregcazaciuc, pstockley, zaaack, bbrzoska, allenhsu and 6 more
