Skip to content

'declare method' code action creating invalid code #19165

@mjbvz

Description

@mjbvz

TypeScript Version: 2.6.0-dev.20171013

Code

main.ts

import Foo from "./foo";

const x = new Foo();
x.bar()

foo.ts

import {} from 'path'

export default class Foo {
}

Trigger the declare method 'bar' code action on f.bar

Expected behavior:
foo.ts becomes:

import {} from 'path'

export default class Foo {
    bar() {
        throw new Error("Method not implemented.");
    }
}

Actual behavior:
foo.ts becomes:

import {} from 'path'

export default class Foo {
}    bar() {
        throw new Error("Method not implemented.");
    }

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Quick FixesEditor-provided fixes, often called code actions.FixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions