Skip to content

interface stubbing for anonymous implementations #16755

Closed
@mjbvz

Description

From @tvald on June 23, 2017 22:31

Similar to microsoft/vscode#7073, provide a code action to create stubs for an anonymous implementation of a type:

interface Foo {
  field: string,
  func(): void
}

const bar: Foo = {}
// expand above line into...
const bar: Foo = {
  field: 'string',
  func(): void {
    throw new Error('not yet implemented')
  },
}

Ideally, this would also be able to stub in the anonymous implementation of a function argument, but that would require inference of the interface being targeted for implementation:

function example(arg: Foo): void { }

example({})
// expand above line into...
example({
  field: string,
  func(): void {
    throw new Error('not yet implemented')
  },
}

Copied from original issue: microsoft/vscode#29363

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Domain: Completion ListsThe issue relates to showing completion lists in an editorDomain: Quick FixesEditor-provided fixes, often called code actions.Experience EnhancementNoncontroversial enhancementsSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions