Skip to content

getApplicableRefactors returns "Install missing types package" quickfix #19378

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 2.6.1-insiders.20171019

Code

In a empty project with a package.json that includes lodash but not @types/lodash. Try writing an import:

import _ from 'lodash'

Request quickfixs on 'lodash'

Bug

getApplicableRefactors is also returning a quick fix here for Install missing types package

Trace  - 11:13:01 AM] Sending request: getApplicableRefactors (51). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/src/test.ts",
    "startLine": 1,
    "startOffset": 15,
    "endLine": 1,
    "endOffset": 23
}
[Trace  - 11:13:01 AM] Response received: getApplicableRefactors (51). Request took 2 ms. Success: true 
Result: [
    {
        "name": "Install missing types package",
        "description": "Install missing types package",
        "actions": [
            {
                "description": "Install '@types/lodash'",
                "name": "install"
            }
        ]
    }
]
[Trace  - 11:13:01 AM] Sending request: getCodeFixes (52). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/src/test.ts",
    "startLine": 1,
    "startOffset": 15,
    "endLine": 1,
    "endOffset": 23,
    "errorCodes": [
        2307
    ]
}
[Trace  - 11:13:01 AM] Response received: getCodeFixes (52). Request took 2 ms. Success: true 
Result: [
    {
        "description": "Install '@types/lodash'",
        "changes": [],
        "commands": [
            {
                "type": "install package",
                "packageName": "@types/lodash"
            }
        ]
    }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions