Is there a way to insert interface template into function parameters?
Some context
I made a function that takes an interface with 5 properties as an argument.
interface MyInterface {
readonly myProperty : string
readonly anotherProperty: number
optionalProperty1?: number[]
optionalProperty2?: number
// I can have some comments to describe this property in great detail
lastProperty: string
}
function interfaceConsumer(myVariable: MyInterface): string {
/* some code here */
return ""
}
TS knows everything about that interface, it shows hints about expected properties and would warn me when in function arguments I create an object not compatible with the interface.

So can I have a way to autocomplete that interface in function parameters? I could copy-paste interface declaration, sure, but it's not the same and I would need to add commas, remove additional metadata or comments I might have there.
What would it look like?

interfaceConsumer({
myProperty : string
,anotherProperty : number
,optionalProperty1: number[] // ?
,optionalProperty2: number // ?
,lastProperty : string
})
- Leading commas and alignment are my personal preferences of course.
- Having types as initial "values" is quite crucial though: it's important to have there something invalid so that user does not leave a value unmodified by accident and having type information inserted could be handy IMO.
- Dropping information about optional arguments doesn't look like a good idea, so I'd insert it back with trailing comment.
The question
Can I have such interface autocompletion experience now? Tell me if there are plugins/hotkeys/workflows I'm not aware of that would let me have this experience.
Not sure this would be useful in general. Pretty sure it's possible to write a TS language service to do this. I'm personally not aware if any exist, and not very likely to spend my time on implementing it. But anyone willing to try their hand at this could start here
I am new to open-source and I was hoping to contribute here.
Hello. Contributions are always welcome, but this particular issue might be a bit too complicated to start with. Besides, it makes much more sense to implement this outside of Atom-TS, i.e. as a TypeScript language service plugin (https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin).
I think it should be doable by hooking into getCompletionsAtPosition and adding a completion with all the fields there.
Getting all the fields might be a little tricky though, but in principle should boil down to getting the expected type at the current location (which is the trickiest part), then checking if it's an object, then iterating over its properties.
Perhaps an easier approach would be to hack into object literal completion (i.e. list of completions shown at {‸}), which should have all object properties and nothing else as completions (shown in the first screen-shot in OP)
As I said above, I'm not entirely sure how useful this would be in general. TypeScript already has object literal completions, which fulfil the same general purpose, albeit slightly differently.