Skip to content

"Add extends constraint" doesn't auto-import dependencies #49965

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
// @filename: bar.ts
export type MyType = Record<string, string>

export function bar<T extends MyType>(obj: { prop: T }) {}

// @filename: foo.ts
import { bar } from "./bar";

function foo<T>(x: T) {
    bar({ prop: x })
}

Expected

import { bar, MyType } from "./bar";

function foo<T extends MyType>(x: T) {
    bar({ prop: x })
}

Actual

import { bar } from "./bar";

function foo<T extends MyType>(x: T) {
    bar({ prop: x })
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Quick FixesEditor-provided fixes, often called code actions.Effort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions